

MCQOPTIONS
Saved Bookmarks
This section includes 107 Mcqs, each offering curated multiple-choice questions to sharpen your Expressions knowledge and support exam preparation. Choose a topic below to get started.
1. |
For which of the following situation should the register storage class be used? |
A. | For local variable in a function |
B. | |
C. | C. |
D. | D. |
Answer» C. C. | |
2. |
What will be the output of the following code? #include< stdio> int main() { extern int a; static char j = E ; printf( %c %d , ++j, ++a); return 0; } |
A. | E 2 |
B. | F 1 |
C. | F Garbage |
D. | F 0 |
Answer» C. F Garbage | |
3. |
Where will the space be allocated for an automatic storage class variable? |
A. | In CPU register |
B. | In memory as well as in CPU register |
C. | In memory |
D. | On disk |
Answer» D. On disk | |
4. |
What will be the output of the following program? #include< stdio> int main() { register int I = 2; static char ch = A ; auto float j; int k; k = ++ch && I; k = ++ch; j = i-- + ++k * 2; printf( %d %f , k , j); return 0; } |
A. | B 3 |
B. | 65 138.000000 |
C. | 68 138.000000 |
D. | A 138 |
Answer» D. A 138 | |
5. |
What will be the output of the following program? #include< stdio> int main() { static unsigned int a = 23; register unsigned char c = R ; auto long unsigned q = 345L; static long signed p = 345L; printf( a = %u c = %c , a ,c); printf( nq = %ld p = %ld , q, p); return 0; } |
A. | a=23 c=R q = 345 p = 345 |
B. | A=23 c=R 0 0 |
C. | Garbage value |
D. | A=23 c=R q = 345 p = 345 |
Answer» B. A=23 c=R 0 0 | |
6. |
In case of a conflict between the names of a local and global variable what happens? |
A. | The global variable is given a priority. |
B. | The local variable is given a priority. |
C. | Which one will get a priority depends upon which one is defined first. |
D. | The compiler reports an error. |
Answer» C. Which one will get a priority depends upon which one is defined first. | |
7. |
What will be the output of the following code? static int I = 5; main() { int sum = 0 do { sum + = (1/i); }while(0 < I> printf( sum of the series is %d , sum); } |
A. | It will print the sum of the series 1/5+1/4+ +1/1. |
B. | It will produce a compilation error. |
C. | It will produce a run time error. |
D. | None |
Answer» D. None | |
8. |
What is the value of x after executing the following statement? int x = 011 | 0x10; |
A. | 13 |
B. | 19 |
C. | 25 |
D. | 27 |
Answer» D. 27 | |
9. |
Which of the following statement is correct about the code snippet given below? #include < stdio> int main() { int n = 12, k; printf( %d , (k = sizeof( n + 12.0))++); return 0; } |
A. | The code will print 17 |
B. | The code will print 5 |
C. | The code will result compile time error |
D. | The code will print 4 |
Answer» D. The code will print 4 | |
10. |
Expression x % y is equivalent to____? |
A. | (x (x/y)) |
B. | (x (x/y) * y) |
C. | (y (x/y)) |
D. | (y (x/y) * y) |
Answer» C. (y (x/y)) | |
11. |
What is the correct and fully portable way to obtain the most significant byte of an unsigned integer x? |
A. | x & 0xFF00 |
B. | x > > 24 |
C. | x > > ( CHAR_BIT * (sizeof(int) - 3)) |
D. | x > > ( CHAR_BIT * (sizeof(int) - 1)) |
Answer» E. | |
12. |
What is the value of X in the sample code given below? double X; X = ( 2 + 3) * 2 + 3; |
A. | 10 |
B. | 13 |
C. | 25 |
D. | 38 |
Answer» C. 25 | |
13. |
Which is executed quickly? |
A. | ++p |
B. | P++ |
C. | Both |
D. | P+1 |
Answer» D. P+1 | |
14. |
What is the output of this C code? int main() { if (7 & 8) printf("Honesty"); if ((~7 & 0x000f) == 8) printf("is the best policy n"); } |
A. | Honesty is the best policy |
B. | Honesty |
C. | is the best policy |
D. | No output |
Answer» D. No output | |
15. |
Which of the following statement is correct about the code snippet given below? #include < stdio> int main() { float z = 12.35, c = 10; if( ++z -z) c += z; else c - = z; printf( %f %f , z, c); return 0; } |
A. | The program will result in compile time error |
B. | The program will print 12.35 22.35 |
C. | The program will print 13.35 22.35 |
D. | The program will print 1.35 11.35 |
Answer» B. The program will print 12.35 22.35 | |
16. |
What is the output of this C code? int main() { unsigned int a = 10; a = ~a; printf("%d n", a); } |
A. | -9 |
B. | -10 |
C. | -11 |
D. | 10 |
Answer» D. 10 | |
17. |
What is the output of this C code? int main() { int c = 2 ^ 3; printf("%d n", c); } |
A. | 1 |
B. | 8 |
C. | 9 |
Answer» B. 8 | |
18. |
Which of the following is an invalid assignment operator? |
A. | a %= 10; |
B. | a /= 10; |
C. | a |= 10; |
D. | None of the mentioned |
Answer» E. | |
19. |
What is the output of this C code? int main() { int a = 4, n, i, result = 0; scanf("%d", n); for (i = 0;i < n> result += a; } |
A. | Addition of a and n. |
B. | Subtraction of a and n. |
C. | Multiplication of a and n. |
D. | Division of a and n. |
Answer» D. Division of a and n. | |
20. |
What is the output of this C code? int main() { int a = 1, b = 2; a += b -= a; printf("%d %d", a, b); } |
A. | 1 1 |
B. | 1 2 |
C. | 2 1 |
D. | 2 2 |
Answer» D. 2 2 | |
21. |
for c = 2, value of c after c <<= 1; |
A. | c = 1; |
B. | c = 2; |
C. | c = 3; |
D. | c = 4; |
Answer» E. | |
22. |
Operation a = a * b + a can also be written as: |
A. | a *= b + 1; |
B. | (c = a * b)!=(a = c + a); |
C. | a = (b + 1)* a; |
D. | All of the mentioned |
Answer» E. | |
23. |
What is the value of the below assignment expression (x = foo())!= 1 considering foo() returns 2 |
A. | 2 |
B. | true |
C. | 1 |
Answer» B. true | |
24. |
What is the type of the below assignment expression if x is of type float, y is of type int? y = x + y; |
A. | int |
B. | float |
C. | double |
D. | There is no type for an assignment expression |
Answer» B. float | |
25. |
What is the output of this C code? int main() { int x = 2, y = 2; x /= x / y; printf("%d n", x); return 0; } |
A. | 2 |
B. | 1 |
C. | 0.5 |
D. | Undefined behaviour |
Answer» B. 1 | |
26. |
What is the output of this C code? int main() { int x = 1, y = 0; x &&= y; printf("%d n", x); } |
A. | Compile time error |
B. | 1 |
C. | Undefined behaviour |
Answer» B. 1 | |
27. |
What is the output of this C code? int main() { int x = 2, y = 1; x *= x + y; printf("%d n", x); return 0; } |
A. | 5 |
B. | 6 |
C. | Undefined behaviour |
D. | Compile time error |
Answer» E. | |
28. |
What is the output of this C code? void main() { char a = 'a'; int x = (a )++; printf("%d n", x); } |
A. | 6 |
B. | Junk value |
C. | Compile time error |
D. | 7 |
Answer» D. 7 | |
29. |
What is the output of this C code? void main() { int k = 8; int x = 0 == 1 && k++; printf("%d%d n", x, k); } |
A. | 0 9 |
B. | 0 8 |
C. | 1 9 |
D. | 1 8 |
Answer» C. 1 9 | |
30. |
What is the output of this C code void main() { unsigned int x = -5; printf("%d", x); } |
A. | Run time error |
B. | Varies |
C. | -5 |
D. | 5 |
Answer» D. 5 | |
31. |
What is the output of this C code? void main() { 1 < 2> } |
A. | returns 1 |
B. | returns 2 |
C. | varies |
D. | Compile time error |
Answer» E. | |
32. |
What is the output of this C code? void main() { int x = 0; if (x = 0) printf("Its zero n"); else printf("Its not zero n"); } |
A. | Its not zero |
B. | Its zero |
C. | Run time error |
D. | None |
Answer» B. Its zero | |
33. |
What is the output of this C code? int main() { int a = 20; double b = 15.6; int c; c = a + b; printf("%d", c); } |
A. | 35 |
B. | 36 |
C. | 35.6 |
D. | 30 |
Answer» B. 36 | |
34. |
What is the output of this C code? int main() { int a = 20, b = 15, c = 5; int d; d = a == (b + c); printf("%d", d); } |
A. | 1 |
B. | 40 |
C. | 10 |
D. | 5 |
Answer» B. 40 | |
35. |
Which of the following is not a compound assignment operator? |
A. | /= |
B. | += |
C. | %= |
D. | == |
Answer» E. | |
36. |
Which of the following statement is correct about the code snippet given below? num = 5; printf( %d , ++num++ ); |
A. | The code will print 5 |
B. | The code will print 6 |
C. | The code will result in L value required |
D. | The code will result in R value required |
Answer» D. The code will result in R value required | |
37. |
What will be the output of the following code snippet? Y = 5; if (! Y > 10) X = Y + 3; else X = Y + 10; printf( X = %d Y = %d , X, Y); |
A. | The program will print X = 15 Y = 5 |
B. | The program will print X = 15 Y = 0 |
C. | The program will print X = 8 Y = 5 |
D. | The program will print X = 3 Y = 0 |
Answer» B. The program will print X = 15 Y = 0 | |
38. |
Relational operators cannot be used on: |
A. | structure |
B. | long |
C. | strings |
D. | float |
Answer» B. long | |
39. |
What is the output of this C code? void main() { int y = 3; int x = 7 % 4 * 3 / 2; printf("Value of x is %d", x); } |
A. | Value of x is 1 |
B. | Value of x is 2 |
C. | Value of x is 3 |
D. | Compile time error |
Answer» B. Value of x is 2 | |
40. |
What is the output of this C code? int main() { int a = 10; if (a == a--) printf("TRUE 1 t"); a = 10; if (a == --a) printf("TRUE 2 t"); } |
A. | TRUE 1 |
B. | TRUE 2 |
C. | TRUE 1 TRUE 2 |
D. | No output |
Answer» D. No output | |
41. |
Which among the following is NOT a logical or relational operator? |
A. | != |
B. | |
C. | C. |
D. | D. |
Answer» E. | |
42. |
What is the value of the following expression? i = 1; i = ( I< <= 1 % 2) |
A. | 2 |
B. | 1 |
C. | Syntax error |
Answer» B. 1 | |
43. |
Which of the following data type will throw an error on modulus operation(%)? |
A. | char |
B. | short |
C. | float |
D. | int |
Answer» D. int | |
44. |
Which of the following is not an arithmetic operation? |
A. | a *= 20; |
B. | a /= 30; |
C. | a %= 40; |
D. | a != 50; |
Answer» E. | |
45. |
The precedence of arithmetic operators is (from highest to lowest)? |
A. | %, *, /, +, - |
B. | %, +, /, *, - |
C. | +, -, %, *, / |
D. | %, +, -, *, / |
Answer» B. %, +, /, *, - | |
46. |
What is the value of x in this C code? void main() { int x = 4 *5 / 2 + 9; } |
A. | 6.75 |
B. | 1.85 |
C. | 19 |
D. | 3 |
Answer» D. 3 | |
47. |
What is the output of this C code? void main() { int x = 4.3 % 2; printf("Value of x is %d", x); } |
A. | Value of x is 1.3 |
B. | Value of x is 2 |
C. | Value of x is 0.3 |
D. | Compile time error |
Answer» E. | |
48. |
What is the output of this C code? void main() { int a = 5; int b = ++a + a++ + --a; printf("Value of b is %d", b); } |
A. | Value of x is 16 |
B. | Value of x is 21 |
C. | Value of x is 15 |
D. | Undefined behaviour |
Answer» E. | |
49. |
What is the output of this C code? int main() { int i = 5; int l = i / -4; int k = i % -4; printf("%d %d n", l, k); return 0; } |
A. | Compile time error |
B. | -1 1 |
C. | 1 -1 |
D. | Run time error |
Answer» C. 1 -1 | |
50. |
What is the output of this C code? int main() { int i = 7; i = i / 4; printf("%d n", i); return 0; } |
A. | Run time error |
B. | 1 |
C. | 3 |
D. | Compile time error |
Answer» C. 3 | |