

MCQOPTIONS
Saved Bookmarks
This section includes 191 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. |
Guess the output of the following example - |
A. | 10, 11, 21 |
B. | 11, 11, 22 |
C. | 11, 11, 21 |
D. | 11, 10, 21 |
Answer» D. 11, 10, 21 | |
2. |
Guess the output of the following code snippet - |
A. | 11 10 |
B. | 11 11 |
C. | 10 11 |
D. | 10 10 |
Answer» C. 10 11 | |
3. |
Guess the output of the following program - |
A. | 3, 4 |
B. | 4, 4 |
C. | 3, 3 |
D. | 4, 3 |
Answer» E. | |
4. |
Guess the output of the following expression. |
A. | -29, 21, 0, 0 |
B. | -29, 21, 1, 1 |
C. | -30, 21, 0, 1 |
D. | -30, 21, 1, 1 |
Answer» B. -29, 21, 1, 1 | |
5. |
Which of the following is the correct order if calling functions in the below code? |
A. | f1, f2, f3 |
B. | f3, f2, f1 |
C. | Order may vary from compiler to compiler |
D. | None of above |
Answer» D. None of above | |
6. |
How many times "compscibits.com" gets printed ? |
A. | 1 times |
B. | 15 times |
C. | 0 times |
D. | 16 times |
Answer» B. 15 times | |
7. |
In the following expression guess the correct order of execution of operator ? |
A. | / * % - + = |
B. | * / % - + = |
Answer» B. * / % - + = | |
8. |
How many times printf will be executed ? |
A. | 0 times |
B. | 16 times |
C. | 5 times |
D. | 15 times |
Answer» B. 16 times | |
9. |
Consider the following program fragment, and choose the correct one |
A. | a = 4, c = 8 |
B. | a = 3, c = 8 |
C. | b = 3, c = 6 |
D. | a = 4, c = 6 |
Answer» B. a = 3, c = 8 | |
10. |
What number will z in the sample code given below? |
A. | 5 |
B. | 6 |
C. | 9 |
D. | 10 |
Answer» E. | |
11. |
What will be the output of the following code fragment? |
A. | fff0 |
B. | fff1 |
C. | fff2 |
D. | fff3 |
Answer» B. fff1 | |
12. |
What is the output of the following statements? |
A. | 13 |
B. | 14 |
C. | 15 |
D. | 12 |
Answer» C. 15 | |
13. |
What will be the output of this program on an implementation where int occupies 2 bytes? |
A. | i=4 j=2 |
B. | i=3 j=2 |
C. | i=5 j=2 |
D. | the behavior is undefined |
Answer» C. i=5 j=2 | |
14. |
Assuming, integer is 2 byte, What will be the output of the program? |
A. | ffff |
B. | 0 |
C. | fff8 |
D. | Error |
Answer» D. Error | |
15. |
Identify the correct output of the following code: |
A. | 10 5 4 4 |
B. | 10 5 3 3 |
C. | 10 5 4 3 |
D. | 10 5 3 4 |
Answer» C. 10 5 4 3 | |
16. |
Predict the output of the following code ? |
A. | 12, 11 |
B. | 12, 10 |
C. | Output may Vary from Compiler to Compiler |
D. | 12, 12 |
Answer» D. 12, 12 | |
17. |
Guess the output. |
A. | 300 |
B. | 200 |
C. | 100 |
D. | 500 |
Answer» D. 500 | |
18. |
what will be the output when following code is executed? |
A. | 12 10 11 13 |
B. | 22 12 12 13 |
C. | 22 11 11 11 |
D. | 22 13 13 13 |
Answer» E. | |
19. |
Choose the correct output for the following program. |
A. | 50, 13, 11, 13 |
B. | 50, 13, 24, 50 |
C. | 13, 10, 24, 50 |
D. | 50, 13, 24, 13 |
Answer» C. 13, 10, 24, 50 | |
20. |
Determine output of the following program code. |
A. | 3 7 |
B. | 7 3 |
C. | 8 3 |
D. | 3 8 |
Answer» E. | |
21. |
What should be the output of the following program: |
A. | 7, 4 |
B. | 7, 2 |
C. | 5, 2 |
D. | Syntax error |
Answer» E. | |
22. |
Assunming, integer is 2 byte, What will be the output of the program? |
A. | ffff |
B. | 0fff |
C. | 0000 |
D. | fff0 |
Answer» B. 0fff | |
23. |
Assuming a integer 2-bytes, What will be the output of the program? |
A. | ffff |
B. | fff8 |
C. | 0 |
D. | -1 |
Answer» C. 0 | |
24. |
If an unsigned int is 2 bytes wide then, What will be the output of the program ? |
A. | ffff |
B. | 0000 |
C. | ffdf |
D. | ddfd |
Answer» D. ddfd | |
25. |
Point out the error if any in the following program (Turbo C). |
A. | Error: unknown variable ptr |
B. | Error: Lvalue required for parameter |
C. | No error and print A a b c |
D. | No error and print 4 A a b c |
Answer» D. No error and print 4 A a b c | |
26. |
The code snippet below produces |
A. | returns 1 |
B. | returns 2 |
C. | Varies |
D. | Compile time error |
Answer» E. | |
27. |
What is the output of the code given below |
A. | true |
B. | false |
C. | compile time error |
D. | undefined behaviour |
Answer» B. false | |
28. |
What will be the output of the program (in Turbo C under DOS)? |
A. | 4, 4, 8 |
B. | 2, 4, 4 |
C. | 4, 4, 2 |
D. | 2, 4, 8 |
Answer» D. 2, 4, 8 | |
29. |
What will be the output of the program under DOS? |
A. | 4, 4, 4 |
B. | 4, 2, 2 |
C. | 2, 8, 4 |
D. | 2, 4, 8 |
Answer» C. 2, 8, 4 | |
30. |
What will be the output of the program in DOS (Compiler - Turbo C)? |
A. | 1 |
B. | 2 |
C. | 4 |
D. | 8 |
Answer» C. 4 | |
31. |
Point out the error in the following program. |
A. | Error: Lvalue required |
B. | Error: Rvalue required |
C. | Error: invalid *p declaration |
D. | No error |
Answer» E. | |
32. |
Point out the error in the following program (in Turbo C under DOS). |
A. | Error: Lvalue required |
B. | Error: Rvalue required |
C. | Error: cannot initialize more than one union member. |
D. | No error |
Answer» D. No error | |
33. |
What is the value of i and j in the below code? |
A. | i value is 1 and j value is 1 |
B. | i value is 0 and j value is 0 |
C. | i value is 1 and j value is undefined |
D. | i and j value are undefined |
Answer» E. | |
34. |
C programming language by itself provides |
A. | input facility |
B. | output facility |
C. | both input and output facilities |
D. | no input and output facilities |
Answer» E. | |
35. |
In C programming language, which of the following operators has the highest precedence? |
A. | Unary + |
B. | * |
C. | >= |
Answer» B. * | |
36. |
The expression 5 -2 - 3 * 5 - 2 will evaluate to 18, if |
A. | - is left associative and * has precedence over - |
B. | - is rightt associative and * has precedence over - |
C. | - is right associative and - has precedence over * |
D. | - is left associative and - has precedence over * |
Answer» D. - is left associative and - has precedence over * | |
37. |
In a C program constant is defined |
A. | before main |
B. | after main |
C. | anywhere, but starting on a new line |
D. | none of the above |
Answer» D. none of the above | |
38. |
Which of the following are true regardless of the implementation ? |
A. | sizeof(int) is not less than sizeof(long) |
B. | sizeof(double) is not less than sizeof(float) |
C. | sizeof (int )equals sizeof(unsigned) |
D. | both (b) & (c) |
Answer» E. | |
39. |
A declaration "short int" is used for variables |
A. | which have a short duration in a program |
B. | which have short names |
C. | which may require less storage than normal integers |
D. | all of these |
Answer» D. all of these | |
40. |
The expression a << 6 shifts all bits of a six places to the left. If a Ox6db7, then what is the value of a << 6 |
A. | 0xa72b |
B. | 0xa2b |
C. | 0x6dc0 |
D. | 0x1111 |
Answer» D. 0x1111 | |
41. |
What do the following declaration signify?int *f(); |
A. | f is a pointer variable of function type. |
B. | f is a function returning pointer to an int. |
C. | f is a function pointer. |
D. | f is a simple declaration of pointer variable. |
Answer» C. f is a function pointer. | |
42. |
What do the following declaration signify?void (*cmp)(); |
A. | cmp is a pointer to an void function type. |
B. | cmp is a void type pointer function. |
C. | cmp is a function that return a void pointer. |
D. | cmp is a pointer to a function which returns void . |
Answer» E. | |
43. |
What do the following declaration signify?int (*pf)(); |
A. | pf is a pointer to function. |
B. | pf is a function pointer. |
C. | pf is a pointer to a function which return int |
D. | pf is a function of pointer variable. |
Answer» D. pf is a function of pointer variable. | |
44. |
An external variable |
A. | is globally accessible by all functions |
B. | has a declaration |
C. | will be initialized to 0 if not initialized |
D. | all of these |
Answer» E. | |
45. |
When a variable of data type double is converted into float, then |
A. | Rounding takes place |
B. | Truncation takes place |
C. | The lower order bits are dropped |
D. | None of these |
Answer» B. Truncation takes place | |
46. |
To print out a and b given below, which printf() statement would you use? float a = 3.14; double b = 3.14; |
A. | printf("%f%f",a,b); |
B. | printf("%Lf%f",a,b); |
C. | printf("%Lf%Lf",a,b); |
D. | printf("%f%Lf",a,b); |
Answer» B. printf("%Lf%f",a,b); | |
47. |
What do the following declaration signify?char *scr; |
A. | scr is a pointer to pointer variable. |
B. | scr is a function pointer. |
C. | scr is a pointer to char. |
D. | scr is a member of function pointer. |
Answer» D. scr is a member of function pointer. | |
48. |
The statement# include < math.h>is written at the top of a program to indicate |
A. | beginning of the program |
B. | beginning of the program |
C. | that certain information about mathematical library functions are to be included at the begnning of the program |
D. | none of these |
Answer» D. none of these | |
49. |
The operation of a staircase switch best explains the |
A. | or operation |
B. | and operation |
C. | exclusive nor operation |
D. | exclusive or operation |
Answer» E. | |
50. |
The minimum number of temporary variables needed to swap the contents of two variables is |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 0 |
Answer» E. | |