Computer Fundamental – Programming MCQ


1. Which of the following is not a valid datatype in C language?

A. Char
B. String
C. Double
D. Int

Answer: B

2. Which of the following operator in C language is a ternary operator?

A. +=
B. %
C. ?:
D. ++

Answer: C

3. What will be the value stored in the variable x after executing the following code segment in C language?
X = 5 + 3/2 * 2;

A. 8
B. 7
C. 5
D. 6

Answer: B

4. Which of the following statements is not true about C language?

A. C is a high level programming language.
B. C was developed by Dennis Ritchie.
C. C is an object oriented programming language.
D. C is a case-sensitive programming language.

Answer: C

5. Which of the following is not a valid expression in C language?

A. x = 5(4+7);
B. X = 4*(-5-7);
C. x = 5*(4+7);
D. x = 4*(+5+7);

Answer: A

6. Which of the following is a looping control statement in C language in which the looping condition is checked at the end of each iteration?

A. while
B. for
C. if
D. do….while

Answer: D

7. The break statement can only be used inside _______ in a C program.

A. if…else
B. goto
C. if
D. switch…case and loops

Answer: D

8. C is a _____ generation computer programming language?

A. first
B. second
C. third
D. fourth

Answer: C

9. what will be the output produced by the following C program statement?
int i = 15;
int j = i++;

A. 15
B. 32
C. 16
D. 31

Answer: A

10. Left shifting an integer by two positions is equivalent to ____

A. division by 4
B. multiplication by 2
C. multiplication by 4
D. division by 2

Answer: B

11. what is the range of a signed char datatype in C language?

A. -128 to 127
B. -32768 to 32767
C. 0 to 65535
D. 0 to 255

Answer: A

12. What will be the output produced by the following C program?
int x= 546;
char y = x;
printf(“%d”, y);

A. 36
B. 34
C. 546
D. 46

Answer: B

13. A _____ variable preserves its value even after the function in which it is declared has finished execution.

A. static
B. auto
C. pointer
D. register

Answer: A

14. A preprocessor directive in C language always begins with a ______

A. %
B. $
C. @
D. #

Answer: D

15. A hexadecimal integer literal in C language is preceded with?

A. h
B. 0x
C. 0
D. x

Answer: B

16. A program is said to be containing ______ if does not produce the desired output.

A. virus
B. syntax error
C. exception
D. semantic error

Answer: D

17. What is the restriction on the use of ‘continue’ statement in a C program?

A. It can be used inside loops only.
B. It can be used inside if statement only.
C. It can be used anywhere within the program.
D. It can be used inside switch…case only.

Answer: A

18. All the elements of ____ user-defined data type in C language share the same memory location.

A. array
B. tree
C. union
D. structure

Answer: C

19. Which of the following operators in C language has right-to-left associativity?

A. = (assignment)
B. * (multiplication)
C. % (modulus)
D. + (addition)

Answer: A

20. What is required in each C program?

A. The program must have at least one function.
B. The program does not require any function.
C. Input data
D. Output data

Answer: A

Practice Question:-

Q. What is the output of this statement “printf(“%d”, (a++))”?

A. The value of (a + 1)
B. The current value of a
C. Error message
D. Garbage

Please comment your answer in comment section.

3 1 vote
Article Rating
Notify of
Inline Feedbacks
View all comments