MCQOPTIONS
Saved Bookmarks
This section includes 564 Mcqs, each offering curated multiple-choice questions to sharpen your Engineering knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
What is stderr ? |
| A. | standard error |
| B. | standard error types |
| C. | standard error streams |
| D. | standard error definitions |
| Answer» D. standard error definitions | |
| 52. |
What do the 'c' and 'v' in argv stands for? |
| A. | 'c' means argument control 'v' means argument vector |
| B. | 'c' means argument count 'v' means argument vertex |
| C. | 'c' means argument count 'v' means argument vector |
| D. | 'c' means argument configuration 'v' means argument visibility |
| Answer» D. 'c' means argument configuration 'v' means argument visibility | |
| 53. |
How many times "IndiaBIX" is get printed? #include<stdio.h> int main() { int x; for(x=-1; x<=10; x++) { if(x < 5) continue; else break; printf("IndiaBIX"); } return 0; } |
| A. | Infinite times |
| B. | 11 times |
| C. | 0 times |
| D. | 10 times |
| Answer» D. 10 times | |
| 54. |
Which statement will you add in the following program to work it correctly? #include<stdio.h> int main() { printf("%f n", log(36.0)); return 0; } |
| A. | #include<conio.h> |
| B. | #include<math.h> |
| C. | #include<stdlib.h> |
| D. | #include<dos.h> |
| Answer» C. #include<stdlib.h> | |
| 55. |
How many times the while loop will get executed if a short int is 2 byte wide? #include<stdio.h> int main() { int j=1; while(j <= 255) { printf("%c %d n", j, j); j++; } return 0; } |
| A. | Infinite times |
| B. | 255 times |
| C. | 256 times |
| D. | 254 times |
| Answer» C. 256 times | |
| 56. |
The keyword used to transfer control from a function back to the calling function is |
| A. | switch |
| B. | goto |
| C. | go back |
| D. | return |
| Answer» E. | |
| 57. |
What is the output of the program #include<stdio.h> int main() { int x = 10, y = 20, z = 5, i; i = x < y < z; printf("%d n", i); return 0; } |
| A. | 0 |
| B. | 1 |
| C. | Error |
| D. | None of these |
| Answer» C. Error | |
| 58. |
Size of short integer and long integer would vary from one platform to another. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 59. |
What will be the output of the program? #include<stdio.h> int X=40; int main() { int X=20; printf("%d n", X); return 0; } |
| A. | 20 |
| B. | 40 |
| C. | Error |
| D. | No Output |
| Answer» B. 40 | |
| 60. |
Range of float id -2.25e+308 to 2.25e+308 |
| A. | True |
| B. | False |
| Answer» C. | |
| 61. |
What is the output of the program #include<stdio.h> int main() { extern int fun(float); int a; a = fun(3.14); printf("%d n", a); return 0; } int fun(int aa) { return (int)++aa; } |
| A. | 3 |
| B. | 3.14 |
| C. | 0 |
| D. | 4 |
| E. | Compile Error |
| Answer» F. | |
| 62. |
What is the output of the program #include<stdio.h> int main() { int a[5] = {2, 3}; printf("%d, %d, %d n", a[2], a[3], a[4]); return 0; } |
| A. | Garbage Values |
| B. | 2, 3, 3 |
| C. | 3, 2, 2 |
| D. | 0, 0, 0 |
| Answer» E. | |
| 63. |
What is the output of the program? #include<stdio.h> int main() { union a { int i; char ch[2]; }; union a u; u.ch[0] = 3; u.ch[1] = 2; printf("%d, %d, %d n", u.ch[0], u.ch[1], u.i); return 0; } |
| A. | 3, 2, 515 |
| B. | 515, 2, 3 |
| C. | 3, 2, 5 |
| D. | None of these |
| Answer» B. 515, 2, 3 | |
| 64. |
What will be the output of the program? #include<stdio.h> int main() { int X=40; { int X=20; printf("%d ", X); } printf("%d n", X); return 0; } |
| A. | 40 40 |
| B. | 20 40 |
| C. | 20 |
| D. | Error |
| Answer» C. 20 | |
| 65. |
1 : typedef long a;extern int a c; 2 : typedef long a;extern a int c; 3 : typedef long a;extern a c; |
| A. | 1 correct |
| B. | 2 correct |
| C. | 3 correct |
| D. | 1, 2, 3 are correct |
| Answer» D. 1, 2, 3 are correct | |
| 66. |
Size of short integer and long integer can be verified using the sizeof() operator. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 67. |
If the definition of the external variable occurs in the source file before its use in a particular function, then there is no need for an extern declaration in the function. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 68. |
A long double can be used if range of a double is not enough to accommodate a real number. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 69. |
A float is 4 bytes wide, whereas a double is 8 bytes wide. |
| A. | True |
| B. | False |
| Answer» B. False | |
| 70. |
Range of double is -1.7e-38 to 1.7e+38 (in 16 bit platform - Turbo C under DOS) |
| A. | True |
| B. | False |
| Answer» C. | |
| 71. |
What is the output of the program given below ? #include<stdio.h> int main() { enum status { pass, fail, atkt}; enum status stud1, stud2, stud3; stud1 = pass; stud2 = atkt; stud3 = fail; printf("%d, %d, %d n", stud1, stud2, stud3); return 0; } |
| A. | 0, 1, 2 |
| B. | 1, 2, 3 |
| C. | 0, 2, 1 |
| D. | 1, 3, 2 |
| Answer» D. 1, 3, 2 | |
| 72. |
What will be the output of the program in 16 bit platform (Turbo C under DOS)? #include<stdio.h> int main() { extern int i; i = 20; printf("%d n", sizeof(i)); return 0; } |
| A. | 2 |
| B. | 4 |
| C. | vary from compiler |
| D. | Linker Error : Undefined symbol |
| E. | <i class="C-code">'i'</i> |
| Answer» E. <i class="C-code">'i'</i> | |
| 73. |
What is the output of the program? #include<stdio.h> int main() { extern int a; printf("%d n", a); return 0; } int a=20; |
| A. | 20 |
| B. | 0 |
| C. | Garbage Value |
| D. | Error |
| Answer» B. 0 | |
| 74. |
What is the output of the program in Turbo C (in DOS 16-bit OS)? #include<stdio.h> int main() { char *s1; char far *s2; char huge *s3; printf("%d, %d, %d n", sizeof(s1), sizeof(s2), sizeof(s3)); return 0; } |
| A. | 2, 4, 6 |
| B. | 4, 4, 2 |
| C. | 2, 4, 4 |
| D. | 2, 2, 2 |
| Answer» D. 2, 2, 2 | |
| 75. |
What is the output of the program #include<stdio.h> int main() { struct emp { char name[20]; int age; float sal; }; struct emp e = {"Tiger"}; printf("%d, %f n", e.age, e.sal); return 0; } |
| A. | 0, 0.000000 |
| B. | Garbage values |
| C. | Error |
| D. | None of above |
| Answer» B. Garbage values | |
| 76. |
Is there any difference in the following declarations? int myfun(int arr[]);int myfun(arr[20]); |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 77. |
Suppose a program is divided into three files f1, f2 and f3, and a variable is defined in the file f1 but used in files f2 and f3. In such a case would we need the extern declaration for the variables in the files f2 and f3? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 78. |
Global variable are available to all functions. Does there exist a mechanism by way of which it available to some and not to others. |
| A. | Yes |
| B. | No |
| Answer» C. | |
| 79. |
Is it true that a global variable may have several declarations, but only one definition? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 80. |
Is it true that a function may have several declarations, but only one definition? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 81. |
Which of the following operations are INCORRECT? |
| A. | <pre><code class="cpp">int i = 35; i = i%5;</code></pre> |
| B. | <pre><code class="cpp">short int j = 255; j = j;</code></pre> |
| C. | <pre><code class="cpp">long int k = 365L; k = k;</code></pre> |
| D. | <pre><code class="cpp">float a = 3.14; a = a%3;</code></pre> |
| Answer» E. | |
| 82. |
Which of the following correctly represents a long double constant? |
| A. | 6.68 |
| B. | 6.68L |
| C. | 6.68f |
| D. | 6.68LF |
| Answer» C. 6.68f | |
| 83. |
Which of the structure is correct? 1 : struct book { char name[10]; float price; int pages; }; 2 : struct aa { char name[10]; float price; int pages; } 3 : struct aa { char name[10]; float price; int pages; } |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | All of above |
| Answer» B. 2 | |
| 84. |
Which of the declaration is correct? |
| A. | int length; |
| B. | char int; |
| C. | int long; |
| D. | float double; |
| Answer» B. char int; | |
| 85. |
What will be the output of the program? #include<stdio.h> int main() { const int i=0; printf("%d n", i++); return 0; } |
| A. | 10 |
| B. | 11 |
| C. | No output |
| D. | Error: ++needs a value |
| Answer» E. | |
| 86. |
Which standard library function will you use to find the last occurance of a character in a string in C? |
| A. | strnchar() |
| B. | strchar() |
| C. | strrchar() |
| D. | strrchr() |
| Answer» E. | |
| 87. |
How many times the program will print "IndiaBIX" ? #include<stdio.h> int main() { printf("IndiaBIX"); main(); return 0; } |
| A. | Infinite times |
| B. | 32767 times |
| C. | 65535 times |
| D. | Till stack overflows |
| Answer» E. | |
| 88. |
How will you free the allocated memory ? |
| A. | remove(var-name); |
| B. | free(var-name); |
| C. | delete(var-name); |
| D. | dalloc(var-name); |
| Answer» C. delete(var-name); | |
| 89. |
What will be the output of the program? #include<stdio.h> #include<stdarg.h> void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple", "Boys", "Cats", "Dogs"); fun2(2, 12, 13, 14); return 0; } void fun1(int num, ...) { char *str; va_list ptr; va_start(ptr, num); str = va_arg(ptr, char *); printf("%s ", str); } void fun2(int num, ...) { va_list ptr; va_start(ptr, num); num = va_arg(ptr, int); printf("%d", num); } |
| A. | Dogs 12 |
| B. | Cats 14 |
| C. | Boys 13 |
| D. | Apple 12 |
| Answer» E. | |
| 90. |
What will you do to treat the constant 3.14 as a long double? |
| A. | use 3.14LD |
| B. | use 3.14L |
| C. | use 3.14DL |
| D. | use 3.14LF |
| Answer» C. use 3.14DL | |
| 91. |
Which of the structure is incorrcet? 1 : struct aa { int a; float b; }; 2 : struct aa { int a; float b; struct aa var; }; 3 : struct aa { int a; float b; struct aa *var; }; |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | 1, 2, 3 |
| Answer» C. 3 | |
| 92. |
Does there any function exist to convert the int or float to a string? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 93. |
According to ANSI specifications which is the correct way of declaring main when it receives command-line arguments? |
| A. | <pre><code class="cpp">int main(int argc, char *argv[])</code></pre> |
| B. | <pre><code class="cpp">int main(argc, argv) int argc; char *argv; </code></pre> |
| C. | <pre><code class="cpp">int main() { int argc; char *argv; } </code></pre> |
| D. | None of above |
| Answer» B. <pre><code class="cpp">int main(argc, argv) int argc; char *argv; </code></pre> | |
| 94. |
Which files will get closed through the fclose() in the following program? #include<stdio.h> int main() { FILE *fs, *ft, *fp; fp = fopen("A.C", "r"); fs = fopen("B.C", "r"); ft = fopen("C.C", "r"); fclose(fp, fs, ft); return 0; } |
| A. | "A.C" "B.C" "C.C" |
| B. | "B.C" "C.C" |
| C. | "A.C" |
| D. | Error in |
| E. | <i class="C-code">fclose()</i> |
| Answer» E. <i class="C-code">fclose()</i> | |
| 95. |
In a file contains the line "I am a boy r n" then on reading this line into the array str using fgets(). What will str contain? |
| A. | "I am a boy r n 0" |
| B. | "I am a boy r 0" |
| C. | "I am a boy n 0" |
| D. | "I am a boy" |
| Answer» D. "I am a boy" | |
| 96. |
Which header file should you include, if you are going to develop a function, which can accept variable number of arguments? |
| A. | varagrg.h |
| B. | stdlib.h |
| C. | stdio.h |
| D. | stdarg.h |
| Answer» E. | |
| 97. |
The library function used to find the last occurrence of a character in a string is |
| A. | strnstr() |
| B. | laststr() |
| C. | strrchr() |
| D. | strstr() |
| Answer» D. strstr() | |
| 98. |
In the following code snippet can we declare a new typedef named ptr even though struct employee has not been completely declared while using typedef? typedef struct employee *ptr; struct employee { char name[20]; int age; ptr next; } |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 99. |
What will be the output of the program? #include<stdio.h> int main() { enum color{red, green, blue}; typedef enum color mycolor; mycolor m = red; printf("%d", m); return 0; } |
| A. | 1 |
| B. | 0 |
| C. | 2 |
| D. | red |
| Answer» C. 2 | |
| 100. |
What will be the output of the program? #include<stdio.h> int main() { char huge *near *ptr1; char huge *far *ptr2; char huge *huge *ptr3; printf("%d, %d, %d n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; } |
| A. | 4, 4, 8 |
| B. | 2, 4, 4 |
| C. | 4, 4, 2 |
| D. | 2, 4, 8 |
| Answer» C. 4, 4, 2 | |