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.
| 51. |
What is the output of this C code? int main() { int i = -5; int k = i %4; printf("%d n", k); } |
| A. | Compile time error |
| B. | -1 |
| C. | 1 |
| D. | None |
| Answer» C. 1 | |
| 52. |
For the following statement find the values generated for p and q? int p = 0, q = 1; p = q++; p = ++q; p = q--; p = --q; Value of p & q are |
| A. | 1 1 |
| B. | 0 0 |
| C. | 3 2 |
| D. | 1 2 |
| Answer» B. 0 0 | |
| 53. |
Which of the following statement is correct about the code snippet given below? #include < stdio> int main() { int a = 10, b = 2, c; a = !( c = c == c) && ++b; c += ( a + b- -); printf( %d %d %d , b, c, a); return 0; } |
| A. | The program will print the output 1 3 0 |
| B. | The program will print the output 0 1 3 |
| C. | The program will results in expression syntax error |
| D. | The program will print the output 0 3 1 |
| Answer» B. The program will print the output 0 1 3 | |
| 54. |
Which of the following is the better approach to do the operation i = i * 16? |
| A. | Multiply I by 16 and keep it |
| B. | Shift left by 4 bit |
| C. | Add I 16 times |
| D. | Shift right by 4 bit |
| Answer» C. Add I 16 times | |
| 55. |
What will be the output of the following program? #include < stdio> int main() { int num = 0, z = 3; if ( ! (num <= 0) || ++z ) printf( %d %d , ++num + z++, ++z ); else printf( %d %d , - -num + z- -, - - z); return 0; } |
| A. | 2 1 |
| B. | 6 5 |
| C. | 4 5 |
| D. | 5 5 |
| Answer» C. 4 5 | |
| 56. |
What is the output of the following program? #include < stdio> int main() { int max =123, min = 10, *maxptr = &max, *minptr = &min; int **nptr = &minptr, **mptr = &maxptr; *maxptr = ++*mptr % **nptr; max - = ( *minptr -**nptr && *maxptr || *minptr); printf( %d %d , ++**mptr, *minptr); return 0; } |
| A. | 4 10 |
| B. | 3 11 |
| C. | 3 10 |
| D. | 4 11 |
| Answer» B. 3 11 | |
| 57. |
What will be the output of the following program? #include < stdio> static int y = 1; int main() { static int z; printf( %d %d , y, z); return 0; } |
| A. | Garbage value |
| B. | |
| C. | C. |
| D. | D. |
| Answer» D. D. | |
| 58. |
What value will be stored in z if the following code is executed? main() { int x = 5; y = -10, z; int a = 4, b = 2; z = x+++++y * b/a; } |
| A. | -2 |
| B. | 1 |
| C. | 2 |
| Answer» D. | |
| 59. |
What will be the output of the following program? #include< stdio> void fun() { fun(); Return 0; } void fun() { auto int I = 1; register char a = D ; static int p = 0; printf( %d %d %ld , I, a, p); } |
| A. | 1 D 0 |
| B. | 1 0 0 |
| C. | 0 D 1 |
| D. | |
| Answer» E. | |
| 60. |
Which of the following statement are correct? (i) The maximum value a variable can hold depends upon its storage class. (ii) By default all variables enjoy a static storage class. |
| A. | Only I is correct |
| B. | Only II is correct |
| C. | Both I & II are correct |
| D. | Both I & II are incorrect |
| Answer» E. | |
| 61. |
What is the output of this C code? int main() { int a = 10, b = 5, c = 3; b != !a; c = !!a; printf("%d t%d", b, c); } |
| A. | 5 1 |
| B. | 0 3 |
| C. | 5 3 |
| D. | 1 1 |
| Answer» B. 0 3 | |
| 62. |
Result of a logical or relational expression in C is? |
| A. | True or False |
| B. | 0 or 1 |
| C. | 0 if expression is false and any positive number if expression is true |
| D. | None of the mentioned |
| Answer» C. 0 if expression is false and any positive number if expression is true | |
| 63. |
What will be the value of d in the following program? int main() { int a = 10, b = 5, c = 5; int d; d = b + c == a; printf("%d", d); } |
| A. | Syntax error |
| B. | 1 |
| C. | 5 |
| D. | 10 |
| Answer» C. 5 | |
| 64. |
Does logical operators in C language are evaluated with short circuit? |
| A. | True |
| B. | False |
| C. | Depends on the compiler |
| D. | depends on the standard |
| Answer» B. False | |
| 65. |
What is the output of this C code? int main() { int x = -2; x = x >> 1; printf("%d n", x); } |
| A. | 1 |
| B. | -1 |
| C. | 2 ^ 31 1 considering int to be 4 bytes |
| D. | Either (b) or (c) |
| Answer» C. 2 ^ 31 1 considering int to be 4 bytes | |
| 66. |
What is the output of this C code? int main() { if (~0 == 1) printf("yes n"); else printf("no n"); } |
| A. | Yes |
| B. | No |
| C. | Compile time error |
| D. | Undefined |
| Answer» C. Compile time error | |
| 67. |
What is the output of this C code? int main() { int x = 2; x = x << 1> printf("%d n", x); } |
| A. | 4 |
| B. | 1 |
| C. | Depends on the compiler |
| D. | Depends on the endianness of the machine |
| Answer» B. 1 | |
| 68. |
What is the output of this C code? void main() { int x = 4; int *p = &x; int *k = p++; int r = p - k; printf("%d", r); } |
| A. | 4 |
| B. | 8 |
| C. | 1 |
| D. | Run time error |
| Answer» D. Run time error | |
| 69. |
What is the output of this C code? void main() { int x = 4, y, z; y = --x; z = x--; printf("%d%d%d", x, y, z); } |
| A. | 3 2 3 |
| B. | 2 2 3 |
| C. | 3 2 2 |
| D. | 2 3 3 |
| Answer» E. | |
| 70. |
What is the output of this C code? void main() { int a = 5, b = -7, c = 0, d; d = ++a && ++b || ++c; printf(" n%d%d%d%d", a, b, c, d); } |
| A. | 6 -6 0 0 |
| B. | 6 -5 0 1 |
| C. | -6 -6 0 1 |
| D. | 6 -6 0 1 |
| Answer» E. | |
| 71. |
What is the output of this C code? int main() { int a = 2; if (a >> 1) printf("%d n", a); } |
| A. | 1 |
| B. | 2 |
| C. | No output |
| Answer» D. | |
| 72. |
Comment on the output of this C code? int main() { int i, n, a = 4; scanf("%d", &n); for (i = 0; i < n> a = a * 2; } |
| A. | Logical Shift left |
| B. | No output |
| C. | Arithmetic Shift right |
| D. | bitwise exclusive OR |
| Answer» C. Arithmetic Shift right | |
| 73. |
What is the output of this C code? int main() { int a = 10, b = 10; if (a = 5) b--; printf("%d, %d", a, b--); } |
| A. | a = 10, b = 9 |
| B. | a = 10, b = 8 |
| C. | a = 5, b = 9 |
| D. | a = 5, b = 8 |
| Answer» D. a = 5, b = 8 | |
| 74. |
For which of the following, PI++; code will fail? |
| A. | #define PI 3.14 |
| B. | char *PI = A ; |
| C. | float PI = 3.14; |
| D. | Both (A) and (B) |
| Answer» B. char *PI = A ; | |
| 75. |
What is the output of this C code? int main() { int i = 0; int j = i++ + i; printf("%d n", j); } |
| A. | 1 |
| B. | 2 |
| C. | Compile time error |
| Answer» A. 1 | |
| 76. |
What is the output of this C code? int main() { int i = 2; int j = ++i + i; printf("%d n", j); } |
| A. | 6 |
| B. | 5 |
| C. | 4 |
| D. | Compile time error |
| Answer» B. 5 | |
| 77. |
What is the output of this C code? int main() { int a = 1, b = 1, d = 1; printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++); } |
| A. | 15, 4, 5 |
| B. | 9, 6, 9 |
| C. | 9, 3, 5 |
| D. | 6, 4, 6 |
| Answer» B. 9, 6, 9 | |
| 78. |
What is the output of this C code? int main() { int a = 1, b = 1, c; c = a++ + b; printf("%d, %d", a, b); } |
| A. | a = 1, b = 1 |
| B. | a = 2, b = 1 |
| C. | a = 1, b = 2 |
| D. | a = 2, b = 2 |
| Answer» C. a = 1, b = 2 | |
| 79. |
What is the difference between the following 2 codes? //Program 1 int main() { int d, a = 1, b = 2; d = a++ + ++b; printf("%d %d %d", d, a, b); } //Program 2 int main() { int d, a = 1, b = 2; d = a++ + ++b; printf("%d %d %d", d, a, b); } |
| A. | No difference as space doesn t make any difference, values of a, b, d are same in both the case |
| B. | No difference as space doesn t make any difference, values of a, b, d are different |
| C. | Program 1 has syntax error, program 2 is not |
| D. | Program 2 has syntax error, program 1 is not |
| Answer» B. No difference as space doesn t make any difference, values of a, b, d are different | |
| 80. |
What is the output of this C code? int main() { int y = 1; if (y & (y = 2)) printf("true %d n"); else printf("false %d n"); } |
| A. | true 2 |
| B. | false 2 |
| C. | Either option a or option b |
| D. | true 1 |
| Answer» D. true 1 | |
| 81. |
What is the output of this C code? void main() { int x = 1, y = 0, z = 5; int a = x && y && z++; printf("%d", z); } |
| A. | 6 |
| B. | 5 |
| C. | Varies |
| Answer» C. Varies | |
| 82. |
What is the output of this C code? int main() { int x = -2; if (!0 == 1) printf("yes n"); else printf("no n"); } |
| A. | Yes |
| B. | No |
| C. | Run time error |
| D. | Undefined |
| Answer» B. No | |
| 83. |
What is the output of this C code? int main() { int y = 0; if (1 |(y = 1)) printf("y is %d n", y); else printf("%d n", y); } |
| A. | 1 |
| B. | Run time error |
| C. | Undefined |
| Answer» B. Run time error | |
| 84. |
What is the output of this C code? void main() { int x = 1, y = 0, z = 5; int a = x && y || z++; printf("%d", z); } |
| A. | 6 |
| B. | 5 |
| C. | Varies |
| Answer» B. 5 | |
| 85. |
What is the output of this C code? void main() { int a = 5, b = -7, c = 0, d; d = ++a && ++b || ++c; printf(" n%d%d%d%d", a, b, c, d); } |
| A. | 6 -6 0 0 |
| B. | 6 -5 0 1 |
| C. | |
| D. | D. |
| Answer» E. | |
| 86. |
What is the output of this C code? void main() { int x = 4; int *p = &x; int *k = p++; int r = p - k; printf("%d", r); } |
| A. | 4 |
| B. | 8 |
| C. | 1 |
| D. | Run time error |
| Answer» D. Run time error | |
| 87. |
What is the output of this C code? void main() { int a = -5; int k = (a++, ++a); printf("%d n", k); } |
| A. | -4 |
| B. | -5 |
| C. | 4 |
| D. | -3 |
| Answer» E. | |
| 88. |
What is the output of this C code? void main() { int x = 4, y, z; y = --x; z = x--; printf("%d%d%d", x, y, z); } |
| A. | 3 2 3 |
| B. | 2 3 3 |
| C. | 3 2 2 |
| D. | 2 3 4 |
| Answer» C. 3 2 2 | |
| 89. |
What is the output of this C code? int main() { int i = 10; int *p = &i; printf("%d n", *p++); } |
| A. | 10 |
| B. | 11 |
| C. | Garbage value |
| D. | Address of i |
| Answer» B. 11 | |
| 90. |
What is the output of this C code? void main() { int x = 97; int y = sizeof(x++); printf("X is %d", x); } |
| A. | X is 97 |
| B. | X is 98 |
| C. | X is 99 |
| D. | Run time error |
| Answer» B. X is 98 | |
| 91. |
Comment on the output of this C code? int main() { int i = 2; int i = i++ + i; printf("%d n", i); } |
| A. | = operator is not a sequence point |
| B. | ++ operator may return value with or without side effects |
| C. | it can be evaluated as (i++)+i or i+(++i) |
| D. | Both a and b |
| Answer» B. ++ operator may return value with or without side effects | |
| 92. |
What is the output of this C code? int main() { int i = 0; int x = i++, y = ++i; printf("%d % d n", x, y); return 0; } |
| A. | 0, 2 |
| B. | 0, 1 |
| C. | 1, 2 |
| D. | Undefined |
| Answer» B. 0, 1 | |
| 93. |
What is the output of this C code? int main() { int i = 1; if (i++ && (i == 1)) printf("Yes n"); else printf("No n"); } |
| A. | Yes |
| B. | No |
| C. | Depends on the compiler |
| D. | Depends on the standard |
| Answer» C. Depends on the compiler | |
| 94. |
Are logical operators sequence points? |
| A. | True |
| B. | False |
| C. | Depends on the compiler |
| D. | Depends on the standard |
| Answer» B. False | |
| 95. |
What is the final value of j in the below code? int main() { int i = 0, j = 0; if (i && (j = i + 10)) //do something ; } |
| A. | 10 |
| B. | Depends on the compiler |
| C. | Depends on language standard |
| Answer» A. 10 | |
| 96. |
What is the output of this C code? int main() { int x = 1, y = 0, z = 3; x > y ? printf("%d", z) : return z; } |
| A. | 3 |
| B. | 1 |
| C. | Compile time error |
| D. | Run time error |
| Answer» D. Run time error | |
| 97. |
What is the output of this C code? void main() { int x = 1, z = 3; int y = x << 3> printf(" %d n", y); } |
| A. | -2147483648 |
| B. | -1 |
| C. | Run time error |
| D. | 8 |
| Answer» E. | |
| 98. |
What is the output of this C code? void main() { int x = 0, y = 2, z = 3; int a = x & y | z; printf("%d", a); } |
| A. | 3 |
| B. | 2 |
| C. | Run time error |
| Answer» B. 2 | |
| 99. |
What is the output of the following program? #include< stdio> int main() { static int a = 3; printf( %d , a --); return 0; } |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| Answer» D. | |
| 100. |
Which of the following statement are correct? (i) The value stored in the CPU register can always be accessed faster than that stored in memory. (ii) A register storage class variable will always be stored in a CPU register. |
| A. | Only I is correct |
| B. | Only II is correct |
| C. | Both I & II are correct |
| D. | Both I & II are incorrect |
| Answer» B. Only II is correct | |