MCQOPTIONS
Saved Bookmarks
This section includes 65 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
Macro calls and function calls work exactly similarly. |
| A. | 1 |
| B. | |
| Answer» C. | |
| 52. |
Will the following program print the message infinite number of times? #include #define INFINITELOOP while(1) int main() { INFINITELOOP printf("IndiaBIX"); return 0; } |
| A. | Yes |
| B. | No |
| C. | Yes |
| D. | No |
| Answer» B. No | |
| 53. |
Preprocessor directive #undef can be used only on a macro that has been #define earlier |
| A. | 1 |
| B. | |
| Answer» B. | |
| 54. |
A preprocessor directive is a message from programmer to the preprocessor. |
| A. | 1 |
| B. | |
| Answer» B. | |
| 55. |
Point out the error in the program #include int main() { int i; #if A printf("Enter any number:"); scanf("%d", &i); #elif B printf("The number is odd"); return 0; } |
| A. | Error: unexpected end of file because there is no matching #endif |
| B. | The number is odd |
| C. | Garbage values |
| D. | None of above |
| Answer» B. The number is odd | |
| 56. |
There exists a way to prevent the same file from getting #included twice in the same program. |
| A. | 1 |
| B. | |
| Answer» B. | |
| 57. |
In a macro call the control is passed to the macro. |
| A. | 1 |
| B. | |
| C. | 1 |
| D. | |
| Answer» C. 1 | |
| 58. |
What will be the output of the program? #include #define SQUARE(x) x*x int main() { float s=10, u=30, t=2, a; a = 2*(s-u*t)/SQUARE(t); printf("Result = %f", a); return 0; } |
| A. | Result = -100.000000 |
| B. | Result = -25.000000 |
| C. | Result = 0.000000 |
| D. | Result = 100.000000 |
| Answer» B. Result = -25.000000 | |
| 59. |
In which stage the following code #include gets replaced by the contents of the file stdio.h |
| A. | During editing |
| B. | During linking |
| C. | During execution |
| D. | During preprocessing |
| Answer» E. | |
| 60. |
Point out the error in the program #include #define SI(p, n, r) float si; si=p*n*r/100; int main() { float p=2500, r=3.5; int n=3; SI(p, n, r); SI(1500, 2, 2.5); return 0; } |
| A. | 26250.00 7500.00 |
| B. | Nothing will print |
| C. | Error: Multiple declaration of si |
| D. | Garbage values |
| Answer» D. Garbage values | |
| 61. |
If the file to be included doesn't exist, the preprocessor flashes an error message. |
| A. | 1 |
| B. | |
| C. | 1 |
| D. | |
| Answer» B. | |
| 62. |
What will be the output of the program? #include #define MAN(x, y) ((x)>(y)) ? (x):(y); int main() { int i=10, j=5, k=0; k = MAN(++i, j++); printf("%d, %d, %d\n", i, j, k); return 0; } |
| A. | 12, 6, 12 |
| B. | 11, 5, 11 |
| C. | 11, 5, Garbage |
| D. | 12, 6, Garbage |
| Answer» B. 11, 5, 11 | |
| 63. |
Which of the following are correct preprocessor directives in C? 1: #ifdef 2: #if 3: #elif 4: #undef |
| A. | 1, 2 |
| B. | 4 |
| C. | 1, 2, 4 |
| D. | 1, 2, 3, 4 |
| Answer» E. | |
| 64. |
Will the program compile successfully? #include #define X (4+Y) #define Y (X+3) int main() { printf("%d\n", 4*X+2); return 0; } |
| A. | Yes |
| B. | No |
| C. | Yes |
| D. | No |
| Answer» C. Yes | |
| 65. |
What will the SWAP macro in the following program be expanded to on preprocessing? will the code compile? #include #define SWAP(a, b, c)(c t; t=a, a=b, b=t) int main() { int x=10, y=20; SWAP(x, y, int); printf("%d %d\n", x, y); return 0; } |
| A. | It compiles |
| B. | Compiles with an warning |
| C. | Not compile |
| D. | Compiles and print nothing |
| Answer» D. Compiles and print nothing | |