Important C programming MCQ| MCQ of C Language with Answer

1. Who is the father of C language?

a. Steve Jobs

b. James Gosling

c. Dennis Ritche

d. Rasmus Lerdorf

2. Who developed C Programming Language?

a. James Gosling

b. Dennis Ritche

c. Rasmus Lerdorf

d. Bjarne Stroustrup

3. C was developed in _________.

a. 1970

b. 1972

c. 1974

d. 1976

4. C language is a __________.

a. Procedural oriented programming language

b. General purpose programming language

c. Structured programming

d. All of the above

5. C program is ____________ type of programming language.

a. Object oriented

b. Procedural

c. Bit level language

d. Functional

6. C programming is used in the development of?

a. Databases

b. Graphic applications

c. Word processors

d. All of the above

7. What is the extension of C source file?

a. .txt

b. .CS   

c. .CPP

d. .C

8. C provides __________ to input functions.

a. %d

b. scanf()

c. printf()

d. none

9. To indicate address location the ______ operator is used.

a. #

b. *

c. &

d. All

10. An ampersand (&) before the name of a variable denotes the ___________ of the variable.

a. Address

b. Actual value

c. Data type

d. Variable name

11. Which of the following functions must be included in all C programs?

a. start()

b. system()

c. main()

c. program()

12. Program execution always starts with

a. Main

b. Variable

c. Include

d. Case

13. Every C Program should contain which function?

a. printf()

b. show()

c. scanf()

d. main()

14. Which character must be used to end a C statement?

a. .  (dot)

b. ; (semicolon)

c. :  (colon)

d. ‘  (single-quote)

15. Which of the following is a correct syntax for inserting comments in C program?

a. */ comments */

b. ** comments **

c. /* comments */

d. { comments }

16. The scanf() is a predefined function in _________ header file.

a. stdlib.h

b. ctype.h

c. stdio.h

d. stdarg.h

17. What is the correct syntax to declare a variable in C?

a. data_type variable_name;

b. data_type as variable_name;

c. variable_name data_type;

d. variable_name as data_type;

18. Which are the fundamental data types in C?

a. Char

b. Int

c. Float

d. All of the above

19. How many byte(s) does a char type take in C?

a. 1

b. 2

c. 3

d. 4

20. How much memory is required to store the value of double type in C language.

a. 4 bytes

b. 6 bytes

c. 8 bytes

d. 10 bytes

21. For which type, the format specifier “%i” is used?

a. Int

b. Char 

c. Float

d. double

22. Which format specifier is used to read and print the string using printf() and scanf() in C?

a. %c

b. %str

c. %p

d. %s

23. How many keywords are there in C language?

a. 32

b. 33

c. 64

d. 18

24. All keywords in C are in _____________

a. Lower Case letters

b. Upper Case letters

c. Camel Case letters

d. None of the mentioned

25. Which is not a valid keyword in C?

a. For

b. While

c. do-while

d. Switch

26. Which operator gives remainder after division?

a. / (divide)

b. % (modulo)

c. ^

d. ~

27. What is the value of the arithmetic expression in C language: 12%4 + 6%4

a. 1

b. 2

c. 3

d. 4

28. Which one of the following is the correct operator to compare two variables?

a. := 

b. =

c. Equal

d. ==

29. Which one of the following is the operator for logical and?

a. &

b. && 

c. |

d. |&

30. Which of the following is not logical operator?

a. &

b. && 

c. ||

d. !

31. Which of the following operators combines two or more relational expressions?

a. &

b. &&

c. !=

d. +

32. What is the name of “&” operator in C?

a. Ampersand

b. And

c. Address of

d. None of the above

33. In C programming, ‘++’ is _________ operator.

a. Increment

b. Decrement

c. Assigning

d. Overloading

34. int i=6;

A=++i; Values of A

a. 6

b. 8

c. 7

d. 9

35. Decision making in the C programming language is __________________

a. Repeating the same statement multiple times

b. Executing a set of statements based on some condition

c. Providing a name of the block of code

d. All of these

36. Which of the following are valid decision-making statements in C?

a. If

b. Switch

c. nested if

d. All of these

37. What is the correct syntax of if statement in C program?

  1. If(condition) {     }
  2. If(condition):
  3. If{[condition]}
  4. None of these

38. Which statement is required to execute a block of code when the condition is false?

a. For

b. If

c. Else

d. All of these

39. Loops in C programming are used to ___________.

a. Execute a statement based on a condition

b. Execute a block of code repeatedly

c. Create a variable

d. None of these

40. Which of the following is an exit-controlled loop?

a. While

b. For

c. do-while

d. None of the above

41. When the condition of the do-while loop is false, how many times will it execute the code?

a. 0

b. 1

c. Infinite

d. All of these

42. What will happen if the loop condition will never become false?

a. Program will throw an error

b. Program will loop infinitely

c. Loop will not run

d. None of these

43. What is an Array in C language?

a. A group of elements of same data type.

b. An array contains more than one element

c. Array elements are stored in memory in continuous or contiguous locations.

d. All the above.

44. In C programming, array index always starts from

a. 0

b. 1

c. 2

d. 3

45. What is right way to initialize array?

a. int num[6] = { 2, 4, 12, 5, 45, 5 };

b. int n{} = { 2, 4, 12, 5, 45, 5 };

c. int n{6} = { 2, 4, 12 };

d. int n(6) = { 2, 4, 12, 5, 45, 5 };

46.  What will be the output of the following code?

int main()

{

int sum=2+4/2+6*2;

printf(“%d”,sum);

return 0;

}

a.   2

b.  15

c.  16

d. 17

#include<stdio.h>

int main()

{

int y=128;

const int x=y;

printf(“%d\n”,x);

return 0;

}

a.  128

b. Garbage value

c.  Error

d.  0

48. What will be the final value of x in the following C code?

#include<stdio.h>

void main()

{

x=5*9/5+9;

}

a.  3.75

b. 18

c. 3

d. depends on the compiler

#include<stdio.h>

void main()

{

int i=0;

while(i<3)

{

i++;

printf(“%d\n”,I);

}

}

a. 2

b. 3

c. 4

d. 1

50. What will be the output of the following C code? (Initial values: x=7, y=8)

#include<stdio.h>

void main()

{

float x;

int y;

printf(“enter two numbers\n”);

scanf(“%f %f”,&x,&y);

printf(“%f, %d”, x, y);

}

a. 7.000000, 7

b. Run time error

c. Varies

d. 7.000000, junk

Leave a Comment