100 Most Important MCQ Questions of C- Language from Data Types, Variables, Input & Operator || C programming || Computer Technology || Edu Verse BY Pratik || Code With Pratik

C Language Quiz

1. What is the size of an int data type in C?

  • A. 2 bytes
  • B. 4 bytes
  • C. 8 bytes
  • D. 1 byte

Answer: B. 4 bytes

2. Which of the following is a valid variable name in C?

  • A. int
  • B. 123var
  • C. _var
  • D. #var

Answer: C. _var

3. What is the correct way to declare a constant in C?

  • A. const int num = 5;
  • B. constant int num = 5;
  • C. int const num = 5;
  • D. Both A and C

Answer: D. Both A and C

4. Which of the following data types can store a 32-bit integer in C?

  • A. short
  • B. int
  • C. long
  • D. char

Answer: B. int

5. Which format specifier is used to print a float value in C?

  • A. %d
  • B. %c
  • C. %f
  • D. %s

Answer: C. %f

6. How do you read a string from the user in C?

  • A. scanf("%s", str);
  • B. gets(str);
  • C. scanf("%c", str);
  • D. Both A and B

Answer: D. Both A and B

7. What will be the result of the expression 5 / 2 in C?

  • A. 2.5
  • B. 2
  • C. 3
  • D. 0

Answer: B. 2

8. Which operator is used to access the address of a variable?

  • A. *
  • B. &
  • C. %
  • D. @

Answer: B. &

9. Which of the following is a logical operator in C?

  • A. +
  • B. &&
  • C. -
  • D. /

Answer: B. &&

10. What will be the output of the following code?
int x = 10;
int y = x++;
printf("%d", y);

  • A. 10
  • B. 11
  • C. 9
  • D. Undefined

Answer: A. 10

11. What is the return type of the function printf() in C?

  • A. int
  • B. char
  • C. void
  • D. float

Answer: A. int

12. Which of the following is the correct syntax to declare a pointer in C?

  • A. int p;
  • B. int *p;
  • C. int &p;
  • D. pointer p;

Answer: B. int *p;

13. What is the output of the following code?
int a = 5, b = 10;
int c = a + b;
printf("%d", c);

  • A. 15
  • B. 10
  • C. 5
  • D. 0

Answer: A. 15

14. Which function is used to read a single character from the console in C?

  • A. scanf()
  • B. getchar()
  • C. printf()
  • D. putchar()

Answer: B. getchar()

15. What is the output of the following code?
int a = 5;
printf("%d", a++);

  • A. 5
  • B. 6
  • C. 4
  • D. 7

Answer: A. 5

16. What is the result of the expression 7 % 3 in C?

  • A. 2
  • B. 1
  • C. 0
  • D. 4

Answer: B. 1

17. Which operator is used to compare two values for equality in C?

  • A. =
  • B. ==
  • C. !=
  • D. < >

Answer: B. ==

18. Which of the following is not a valid relational operator in C?

  • A. ==
  • B. >
  • C. !=
  • D. !==

Answer: D. !==

19. How do you define a float variable named pi with a value of 3.14 in C?

  • A. float pi = 3.14;
  • B. float pi = "3.14";
  • C. float pi = '3.14';
  • D. float pi = 3.14f;

Answer: D. float pi = 3.14f;

20. Which of the following is used to take input from the user in C?

  • A. printf()
  • B. scanf()
  • C. gets()
  • D. puts()

Answer: B. scanf()

21. Which keyword is used to return a value from a function in C?

  • A. void
  • B. return
  • C. break
  • D. continue

Answer: B. return

22. Which operator is used for multiplication in C?

  • A. &
  • B. * (asterisk)
  • C. /
  • D. %

Answer: B. * (asterisk)

23. Which of the following is an invalid variable name in C?

  • A. myVar
  • B. 2ndValue
  • C. value_2
  • D. _value

Answer: B. 2ndValue

24. How do you increment the value of a variable x by 1 in C?

  • A. x = x + 1;
  • B. x += 1;
  • C. x++;
  • D. All of the above

Answer: D. All of the above

25. What will be the output of the following code?
int x = 5, y = 10;
printf("%d", x == y);

  • A. 0
  • B. 1
  • C. 5
  • D. 10

Answer: A. 0

26. Which of the following is not a valid storage class in C?

  • A. auto
  • B. register
  • C. static
  • D. constant

Answer: D. constant

27. What is the result of the following expression?
int x = 5;
x *= 2;
printf("%d", x);

  • A. 10
  • B. 5
  • C. 7
  • D. 15

Answer: A. 10

28. What is the output of the following code?
int a = 5;
int b = a++;
printf("%d %d", a, b);

  • A. 5 5
  • B. 6 5
  • C. 5 6
  • D. 6 6

Answer: B. 6 5

29. What will be the output of the following code?
int x = 10;
x = x++ * ++x;
printf("%d", x);

  • A. 120
  • B. 121
  • C. 110
  • D. Undefined

Answer: B. 121

30. Which of the following is the correct syntax to declare a double-precision variable in C?

  • A. double var;
  • B. Double var;
  • C. double: var;
  • D. var double;

Answer: A. double var;

31. What is the output of the following code?
int a = 5;
printf("%d", ++a);

  • A. 5
  • B. 6
  • C. 7
  • D. Undefined

Answer: B. 6

32. Which of the following is not a valid arithmetic operator in C?

  • A. +
  • B. -
  • C. %
  • D. !=

Answer: D. !=

33. What is the output of the following code?
int a = 10;
int b = 20;
int c = a + b;
printf("%d", c);

  • A. 10
  • B. 20
  • C. 30
  • D. 40

Answer: C. 30

34. Which of the following is the correct syntax to declare a char variable in C?

  • A. char var = "a";
  • B. char var = 'a';
  • C. char var = a#;
  • D. None of these.

Answer: B. char var = 'a';

35. How many bytes does the `char` data type occupy in C?

  • A. 1 byte
  • B. 2 bytes
  • C. 4 bytes
  • D. 8 bytes

Answer: A. 1 byte

36. What is the result of the following expression: int x = 5; printf("%d", x++);?

  • A. 4
  • B. 5
  • C. 6
  • D. Undefined

Answer: B. 5

37. Which of the following keywords is used to declare a variable that cannot be modified?

  • A. static
  • B. const
  • C. volatile
  • D. immutable

Answer: B. const

38. What will be the output of the following code?
int a = 10;
a += 5;
printf("%d", a);

  • A. 5
  • B. 10
  • C. 15
  • D. 20

Answer: C. 15

39. Which of the following is the correct syntax to initialize a string in C?

  • A. char str = "Hello";
  • B. char str[] = "Hello";
  • C. char str[6] = "Hello";
  • D. Both B and C

Answer: D. Both B and C

40. What is the default value of an uninitialized local variable in C?

  • A. 0
  • B. NULL
  • C. Garbage value
  • D. Depends on the compiler

Answer: C. Garbage value

41. Which of the following operators is used for bitwise AND operation in C?

  • A. &&
  • B. &
  • C. |
  • D. ^

Answer: B. &

42. What is the correct way to declare an array of 10 integers in C?

  • A. int arr[10];
  • B. int[10] arr;
  • C. arr int[10];
  • D. int arr = [10];

Answer: A. int arr[10];

43. Which operator is used to find the remainder in C?

  • A. /
  • B. %
  • C. &
  • D. //

Answer: B. %

44. What is the output of the following code?
int x = 10, y = 20;
int z = x > y ? x : y;
printf("%d", z);

  • A. 10
  • B. 20
  • C. 0
  • D. Undefined

Answer: B. 20

45. How can you define a macro in C?

  • A. #define MACRO
  • B. #macro MACRO
  • C. #include <MACRO>
  • D. #def MACRO

Answer: A. #define MACRO

46. What is the result of the expression 7 / 2 in C?

  • A. 3.5
  • B. 3
  • C. 4
  • D. 2

Answer: B. 3

47. Which format specifier is used to print an integer value in C?

  • A. %d
  • B. %f
  • C. %c
  • D. %s

Answer: A. %d

48. Which keyword is used to define a structure in C?

  • A. struct
  • B. class
  • C. object
  • D. typedef

Answer: A. struct

49. What is the output of the following code?
int a = 10;
int b = 20;
int c = a * b;
printf("%d", c);

  • A. 10
  • B. 20
  • C. 200
  • D. 30

Answer: C. 200

50. What is the purpose of the 'break' keyword in C?

  • A. To terminate the program
  • B. To stop the execution of the current loop
  • C. To exit from the function
  • D. To continue the next iteration of the loop

Answer: B. To stop the execution of the current loop

51. What is the result of the expression 5 && 0 in C?

  • A. 1
  • B. 0
  • C. 5
  • D. Undefined

Answer: B. 0

52. Which operator is used for logical OR in C?

  • A. &&
  • B. ||
  • C. !
  • D. &

Answer: B. ||

53. How do you access the value of a variable pointed by a pointer in C?

  • A. Using the address-of operator (&)
  • B. Using the dereference operator (*)
  • C. Using the size-of operator (sizeof)
  • D. Using the increment operator (++++)

Answer: B. Using the dereference operator (*)

54. What is the maximum value of an unsigned char in C?

  • A. 127
  • B. 255
  • C. 32767
  • D. 65535

Answer: B. 255

55. Which operator is used to check if two values are not equal in C?

  • A. ==
  • B. !=
  • C. >
  • D. <

Answer: B. !=

56. What is the output of the following code?
int x = 10;
int y = 5;
x = x / y;
printf("%d", x);

  • A. 0
  • B. 1
  • C. 2
  • D. 10

Answer: C. 2

57. Which keyword is used to define an enumeration in C?

  • A. enum
  • B. struct
  • C. typedef
  • D. enumtype

Answer: A. enum

58. What will be the output of the following code?
int a = 3;
int b = 4;
printf("%d", a | b);

  • A. 3
  • B. 4
  • C. 7
  • D. 1

Answer: C. 7

59. Which operator is used for bitwise exclusive OR in C?

  • A. &&
  • B. |
  • C. ^
  • D. &

Answer: C. ^

60. Which of the following statements is true about automatic variables in C?

  • A. They are stored in the heap
  • B. They are initialized to zero by default
  • C. They have a scope limited to the function block
  • D. They are accessible globally

Answer: C. They have a scope limited to the function block

61. What is the value of the expression !(1 && 0) in C?

  • A. 0
  • B. 1
  • C. 2
  • D. Undefined

Answer: B. 1

62. What is the output of the following code?
int a = 5;
int b = ++a;
printf("%d %d", a, b);

  • A. 5 5
  • B. 6 5
  • C. 5 6
  • D. 6 6

Answer: D. 6 6

63. How do you define a constant in C?

  • A. const int x = 10;
  • B. int const x = 10;
  • C. #define x 10
  • D. All of the above

Answer: D. All of the above

64. What will be the output of the following code?
int x = 5;
x *= x;
printf("%d", x);

  • A. 10
  • B. 15
  • C. 25
  • D. 30

Answer: C. 25

65. What is the output of the following code?
int a = 1;
int b = 0;
printf("%d", a || b);

  • A. 0
  • B. 1
  • C. 2
  • D. Undefined

Answer: B. 1

66. Which operator is used to determine the size of a data type or variable in C?

  • A. size
  • B. sizeof
  • C. length
  • D. sizeof()

Answer: D. sizeof()

67. What is the correct way to read an integer value from the user in C?

  • A. scanf("%d", &x);
  • B. scanf("%d", x);
  • C. scanf("%f", &x);
  • D. scanf("%c", &x);

Answer: A. scanf("%d", &x);

68. Which of the following is not a valid escape sequence in C?

  • A. \\
  • B. \n
  • C. \a
  • D. \x

Answer: D. \x

69. What will be the output of the following code?
int a = 5;
printf("%d", a++);

  • A. 4
  • B. 5
  • C. 6
  • D. Undefined

Answer: B. 5

70. What is the purpose of the 'continue' keyword in C?

  • A. To terminate the loop
  • B. To skip the rest of the loop iteration
  • C. To exit the program
  • D. To go back to the beginning of the loop

Answer: B. To skip the rest of the loop iteration

71. Which of the following is a floating-point data type in C?

  • A. int
  • B. char
  • C. float
  • D. bool

Answer: C. float

72. How do you declare a pointer to an integer in C?

  • A. int *p;
  • B. int p*;
  • C. *int p;
  • D. int p;

Answer: A. int *p;

73. What is the output of the following code?
int x = 1;
int y = x << 2;
printf("%d", y);

  • A. 1
  • B. 2
  • C. 4
  • D. 8

Answer: D. 8

74. Which of the following is not a relational operator in C?

  • A. ==
  • B. !=
  • C. <=
  • D. =

Answer: D. =

75. What is the result of the expression 5 | 3 in C?

  • A. 1
  • B. 3
  • C. 5
  • D. 7

Answer: D. 7

76. Which of the following is the correct way to define a two-dimensional array in C?

  • A. int arr[2,3];
  • B. int arr[2][3];
  • C. int [2,3]arr;
  • D. int arr=[2][3];

Answer: B. int arr[2][3];

77. What is the result of the expression ~0 in C?

  • A. 0
  • B. 1
  • C. -1
  • D. Undefined

Answer: C. -1

78. What will be the output of the following code?
int a = 10;
int b = 20;
int c = a + (b *= 2);
printf("%d", c);

  • A. 10
  • B. 20
  • C. 30
  • D. 50

Answer: D. 50

79. Which of the following is not a valid identifier in C?

  • A. _var
  • B. 2var
  • C. var_2
  • D. var2

Answer: B. 2var

80. What is the output of the following code?
int a = 10;
a += 5;
printf("%d", a);

  • A. 5
  • B. 10
  • C. 15
  • D. 20

Answer: C. 15

81. What data type is used to represent a single character in C?

  • A. char
  • B. int
  • C. float
  • D. string

Answer: A. char

82. What is the correct way to initialize an integer variable 'x' with the value 10?

  • A. int x = 10;
  • B. x = 10;
  • C. int x = "10";
  • D. int x(10);

Answer: A. int x = 10;

83. Which of the following is not a primitive data type in C?

  • A. int
  • B. float
  • C. struct
  • D. char

Answer: C. struct

84. What will be the output of the following code?
int a = 5;
int b = 2;
printf("%d", a % b);

  • A. 0
  • B. 1
  • C. 2
  • D. 5

Answer: B. 1

85. What is the purpose of the 'printf' function in C?

  • A. To read input from the user
  • B. To print text to the console
  • C. To declare variables
  • D. To create loops

Answer: B. To print text to the console

86. Which of the following statements is used to get input from the user in C?

  • A. input()
  • B. scanf()
  • C. gets()
  • D. read()

Answer: B. scanf()

87. What is the result of the expression 3.0 / 2 in C?

  • A. 1
  • B. 1.5
  • C. 2
  • D. Undefined

Answer: B. 1.5

88. Which keyword is used to create a constant variable in C?

  • A. const
  • B. static
  • C. final
  • D. constant

Answer: A. const

89. How do you declare an array of integers with 5 elements in C?

  • A. int arr[5];
  • B. int arr;
  • C. array arr[5];
  • D. int arr = [5];

Answer: A. int arr[5];

90. What will be the output of the following code?
int x = 10;
printf("%d", ++x);

  • A. 9
  • B. 10
  • C. 11
  • D. 12

Answer: C. 11

91. What is the format specifier for printing a float value in C?

  • A. %d
  • B. %f
  • C. %c
  • D. %s

Answer: B. %f

92. What is the correct syntax to declare a function in C that returns an integer?

  • A. int functionName();
  • B. int functionName(int a);
  • C. void functionName();
  • D. returnType functionName();

Answer: A. int functionName();

93. What is the correct way to write a multi-line comment in C?

  • A. // Comment
  • B. /* Comment */
  • C.
  • D. \* Comment */

Answer: B. /* Comment */

94. Which of the following is a bitwise operator in C?

  • A. &&
  • B. ||
  • C. &&
  • D. &

Answer: D. &

95. What is the output of the following code?
int a = 10;
int b = 5;
printf("%d", a == b);

  • A. 0
  • B. 1
  • C. 10
  • D. 5

Answer: A. 0

96. What is the result of the expression 10 % 3 in C?

  • A. 0
  • B. 1
  • C. 2
  • D. 3

Answer: C. 1

97. Which function is used to write a formatted output to the console in C?

  • A. printf()
  • B. scanf()
  • C. format()
  • D. output()

Answer: A. printf()

98. How do you declare a pointer to an integer in C?

  • A. int *ptr;
  • B. int ptr;
  • C. int ptr*;
  • D. pointer int ptr;

Answer: A. int *ptr;

99. Which operator is used to access the value at the address stored in a pointer?

  • A. &
  • B. *
  • C. @
  • D. #

Answer: B. *

100. Which function is used to get a single character from the console in C?

  • A. getchar()
  • B. scanf()
  • C. printf()
  • D. getch()

Answer: A. getchar()

Download PDF of this MCQ Questions
Code With Pratik

My name is Pratik Patel. I am studen of Computer Science and Engineering. I have 2+ years of experience in graphic designing and web developing.

Post a Comment

Previous Post Next Post