

MCQOPTIONS
Saved Bookmarks
This section includes 37 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
What will be the output of the following C code if following commands are used to run(considering Newfile exists)?
|
A. | U on the screen |
B. | Undefined behaviour |
C. | Compilation Error |
D. | U in the myfile file |
E. | None of these |
Answer» B. Undefined behaviour | |
2. |
What will be the output of the following C code if following commands are used to run(considering Newfile exists)?
|
A. | U in Newfile and 1 in screen |
B. | U in Newfile and 2 in screen |
C. | U 1 in Newfile |
D. | U 2 in Newfile |
E. | None of these |
Answer» D. U 2 in Newfile | |
3. |
What will be the output of the following C code?
|
A. | Whatever user types |
B. | Compilation Error |
C. | Undefined behavior |
D. | Runtime Error |
E. | None of these |
Answer» B. Compilation Error | |
4. |
What will be the output of the following C code?
|
A. | HelloInterviewMania |
B. | Nothing |
C. | Undefined behaviour |
D. | Hello |
E. | Compilation Error |
Answer» C. Undefined behaviour | |
5. |
What will be the output of the following C code?
|
A. | Undefined behaviour |
B. | Nothing |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» C. Compilation Error | |
6. |
What will be the output of the following C code?
|
A. | Whatever user types |
B. | Compilation Error |
C. | Depends on the standard |
D. | Undefined behavior |
E. | None of these |
Answer» E. None of these | |
7. |
What will be the output of the following C code?
|
A. | Undefined behavior |
B. | Compilation Error |
C. | Runtime Error |
D. | Somegarbage value |
E. | None of these |
Answer» C. Runtime Error | |
8. |
What will be the output of the following C code?
|
A. | Garbage value |
B. | Compilation Error |
C. | Runtime Error |
D. | Whatever user types |
E. | None of these |
Answer» B. Compilation Error | |
9. |
What will be the output of the following C code if 2 character is typed by the user?
|
A. | Undefined behaviour |
B. | 25(ascii value of newline character) |
C. | Compilation Error |
D. | 64 |
E. | None of these |
Answer» E. None of these | |
10. |
What will be the output of the following C code?
|
A. | No.of lines present in file.txt |
B. | Infinite loop |
C. | Compilation error |
D. | Segmentation fault |
E. | None of these |
Answer» E. None of these | |
11. |
What will be the output of the following C function when EOF returns?
|
A. | t character in array line is encountered |
B. | character of array line is encountered |
C. | When an error occurs |
D. | n character in array line is encountered |
E. | None of these |
Answer» D. n character in array line is encountered | |
12. |
What does the following command line signify?
|
A. | It runs both the programs, pipes output of prog2 to input of prog1 |
B. | It runs prog1 first, prog2 second |
C. | It runs prog2 first, prog1 second |
D. | It runs both the programs, pipes output of prog1 to input of prog2 |
E. | None of these |
Answer» E. None of these | |
13. |
What will be the output of the following C code?
|
A. | Int(note:6 spaces after Int) |
B. | Interveiw(note:2 spaces after myworld) |
C. | Interveiw(note:2 spaces before myworld) |
D. | Int |
E. | None of these |
Answer» B. Interveiw(note:2 spaces after myworld) | |
14. |
What will be the output of the following C code?
|
A. | 25 13 Garbage value |
B. | 25 13 |
C. | Undefined behaviour |
D. | 13 25 |
E. | None of these |
Answer» B. 25 13 | |
15. |
What will be the output of the following C code?
|
A. | Compilation Error |
B. | Garbage value |
C. | 31 13 30 |
D. | 13 30 |
E. | 31 13 |
Answer» F. | |
16. |
What will be the output of the following C code?
|
A. | Undefined |
B. | Interview |
C. | Interview (note:followed by two spaces after Interview) |
D. | Interview(note: spaces to the left of Interview) |
E. | None of these |
Answer» E. None of these | |
17. |
What will be the output of the following C code?
|
A. | 15 8 5 |
B. | 15 8 |
C. | Garbage value |
D. | Compilation Error |
E. | None of these |
Answer» B. 15 8 | |
18. |
What will be the output of the following C code?
|
A. | 25 |
B. | Any length since line did not end with null character |
C. | Compilation Error |
D. | Runtime Error |
E. | None of these |
Answer» D. Runtime Error | |
19. |
Identify N library function for line input and output in the following C code?
|
A. | fputs |
B. | fgets |
C. | putc |
D. | getc |
E. | Compilation Error |
Answer» F. | |
20. |
What is the meaning of the following C statement?
|
A. | Print empty spaces if the string state is less than 10 characters |
B. | Print the last 10 characters of the string |
C. | 10 spaces before the string state is printed |
D. | All of above |
E. | None of these |
Answer» B. Print the last 10 characters of the string | |
21. |
What will be the output of the following C code?
|
A. | Whatever user types |
B. | Runtime Error |
C. | Garbage value |
D. | Compilation Error |
E. | None of these |
Answer» D. Compilation Error | |
22. |
What will be the output of the following C code (when 10 and 20 are entered)?
|
A. | 10 Garbage value |
B. | Garbage value 20 |
C. | Compilation Error |
D. | Undefined behaviour |
E. | 10 20 |
Answer» F. | |
23. |
What will be the output of the following C code?
|
A. | Nothing |
B. | Undefined behaviour |
C. | 0 |
D. | Compilation Error |
E. | None of these |
Answer» B. Undefined behaviour | |
24. |
What will be the output of the following C code if following commands are used to run and if Newfile does not exist?
|
A. | Depends on the standard |
B. | Depends on the system |
C. | N 2 in Newfile |
D. | N 1 in Newfile |
E. | None of these |
Answer» E. None of these | |
25. |
What is the meaning of the following C statement? |
A. | Print empty spaces if the string state is less than 10 characters |
B. | Print the last 10 characters of the string |
C. | 10 spaces before the string state is printed |
D. | All of above |
E. | None of these |
Answer» B. Print the last 10 characters of the string | |
26. |
The syntax to print a % using printf statement can be done by ________. |
A. | % |
B. | %% |
C. | % |
D. | % |
E. | None of these |
Answer» C. % | |
27. |
What will be the output of the following C code (when 10 and 20 are entered)? |
A. | 10 Garbage value |
B. | Garbage value 20 |
C. | Compilation Error |
D. | Undefined behaviour |
E. | 10 20 |
Answer» F. | |
28. |
Which of the following doesn t require an & for the input in scanf()? |
A. | float name[15]; |
B. | int name[15]; |
C. | char name[15]; |
D. | All of above |
E. | None of these |
Answer» D. All of above | |
29. |
Identify N library function for line input and output in the following C code? |
A. | fputs |
B. | fgets |
C. | putc |
D. | getc |
E. | Compilation Error |
Answer» F. | |
30. |
What will be the output of the following C function when EOF returns? |
A. | t character in array line is encountered |
B. | character of array line is encountered |
C. | When an error occurs |
D. | n character in array line is encountered |
E. | None of these |
Answer» D. n character in array line is encountered | |
31. |
What is the size of array line used in fgets(line, maxline, *fp) function? |
A. | Size is dynamic |
B. | maxline + 1 |
C. | maxline |
D. | maxline 1 |
E. | None of these |
Answer» D. maxline 1 | |
32. |
What will be the output of the following C code if 2 character is typed by the user? |
A. | Undefined behaviour |
B. | 25(ascii value of newline character) |
C. | Compilation Error |
D. | 64 |
E. | None of these |
Answer» E. None of these | |
33. |
What will be the output of the following C code if following commands are used to run and if Newfile does not exist? |
A. | Depends on the standard |
B. | Depends on the system |
C. | N 2 in Newfile |
D. | N 1 in Newfile |
E. | None of these |
Answer» E. None of these | |
34. |
What will be the output of the following C code if following commands are used to run(considering Newfile exists)? |
A. | U on the screen |
B. | Undefined behaviour |
C. | Compilation Error |
D. | U in the myfile file |
E. | None of these |
Answer» B. Undefined behaviour | |
35. |
putchar(c) function/macro always outputs character c to the __________. |
A. | standard output |
B. | depends on the standard |
C. | screen |
D. | depends on the compiler |
E. | None of these |
Answer» B. depends on the standard | |
36. |
What does the following command line signify? |
A. | It runs both the programs, pipes output of prog2 to input of prog1 |
B. | It runs prog1 first, prog2 second |
C. | It runs prog2 first, prog1 second |
D. | It runs both the programs, pipes output of prog1 to input of prog2 |
E. | None of these |
Answer» E. None of these | |
37. |
For a typical program, the input is taken using _________. |
A. | Files |
B. | Command-line |
C. | scanf |
D. | All of above |
E. | None of these |
Answer» E. None of these | |