C Programming


Q81.

Consider the following pseudocodex:=1; i:=1; while ( x \leq 500 ) begin x:=2^x; i:=i+1; end What is the value of i at the end of the pseudocode?
GateOverflow

Q82.

Consider the following code segment: for (int k=0; k<20; k=k+2) { if (k % 3 == 1) system.out.print(k+ " "); } What is printed as a result of executing the code segment?
GateOverflow

Q83.

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

Q84.

An unrestricted use of the "go to" statement is harmful because of which of the following reason (s):
GateOverflow

Q85.

In the following Pascal program segment, what is the value of X after the execution of the program segment? X := -10; Y := 20; If X > Y then if X < 0 then X := abs(X) else X := 2*X;
GateOverflow

Q86.

An unrestricted use of the "goto" statement is harmful because
GateOverflow

Q87.

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

Q88.

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

Q89.

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

Q90.

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