1. What is the size of an int data type in C?
Answer: B. 4 bytes
2. Which of the following is a valid variable name in C?
Answer: C. _var
3. What is the correct way to declare a constant in C?
Answer: D. Both A and C
4. Which of the following data types can store a 32-bit integer in C?
Answer: B. int
5. Which format specifier is used to print a float value in C?
Answer: C. %f
6. How do you read a string from the user in C?
Answer: D. Both A and B
7. What will be the result of the expression 5 / 2 in C?
Answer: B. 2
8. Which operator is used to access the address of a variable?
Answer: B. &
9. Which of the following is a logical operator in C?
Answer: B. &&
10. What will be the output of the following code?
int x = 10;
int y = x++;
printf("%d", y);
Answer: A. 10
11. What is the return type of the function printf() in C?
Answer: A. int
12. Which of the following is the correct syntax to declare a pointer in C?
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);
Answer: A. 15
14. Which function is used to read a single character from the console in C?
Answer: B. getchar()
15. What is the output of the following code?
int a = 5;
printf("%d", a++);
Answer: A. 5
16. What is the result of the expression 7 % 3
in C?
Answer: B. 1
17. Which operator is used to compare two values for equality in C?
Answer: B. ==
18. Which of the following is not a valid relational operator in C?
Answer: D. !==
19. How do you define a float variable named pi
with a value of 3.14 in C?
Answer: D. float pi = 3.14f;
20. Which of the following is used to take input from the user in C?
Answer: B. scanf()
21. Which keyword is used to return a value from a function in C?
Answer: B. return
22. Which operator is used for multiplication in C?
Answer: B. * (asterisk)
23. Which of the following is an invalid variable name in C?
Answer: B. 2ndValue
24. How do you increment the value of a variable x
by 1 in C?
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);
Answer: A. 0
26. Which of the following is not a valid storage class in C?
Answer: D. constant
27. What is the result of the following expression?
int x = 5;
x *= 2;
printf("%d", x);
Answer: A. 10
28. What is the output of the following code?
int a = 5;
int b = a++;
printf("%d %d", a, b);
Answer: B. 6 5
29. What will be the output of the following code?
int x = 10;
x = x++ * ++x;
printf("%d", x);
Answer: B. 121
30. Which of the following is the correct syntax to declare a double-precision variable in C?
Answer: A. double var;
31. What is the output of the following code?
int a = 5;
printf("%d", ++a);
Answer: B. 6
32. Which of the following is not a valid arithmetic operator in C?
Answer: D. !=
33. What is the output of the following code?
int a = 10;
int b = 20;
int c = a + b;
printf("%d", c);
Answer: C. 30
34. Which of the following is the correct syntax to declare a char variable in C?
Answer: B. char var = 'a';
35. How many bytes does the `char` data type occupy in C?
Answer: A. 1 byte
36. What is the result of the following expression: int x = 5; printf("%d", x++);
?
Answer: B. 5
37. Which of the following keywords is used to declare a variable that cannot be modified?
Answer: B. const
38. What will be the output of the following code?
int a = 10;
a += 5;
printf("%d", a);
Answer: C. 15
39. Which of the following is the correct syntax to initialize a string in C?
Answer: D. Both B and C
40. What is the default value of an uninitialized local variable in C?
Answer: C. Garbage value
41. Which of the following operators is used for bitwise AND operation in C?
Answer: B. &
42. What is the correct way to declare an array of 10 integers in C?
Answer: A. int arr[10];
43. Which operator is used to find the remainder in C?
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);
Answer: B. 20
45. How can you define a macro in C?
Answer: A. #define MACRO
46. What is the result of the expression 7 / 2
in C?
Answer: B. 3
47. Which format specifier is used to print an integer value in C?
Answer: A. %d
48. Which keyword is used to define a structure in C?
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);
Answer: C. 200
50. What is the purpose of the 'break' keyword in C?
Answer: B. To stop the execution of the current loop
51. What is the result of the expression 5 && 0
in C?
Answer: B. 0
52. Which operator is used for logical OR in C?
Answer: B. ||
53. How do you access the value of a variable pointed by a pointer in C?
Answer: B. Using the dereference operator (*)
54. What is the maximum value of an unsigned char in C?
Answer: B. 255
55. Which operator is used to check if two values are not equal in C?
Answer: B. !=
56. What is the output of the following code?
int x = 10;
int y = 5;
x = x / y;
printf("%d", x);
Answer: C. 2
57. Which keyword is used to define an enumeration in C?
Answer: A. enum
58. What will be the output of the following code?
int a = 3;
int b = 4;
printf("%d", a | b);
Answer: C. 7
59. Which operator is used for bitwise exclusive OR in C?
Answer: C. ^
60. Which of the following statements is true about automatic variables in C?
Answer: C. They have a scope limited to the function block
61. What is the value of the expression !(1 && 0)
in C?
Answer: B. 1
62. What is the output of the following code?
int a = 5;
int b = ++a;
printf("%d %d", a, b);
Answer: D. 6 6
63. How do you define a constant in C?
Answer: D. All of the above
64. What will be the output of the following code?
int x = 5;
x *= x;
printf("%d", x);
Answer: C. 25
65. What is the output of the following code?
int a = 1;
int b = 0;
printf("%d", a || b);
Answer: B. 1
66. Which operator is used to determine the size of a data type or variable in C?
Answer: D. sizeof()
67. What is the correct way to read an integer value from the user in C?
Answer: A. scanf("%d", &x);
68. Which of the following is not a valid escape sequence in C?
Answer: D. \x
69. What will be the output of the following code?
int a = 5;
printf("%d", a++);
Answer: B. 5
70. What is the purpose of the 'continue' keyword in C?
Answer: B. To skip the rest of the loop iteration
71. Which of the following is a floating-point data type in C?
Answer: C. float
72. How do you declare a pointer to an integer in C?
Answer: A. int *p;
73. What is the output of the following code?
int x = 1;
int y = x << 2;
printf("%d", y);
Answer: D. 8
74. Which of the following is not a relational operator in C?
Answer: D. =
75. What is the result of the expression 5 | 3
in C?
Answer: D. 7
76. Which of the following is the correct way to define a two-dimensional array in C?
Answer: B. int arr[2][3];
77. What is the result of the expression ~0
in C?
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);
Answer: D. 50
79. Which of the following is not a valid identifier in C?
Answer: B. 2var
80. What is the output of the following code?
int a = 10;
a += 5;
printf("%d", a);
Answer: C. 15
81. What data type is used to represent a single character in C?
Answer: A. char
82. What is the correct way to initialize an integer variable 'x' with the value 10?
Answer: A. int x = 10;
83. Which of the following is not a primitive data type in C?
Answer: C. struct
84. What will be the output of the following code?
int a = 5;
int b = 2;
printf("%d", a % b);
Answer: B. 1
85. What is the purpose of the 'printf' function in C?
Answer: B. To print text to the console
86. Which of the following statements is used to get input from the user in C?
Answer: B. scanf()
87. What is the result of the expression 3.0 / 2
in C?
Answer: B. 1.5
88. Which keyword is used to create a constant variable in C?
Answer: A. const
89. How do you declare an array of integers with 5 elements in C?
Answer: A. int arr[5];
90. What will be the output of the following code?
int x = 10;
printf("%d", ++x);
Answer: C. 11
91. What is the format specifier for printing a float value in C?
Answer: B. %f
92. What is the correct syntax to declare a function in C that returns an integer?
Answer: A. int functionName();
93. What is the correct way to write a multi-line comment in C?
Answer: B. /* Comment */
94. Which of the following is a bitwise operator in C?
Answer: D. &
95. What is the output of the following code?
int a = 10;
int b = 5;
printf("%d", a == b);
Answer: A. 0
96. What is the result of the expression 10 % 3
in C?
Answer: C. 1
97. Which function is used to write a formatted output to the console in C?
Answer: A. printf()
98. How do you declare a pointer to an integer in C?
Answer: A. int *ptr;
99. Which operator is used to access the value at the address stored in a pointer?
Answer: B. *
100. Which function is used to get a single character from the console in C?
Answer: A. getchar()