Conditional Statement


Q11.

The conditional expansion facility of macro processor is provided to
GateOverflow

Q12.

What is the output of the following C code? #include < stdio.h > int main() { int index; for(index=1; index<=5; index++) { printf("%d", index); if (index==3) continue; } }
GateOverflow

Q13.

What will be the output of the following C program segment? char inChar = 'A' ; switch ( inChar ) { case 'A' : printf ("Choice A\ n") ; case 'B' : case 'C' : printf ("Choice B") ; case 'D' : case 'E' : default : printf ( " No Choice" ) ; }
GateOverflow

Q14.

Assume that X and Y are non-zero positive integers. What does the following Pascal program segment do? while X <> Y do if X > Y then X := X - Y else Y := Y - X; write(X);
GateOverflow

Q15.

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:
GateOverflow

Q16.

Consider the following program fragment if(a > b) if(b > c) s1; else s2;s2 will be executed if
GateOverflow

Q17.

Given the programming constructs I. assignment II. for loops where the loop parameter cannot be changed within the loop III. if-then-else IV. forward go to V. arbitrary go to VI. non-recursive procedure call VII. recursive procedure/function call VIII. repeat loop, which constructs will you not include in a programming language such that it should be possible to program the terminates (i.e., halting) function in the same programming language
GateOverflow

Q18.

Consider the following pseudo-codex:=1; i:=1; while (x <= 1000) begin x:=2^x; i:=i+1; end; What is the value of i at the end of the pseudo-code?
GateOverflow

Q19.

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; }
GateOverflow

Q20.

Consider the following C program: #include < stdio.h > int main( ) { int i, j, k = 0; j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5; k -= --j; for(i = 0; i < 5; i++) { switch(i + k) { case 1: case 2: printf("n%d", i+k); case 3: printf("n%d", i+k); default: printf("n%d", i+k); } } return 0; } The number of times printf statement is executed is ________.
GateOverflow