MCQOPTIONS
 Saved Bookmarks
				This section includes 278 Mcqs, each offering curated multiple-choice questions to sharpen your C Interview knowledge and support exam preparation. Choose a topic below to get started.
| 201. | 
                                    What will be the output of the following C code? #include int main() { int x = 0; if (x++) printf("true\n"); else if (x == 1) printf("false\n"); } | 
                            
| A. | true | 
| B. | false | 
| C. | compile time error | 
| D. | undefined behaviour | 
| Answer» C. compile time error | |
| 202. | 
                                    What will be the output of the following C code? #include int main() { int x = 1; if (x > 0) printf("inside if\n"); else if (x > 0) printf("inside elseif\n"); } | 
                            
| A. | inside if | 
| B. | inside elseif | 
| C. | inside if inside elseif | 
| D. | compile time error | 
| Answer» B. inside elseif | |
| 203. | 
                                    What will be the output of the following C code? #include int main() { int x = 0; if (x == 1) if (x == 0) printf("inside if\n"); else printf("inside else if\n"); else printf("inside else\n"); } | 
                            
| A. | inside if | 
| B. | inside else if | 
| C. | inside else | 
| D. | compile time error | 
| Answer» D. compile time error | |
| 204. | 
                                    What will be the output of the following C code? (Assuming that we have entered the value 2 in the standard input) #include void main() { int ch; printf("enter a value between 1 to 2:"); scanf("%d", &ch); switch (ch) { case 1: printf("1\n"); break; printf("Hi"); default: printf("2\n"); } } | 
                            
| A. | 1 | 
| B. | Hi 2 | 
| C. | Run time error | 
| D. | 2 | 
| Answer» E. | |
| 205. | 
                                    What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include void main() { int ch; printf("enter a value between 1 to 2:"); scanf("%d", &ch); switch (ch, ch + 1) { case 1: printf("1\n"); break; case 2: printf("2"); break; } } | 
                            
| A. | 1 | 
| B. | 2 | 
| C. | 3 | 
| D. | Run time error | 
| Answer» C. 3 | |
| 206. | 
                                    What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include void main() { int ch; printf("enter a value between 1 to 2:"); scanf("%d", &ch); switch (ch) { case 1: printf("1\n"); default: printf("2\n"); } } | 
                            
| A. | 1 | 
| B. | 2 | 
| C. | 1 2 | 
| D. | Run time error | 
| Answer» D. Run time error | |
| 207. | 
                                    What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include void main() { char *ch; printf("enter a value between 1 to 3:"); scanf("%s", ch); switch (ch) { case "1": printf("1"); break; case "2": printf("2"); break; } } | 
                            
| A. | 1 | 
| B. | 2 | 
| C. | Compile time error | 
| D. | No Compile time error | 
| Answer» D. No Compile time error | |
| 208. | 
                                    What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include void main() { double ch; printf("enter a value between 1 to 2:"); scanf("%lf", &ch); switch(ch) { case 1: printf("1"); break; case 2: printf("2"); break; } } | 
                            
| A. | Compile time error | 
| B. | 1 | 
| C. | 2 | 
| D. | Varies | 
| Answer» B. 1 | |
| 209. | 
                                    What will be the output of the following C code? #include void main() { int x = 5; if (x < 1); printf("Hello"); } | 
                            
| A. | Nothing | 
| B. | Run time error | 
| C. | Hello | 
| D. | Varies | 
| Answer» D. Varies | |
| 210. | 
                                    What will be the output of the following C code? #include void main() { int x = 0; if (x == 0) printf("hi"); else printf("how are u"); printf("hello"); } | 
                            
| A. | hi | 
| B. | how are you | 
| C. | hello | 
| D. | hihello | 
| Answer» E. | |
| 211. | 
                                    What will be the output of the following C code? #include int x; void main() { if (x) printf("hi"); else printf("how are u"); } | 
                            
| A. | hi | 
| B. | how are you | 
| C. | compile time error | 
| D. | none of the mentioned | 
| Answer» C. compile time error | |
| 212. | 
                                    What will be the output of the following C code? #include void main() { int x = 5; if (true); printf("hello"); } | 
                            
| A. | It will display hello | 
| B. | It will throw an error | 
| C. | Nothing will be displayed | 
| D. | Compiler dependent | 
| Answer» C. Nothing will be displayed | |
| 213. | 
                                    What will be the output of the following C code? #include void main() { int x = 5; if (x < 1) printf("hello"); if (x == 5) printf("hi"); else printf("no"); } | 
                            
| A. | hi | 
| B. | hello | 
| C. | no | 
| D. | none of the mentioned | 
| Answer» B. hello | |
| 214. | 
                                    The output of the following code segment will be char x= 'B'; switch(x) { case 'A': printf("a"); case 'B': printf("b"); default: printf("C"); } | 
                            
| A. | B | 
| B. | bc | 
| C. | C | 
| D. | bC | 
| Answer» E. | |
| 215. | 
                                    Consider the following code snippet: marks =80; switch (marks) { case 60: grade = 'C'; break; case 70: grade = 'B'; break; case 80: grade = 'A'; break; default: grade = 'E'; } What is the value of 'grade' after the switch statement is executed? | 
                            
| A. | C | 
| B. | B | 
| C. | A | 
| D. | E | 
| Answer» D. E | |
| 216. | 
                                    Consider the following code fragment: for(digit=0; digit | 
                            
| A. | Infinit | 
| B. | 9 | 
| C. | 4 | 
| D. | 0 | 
| Answer» B. 9 | |
| 217. | 
                                    Study the following 'C' program #include void main() { int a=7, b=5; switch (a/a % b) { case 1 : a= a-b; case 2 : a= a+b; case 3 : a= a*b; case 4 : a= a/b; default : a= a; } } On the execution of above program, what will be the value of variable a? | 
                            
| A. | 7 | 
| B. | 5 | 
| C. | 2 | 
| D. | None of these | 
| Answer» B. 5 | |
| 218. | 
                                    If the following loop is implemented: { int num=0; do { --num; printf("%d", num); num++; }while(num>=0); } | 
                            
| A. | The loop will run infinitely many times | 
| B. | The program will not enter into the loop | 
| C. | There will be a compilation error reported | 
| D. | A runtime error will be reported | 
| Answer» B. The program will not enter into the loop | |
| 219. | 
                                    Study the following 'C' program: #include void main() { static a,b; while(a> b++) } What will be the value of a and b on the execution of above program? | 
                            
| A. | a=0, b=1 | 
| B. | a=0, b=0 | 
| C. | a=1, b=1 | 
| D. | None of these | 
| Answer» B. a=0, b=0 | |
| 220. | 
                                    A labeled statement consists of an identifier followed by a | 
                            
| A. | ; | 
| B. | . | 
| C. | : | 
| D. | None of these | 
| Answer» D. None of these | |
| 221. | 
                                    How many times will the following loop be executed? ch ='b'; while(ch>='a' && ch | 
                            
| A. | 0 | 
| B. | 25 | 
| C. | 26 | 
| D. | 1 | 
| Answer» C. 26 | |
| 222. | 
                                    A switch statement is used to: | 
                            
| A. | Switch between function in a program | 
| B. | Switch from one variable to another variable | 
| C. | To choose from multiple possibilities which may arise due to different values of a single variable | 
| D. | To use switching variable | 
| Answer» D. To use switching variable | |
| 223. | 
                                    The second expression (j-k), in the following expression will be evaluated (i+5) || (j-k) | 
                            
| A. | If the expression (i+5) is true | 
| B. | If the expression (i+5) is false | 
| C. | Irrespective of whether (i+5) is true or false | 
| D. | Will not be evaluated in any case. | 
| Answer» D. Will not be evaluated in any case. | |
| 224. | 
                                    A constant cannot be used except: | 
                            
| A. | For assigning initial value to a variable | 
| B. | With ++ operator | 
| C. | As a formal argument | 
| D. | On LHS of an assignment operator | 
| Answer» B. With ++ operator | |
| 225. | 
                                    Consider the following program fragment: switch(input) { case '1': printf("one"); case '3': printf("three"); case '5': printf("five"); default: printf("odd"); break; } What will be printed when input is '3'? | 
                            
| A. | three five odd | 
| B. | three | 
| C. | three odd | 
| D. | three three odd | 
| Answer» B. three | |
| 226. | 
                                    The expression , i=30*10+27; evaluates to: | 
                            
| A. | 327 | 
| B. | -327 | 
| C. | 810 | 
| D. | 0 | 
| Answer» B. -327 | |
| 227. | 
                                    IF I=6, and J=++I, then the value of J and I will be: | 
                            
| A. | I=6, J=6 | 
| B. | I=6, J=7 | 
| C. | I=7, J=6 | 
| D. | I=7, J=7 | 
| Answer» C. I=7, J=6 | |
| 228. | 
                                    Pick up the odd one out from the following | 
                            
| A. | a=a+1; | 
| B. | a+=1; | 
| C. | a++; | 
| D. | a=+1; | 
| Answer» E. | |
| 229. | 
                                    If Escape sequence: | 
                            
| A. | \n | 
| B. | \' | 
| C. | \a | 
| D. | All of the above | 
| Answer» E. | |
| 230. | 
                                    The maximum value that an integer constant can have is: | 
                            
| A. | -32767 | 
| B. | 32767 | 
| C. | 1.7014e+38 | 
| D. | -1.7014e+38 | 
| Answer» C. 1.7014e+38 | |
| 231. | 
                                    The operator && in 'C' language is a (n): | 
                            
| A. | OR operator | 
| B. | NOT operator | 
| C. | AND operator | 
| D. | None of the above | 
| Answer» D. None of the above | |
| 232. | 
                                    Which library function returns number of seconds elapsed beyond a designated base time? | 
                            
| A. | time() | 
| B. | ctime() | 
| C. | stime() | 
| D. | None of these | 
| Answer» B. ctime() | |
| 233. | 
                                    Which of the following is not a library function: | 
                            
| A. | isprintf() | 
| B. | isdigit() | 
| C. | isspace() | 
| D. | None of these | 
| Answer» E. | |
| 234. | 
                                    Consider the following code fragment: int a,c; c=2; a=(c+ =5)*2 What will be the value of "a" after the above lines are executed? | 
                            
| A. | 10 | 
| B. | 14 | 
| C. | 12 | 
| D. | The second assignment statement is syntactically incorrect | 
| Answer» C. 12 | |
| 235. | 
                                    Consider the following statements: int a=2, b=3, c=4; a=(b++) +c; b=a+(++c); What are the values of a, b and c, respectively? | 
                            
| A. | 8, 12, 5 | 
| B. | 8, 13, 5 | 
| C. | 7, 12, 5 | 
| D. | 7, 11, 5 | 
| Answer» D. 7, 11, 5 | |
| 236. | 
                                    A typecast is used to: | 
                            
| A. | Define a new datatype | 
| B. | Force a value to be of a particular variable type | 
| C. | Rename an old type | 
| D. | None of these | 
| Answer» C. Rename an old type | |
| 237. | 
                                    Which is more appropriate for reading in multi-word string? | 
                            
| A. | gets() | 
| B. | printf() | 
| C. | scanf() | 
| D. | puts() | 
| Answer» B. printf() | |
| 238. | 
                                    Which of the following is true about 'C' operators? | 
                            
| A. | Operators must have one or more operands | 
| B. | Operators are either unary or binary | 
| C. | Operators have some precedence | 
| D. | All of the above | 
| Answer» E. | |
| 239. | 
                                    Operator precedence determines which operator: | 
                            
| A. | Operates on the largest numbers | 
| B. | Is used first | 
| C. | Is most important | 
| D. | None of these | 
| Answer» C. Is most important | |
| 240. | 
                                    Consider the following program segment: main() { int a,b,c; b=3; a=2; a=2*(b++); c=2*(++b); } The correct values are: | 
                            
| A. | a=6, c=8 | 
| B. | a=6, b=3 | 
| C. | b=3, c=6 | 
| D. | a=6, c=10 | 
| Answer» E. | |
| 241. | 
                                    What should be the value of i and k at the end of the following program segments? int i,j,k; { j=5; i=2*j/2; k=2*(j/2); } | 
                            
| A. | i=5, k=5 | 
| B. | i=4, k=4 | 
| C. | i=5, k=4 | 
| D. | i=4, k=5 | 
| Answer» D. i=4, k=5 | |
| 242. | 
                                    What will be the value of count after the following program is executed? main() { int count, digit=0; count=1; while(digit | 
                            
| A. | 10 | 
| B. | 9 | 
| C. | 12 | 
| D. | 11 | 
| Answer» E. | |
| 243. | 
                                    Consider the following program fragment: main() { int a,b,c; b=2; a=2*(b++); c=2*(++b); } Which one of the given answers in correct? | 
                            
| A. | a=4, c=6 | 
| B. | a=3, c=8 | 
| C. | b=3, c=6 | 
| D. | a=4, c=8 | 
| Answer» E. | |
| 244. | 
                                    If the following variables are set to the values as shown below, then what will be the value of the following expression? answer=2; marks=10; !((answer2)) | 
                            
| A. | 1 | 
| B. | 0 | 
| C. | -1 | 
| D. | 2 | 
| Answer» C. -1 | |
| 245. | 
                                    What would be the value of c? { int c; float a,b; a=245.05; b=40.02; c=a+b; } | 
                            
| A. | 285.07 | 
| B. | 285.0 | 
| C. | 2850 | 
| D. | 285 | 
| Answer» E. | |
| 246. | 
                                    In case of ordinary int variables: | 
                            
| A. | The leftmost bit is reserved for sign | 
| B. | The rightmost bit is reserved for sign | 
| C. | No bit is reserved for sign | 
| D. | None of the above | 
| Answer» B. The rightmost bit is reserved for sign | |
| 247. | 
                                    A declaration "short int" is used for variable | 
                            
| A. | Which have short duration in a program | 
| B. | Which have short names | 
| C. | Which may require less storage than normal integers | 
| D. | All of the above | 
| Answer» D. All of the above | |
| 248. | 
                                    The declaration "unsigned u" indicates: | 
                            
| A. | u is an unsigned character | 
| B. | u is an unsigned integer | 
| C. | u is a character | 
| D. | None of the above | 
| Answer» C. u is a character | |
| 249. | 
                                    A program written in mnemonics is called _________ program. | 
                            
| A. | Assembly language. | 
| B. | Machine language | 
| C. | High-level language | 
| D. | None of the above | 
| Answer» B. Machine language | |
| 250. | 
                                    A ___________ symbol is represented by a circle and a letter or digit placed within the circle. | 
                            
| A. | Connector | 
| B. | Terminal | 
| C. | Hardware | 
| D. | Bugs | 
| Answer» B. Terminal | |