C Programming
Q71.
Consider the following C code. #include < stdio.h > #include < math.h > void main () { double pi = 3.1415926535; int a = 1; int i; for (i=0; i < 3; i++) if (a = cos(pi * i/2)) printf("% d", 1); else printf("%d", 0); } What would the program print?Q72.
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?Q73.
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"); }Q74.
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 AQ75.
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?Q77.
An unrestricted use of the "go to" statement is harmful because of which of the following reason (s):Q78.
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;Q79.
Consider the C program below. #include < stdio.h > int *A, stkTop; int stkFunc(int opcode, int val) { static int size=0, stkTop=0; switch (opcode) { case -1: size = val; break; case 0: if (stkTop < size) A[stkTop++] = val; break; default: if (stkTop) return A[--stkTop]; } return -1; } int main() { int B[20]; A = B; stkTop = -1; stkFunc (-1, 10); stkFunc ( 0, 5); stkFunc ( 0, 10); printf ("%d\n", stkFunc(1, 0) + stkFunc(1, 0)); } The value printed by the above program is __________.Q80.
Let x be an integer which can take a value of 0 or 1. The statement if (x == 0) x = 1; else x = 0; is equivalent to which one of the following ?