# Conditional Statement

 Question 1
Consider the following ANSI C program.
 #include < stdio.h >
int main()
{
int i, j, count;
count=0;
i=0;
for (j=-3; j < =3; j++)
{
if (( j > = 0) && (i++))
count = count + j;
}
count = count +i;
printf("%d", count);
return 0;
}
Which one of the following options is correct?
 A The program will not compile successfully B The program will compile successfully and output 10 when executed C The program will compile successfully and output 8 when executed D The program will compile successfully and output 13 when executed
GATE CSE 2021 SET-1   C Programming
Question 1 Explanation:
 Question 2
What is the output of tho following program?
 main(){
int x=2, y=5;
if(x < y) return (x=x+y);
else printf("z1");
printf("z2");
}
 A z2 B z1z2 C Compilation error D None of these
ISRO CSE 2018   C Programming
Question 2 Explanation:

 Question 3
Assume A and B are non-zero positive integers. The following code segment:
 while(A!=B){
if(A > B)
A -= B;
else
B -= A;
}
cout << A; // printing the value of A
 A Computes the LCM of two numbers B Divides the larger number by the smaller number C Computes the GCD of two numbers D Finds the smaller of two numbers
ISRO CSE 2018   C Programming
Question 3 Explanation:
 Question 4
What will be the output of the following C code?
 #include < stdio.h >
main()
{
int i;
for(i=0;i<5;i++)
{
int i=10;
printf("%d" , i);
i++;
}
return 0;
}

 A 10 11 12 13 14 B 10 10 10 10 10 C 0 1 2 3 4 D Compilation error
ISRO CSE 2017   C Programming
Question 4 Explanation:
 Question 5
Consider the following segment of C-code:
int j, n;
j = 1;
while (j <= n)
j = j * 2;
The number of comparisons made in the execution of the loop for any n>0 is:
 A $\lceil \log_2n \rceil +1$ B n C $\lceil \log_2n \rceil$ D $\lfloor \log_2n \rfloor +1$
ISRO CSE 2016   C Programming
Question 5 Explanation:

There are 5 questions to complete.

### 6 thoughts on “Conditional Statement”

1. Question number 16 of conditional statements of c programming correct option is D.

• Thank You PRAFUL SAMBHAJI RANE,

2. Question number 3 is incomplete.

• Thank You Rahul,
We have updated the question.

3. 4. 