150+ C Programming MCQs
1) C Basics MCQs
1. C language was developed by ___.
- Dennis Rechard
- Dennis M. Ritchie
- Bjarne Stroustrup
- Anders Hejlsberg
Answer: B) Dennis M. Ritchie
2. In which year was C language developed?
- 1962
- 1978
- 1979
- 1972
Answer: D) 1972
3. C language is a successor to which language?
- Basic
- Cobol
- C++
- B
Answer: D) B
4. C is a ___.
- Low level language
- High level language
- Medium level language
- None of the above
Answer: C) Medium level language
5. How many keywords are there in C language?
- 32
- 33
- 64
- 18
Answer: A) 32
6. C language is a ___.
- Procedural oriented programming language
- General purpose programming language
- Structured programming
- All of the above
Answer: D) All of the above
7. Which is not a valid keyword in C language?
- for
- while
- do-while
- switch
Answer: C) do-while
8. What is an identifier in C language?
- An identifier is a combination of alphanumeric characters used for conditional and control statements
- An identifier is a combination of alphanumeric characters used for any variable, function, label name
- Both A and B
- None of the above
Answer: B) An identifier is a combination of alphanumeric characters used for any variable, function, label name
9. A C-style comment, simply surround the text with ___.
- /* and */
- // and //
- //
- /** and **/
Answer: A) /* and */
10. Can we place comments between the statement to comments a part of the code?
- Yes
- No
Answer: A) Yes
11. ___ is an informal name for ISO/IEC 9899:1999, a past version of the C programming language standard?
- C
- C++
- C89
- C99
Answer: D) C99
12. In which version of C language, the C++ Style comment (//) are introduced?
- C17
- C18
- C89
- C99
Answer: D) C99
13. The C source file is processed by the ___.
- Interpreter
- Compiler
- Both Interpreter and Compiler
- Assembler
Answer: B) Compiler
14. How many whitespace characters are allowed in C language?
- 2
- 3
- 4
- 5
Answer: D) 5
15. How many punctuation characters are allowed in C language?
- 29
- 30
- 31
- 32
Answer: A) 29
16. What is the extension of a C language source file?
- .c
- .cpp
- .c99
- .h
Answer: A) .c
17. What is the extension of a C language header file?
- .c
- .cpp
- .c99
- .h
Answer: D) .h
18. To develop which operating, C language was invented?
- Linux
- Unix
- Android
- Mac
Answer: B) Unix
19. Does C language support object-oriented approach?
- Yes
- No
Answer: B) No
20. Which is/are the disadvantage(s) of C language?
- No Garbage Collection
- Inefficient Memory Management
- Low level of abstraction
- Lack of Object Orientation
- All of the above
Answer: E) All of the above
21. Which are the fundamental data types in C?
- char
- int
- float
- All of the above
Answer: D) All of the above
22. How many byte(s) does a char type take in C?
- 1
- 2
- 3
- 4
Answer: A) 1
23. For which type, the format specifier “%i” is used?
- int
- char
- float
- double
Answer: A) int
24. What is the difference between float and double in C?
- both are used for the same purpose
- double can store just double value as compare to float value
- double is an enhanced version of float and was introduced in C99
- double is more precise than float and can store 64 bits
Answer: D) double is more precise than float and can store 64 bits
25. Which is the correct format specifier for double type value in C?
- %d
- %f
- %lf
- %LF
Answer: C) %lf
26. The short type represents ___.
- int
- float
- unsigned int
- short int
Answer: C) unsigned int
27. How many byte(s) does a short type take in C?
- 1
- 2
- 3
- 4
Answer: B) 2
28. What is the correct syntax to declare a variable in C?
- data_type variable_name;
- data_type as variable_name;
- variable_name data_type;
- variable_name as data_type;
Answer: A) data_type variable_name;
29. How many types of qualifiers are there in C language?
- 2
- 3
- 4
- 5
Answer: B) 3
30. Which is/are the size qualifier(s) in C language?
- short
- long
- double
- Both A. and B
Answer: D) Both A. and B.
31. Which is/are the sign qualifier(s) in C language?
- signed
- unsigned
- long
- Both A. and B
Answer: D) Both A. and B.
32. Which is/are the type qualifier(s) in C language?
- const
- volatile
- static
- Both A. and B
Answer: D) Both A. and B.
33. Which is correct with respect to the size of the data types in C?
- char > int > float
- char < int < float
- int < char < float
- int < chat > float
Answer: B) char < int < float
34. Which operator is used to find the remainder of two numbers in C?
- /
- \
- %
- //
Answer: C) %
35. Which of the following is not an arithmetic expression?
- x = 10
- x /= 10
- x %= 10
- x != 10
Answer: D) x != 10
36. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 20;
x %= 3;
printf("%d",x);
return 0;
}
- 2
- 2.5
- Error
- Warning
Answer: A) 2
37. What will be the output of the following C code?
#include <stdio.h>
int main()
{
float x = 21.0;
x %= 3.0;
printf("%f",x);
return 0;
}
- 7
- 7.00
- 7.000000
- Error
Answer: D) Error
38. What will be the output of the following C code?
#include <stdio.h>
int main()
{
float x = 23.456;
printf("%.2f",x);
return 0;
}
- 23.45600
- 23.456
- 23.45
- 23.46
Answer: D) 23.46
39. What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 10;
int y = x++ + 20;
printf("%d,%d",x,y);
return 0;
}
- 11,30
- 11,31
- 10,30
- 10,31
Answer: A) 11,30
40. Increment (++) and decrement (–) are the ___ operators in C?
- Unary
- Binary
- Ternary
- None of the above
Answer: A) Unary
41. What will be the output of the following C code?
#include <stdio.h>
int main()
{
unsigned char c=290;
printf("%d",c);
return 0;
}
- 290
- 256
- 34
- Garbage
Answer: C) 34
42. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a=0;
a=5||2|1;
printf("%d",a);
return 0;
}
- 1
- 7
- 0
- 8
Answer: A) 1
43. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x =-100;
-100;
printf("%d",x);
return 0;
}
- 100
- -100
- 0
- Error
Answer: B) -100
44. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a,b,c;
a=0x10; b=010;
c=a+b;
printf("%d",c);
return 0;
}
- 20
- 24
- Garbage
- Error
Answer: B) 24
45. Which C keyword is used to extend the visibility of variables?
- extend
- extends
- extern
- auto
Answer: C) extern
46. What is the name of “&” operator in C?
- Ampersand
- And
- Address of
- None of the above
Answer: C) Address of
47. Which of the following are valid decision-making statements in C?
- if
- switch
- nested if
- All of these
Answer: D) All of these
48. Decision making in the C programming language is ___.
- Repeating the same statement multiple times
- Executing a set of statements based on some condition
- Providing a name of the block of code
- All of these
Answer: B) Executing a set of statements based on some condition
49. Which of the following is a true value in C programming?
- 1
- “Progies”
- ! NULL
- All of these
Answer: D) All of these
50. Ternary operator in C programming is ___.
- if-else-if
- ? :
- ? ; ?
- None of these
Answer: B) ? :
51. What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf((43 > 43) ? "value 1 is greater!" : "value 1 is not greater!");
return 0;
}
- value 1 is not greater
- value 1 is greater
- Error
- None of these
Answer: A) value 1 is not greater
52. What is the correct syntax of if statement in C program?
- if(condition){}
- if(condition) :
- If { [condition] }
- None of these
Answer: A)
53. The if statement is a conditional statement?
- True
- False
Answer: A) True
54. When the condition of if statement is false, the flow of code will ___.
- go into the if block
- Exit the program
- Continue the code after skipping the if block
- None of these
Answer: C) Continue the code after skipping the if block
55. What will be the result of the following condition?
(! (25 > 25))
- True
- False
- Error
- None of these
Answer: A) True
56. Which statement is required to execute a block of code when the condition is false?
- for
- if
- else
- All of these
Answer: C) else
57. Can the else statement exist without the if statement in C?
- Yes
- No
Answer: B) No
58. Which of these if…else block syntax is correct?
A.
if(condition){
}
else {
}
B.
if(condition){
}
else(condition){
}
C.
if{}
D. None of these
Answer: A)
if(condition){
}
else {
}
59. The if-elseif-else statement in C programming is used?
- Create multiple conditional statements
- Return values
- Loop in if-else block
- All of these
Answer: A) Create multiple conditional statements
60. What will be the output of the following C code?
#include <stdio.h>
int main()
{
int marks = 43;
if (marks > 90)
printf("Grade : A ");
else if (marks > 75)
printf("Grade : B ");
else if (marks > 60)
printf("Grade : C ");
if (marks > 40)
printf("Grade : D ");
else
printf("Fail ");
return 0;
}
- Grade : A
- Grade : B
- Grade : C
- Grade : D
Answer: D) Grade : D
61. How many expressions can be checked using if…elseif…else statement?
- 100
- 1
- Infinite
- None of these
Answer: C) Infinite
62. Is it possible to nest if-else statements in C programming?
- Yes
- No
Answer: A) Yes
63. Which of the following syntax is correct for nested if-else statements?
A.
if(exp1){
if(exp2){
}
}
else {
if(exp3){
}
}
B.
B. if(exp1){
}else {
}
C.
if{}
D. None of these
Answer: A)
if(exp1){
if(exp2){
}
}
else {
if(exp3){
}
}
64. What will be the output of the following C code?
#include <stdio.h>
int main(){
int n = 65;
if (n >= 75) {
if (n >= 95) {
printf("Excellent");
}
else
printf("Pass");
}
else
printf("Fail");
}
- Excellent
- Pass
- Fail
- None of these
Answer: C) Fail
65. Multiple values of the same variable can be tested using ___.
- switch
- for
- Function
- All of these
Answer: A) switch
66. Without a break statement in switch what will happen?
- All cases will work properly
- Cases will fall through after matching the first check
- Switch will throw error
- All of these
Answer: B) Cases will fall through after matching the first check
67. When all cases are unmatched which case is matched in a switch statement?
- Default case
- First case
- No case
- None of these
Answer: A) Default case
68. What will be the output of the following C code?
#include <stdio.h>
int main(){
char grade = 'B';
switch (grade) {
case 'A':
printf("Excellent!\n");
case 'B':
case 'C':
printf("Well done\n");
case 'D':
printf("You passed\n");
case 'F':
printf("Better try again\n");
break;
default:
printf("Invalid grade\n");
}
}
- Well done
- You passed
- Better try again
- All of these
Answer: D) All of these
69. Loops in C programming are used to ___.
- Execute a statement based on a condition
- Execute a block of code repeatedly
- Create a variable
- None of these
Answer: B) Execute a block of code repeatedly
70. Which of these is an exit-controlled loop?
- for
- if
- do…while
- while
Answer: C) do…while
71. Which statements are used to change the execution sequence?
- Loop control statement
- Function statement
- Conditional statement
- All of these
Answer: A) Loop control statement
72. What will happen if the loop condition will never become false?
- Program will throw an error
- Program will loop infinitely
- Loop will not run
- None of these
Answer: B) Program will loop infinitely
73. Which of these statements is correct in case of while loop in C?
- Executes the block till the condition become false
- Is an entry controlled loop
- There might be condition when the loop will not execute at all
- All of these
Answer: D) All of these
74. Which of the following is valid syntax for creating a while loop?
A.while{} (condition)
B.while(condition){}
C.while{}
D.All of these
Answer: B)while(condition){}
75. What will be the output of the following C code?
#include <stdio.h>
int main(){
int a = 11;
while (a < 20) {
printf("%d ", a);
a += 2;
}
return 0;
}
- 11 13 15 17 19
- 11 12 13 14 15 16 17 18 19 20
- 11 13 15 17 19 21
- None of these
Answer: A) 11 13 15 17 19
76. Which loop executes the block a specific number of times?
- while loop
- for loop
- do…while loop
- All of these
Answer: B) for loop
77. Which of the following parts of the for loop can be eliminated in C?
- init
- condition
- increment
- All of these
Answer: D) All of these
78. When all parts of the for loop are eliminated, what will happen?
- For loop will not work
- Infinite for loop
- Error
- None of these
Answer: B) Infinite for loop
79. When the condition of the do-while loop is false, how many times will it execute the code?
- 0
- 1
- Infinite
- All of these
Answer: B) 1
80. Can a loop be nested in C programming?
- Yes
- No
Answer: A) Yes
81. What will be the output of the following C code?
#include <stdio.h>
int main(){
int i, j;
for (i = 2; i < 10; i++) {
for (j = 2; j <= (i / j); j++)
if (!(i % j))
break;
if (j > (i / j))
printf("%d ", i);
}
return 0;
}
- 2 3 4 5 6 7 8 9
- 3 5 7 9
- 2 3 5 7
- 2 3 5 7 11
Answer: C) 2 3 5 7
5) C Strings MCQs
82. A string is terminated by ___.
- Newline (‘\n’)
- Null (‘\0’)
- Whitespace
- None of the above
Answer: B) Null (‘\0’)
83. Consider the below statement, can we assign a string to variable like this:
char c[100];
c = “C programming”;
- Yes
- No
Answer: B) No
84. Which format specifier is used to read and print the string using printf() and scanf() in C?
- %c
- %str
- %p
- %s
Answer: D) %s
85. Which function is used to read a line of text including spaces from the user in C?
- scanf()
- getc()
- fgets()
- All of the above
Answer: C) fgets()
86. Which function is used to concatenate two strings in C?
- concat()
- cat()
- stringcat()
- strcat()
Answer: D) strcat()
87. What will be the output of the following C code?
#include <stdio.h>
int main()
{
char str1[] = { 'H', 'e', 'l', 'l', 'o' };
char str2[] = "Hello";
printf("%ld,%ld", sizeof(str1), sizeof(str2));
return 0;
}
- 5,5
- 6,6
- 5,6
- None of the above
Answer: C) 5,6
88. What will be the output of the following C code?
#include <stdio.h>
int main()
{
char str1[] = "Hello";
char str2[10];
str2 = str1;
printf("%s,%s", str1, str2);
return 0;
}
- Hello,
- Hello,Hello
- Hello,HelloHello
- Error
Answer: D) Error
89. What will be the output of the following C code? (If the input is “Hello world”)
#include <stdio.h>
int main()
{
char str[30];
scanf("%s", str);
printf("%s", str);
return 0;
}
- Hello world
- Hello
- Hello world\0
- Error
Answer: B) Hello
90. Which function is used to compare two strings in C?
- strcmp()
- strcmpi()
- compare()
- cmpi()
Answer: A) strcmp()
91. Which function is used to compare two strings with ignoring case in C?
- strcmp()
- strcmpi()
- compare()
- cmpi()
Answer: B) strcmpi()
92. Which is the correct syntax to declare an array in C?
- data_type array_name[array_size];
- data_type array_name{array_size};
- data_type array_name[];
- All of the above
Answer: A) data_type array_name[array_size];
93. You can access elements of an array by ___.
- values
- indices
- memory addresses
- All of the above
Answer: B) indices
94. Which is/are the correct syntax to initialize an array in C?
- data_type array_name[array_size] = {value1, value2, value3, …};
- data_type array_name[] = {value1, value2, value3, …};
- data_type array_name[array_size] = {};
- Both A and B
Answer: D) Both A and B
95. Array elements are always stored in ___ memory locations.
- Random
- Sequential
- Both A and B
- None of the above
Answer: B) Sequential
96. Let x is an integer array with three elements having value 10, 20, and 30. What will be the output of the following statement?
printf(“%u”,x);
- Prints the value of 0th element (i.e., 10)
- Prints the garbage value
- An error occurs
- Print the address of the array (i.e., the address of first (0th) element
Answer: D) Print the address of the array (i.e., the address of first (0th) element
97. What will be the output of the following C program?
#include <stdio.h>
int main()
{
int x[5] = { 10, 20, 30 };
printf("%d", x[3]);
return 0;
}
- 0
- 30
- Garbage value
- Error
Answer: A) 0
98. What will be the output of the following C program?
#include <stdio.h>
int main()
{
int x[5] = { 10, 20, 30 };
printf("%d", x[-1]);
return 0;
}
- 0
- 10
- Garbage value
- Error
Answer: C) Garbage value
99. What will be the output of the following C program?
#include <stdio.h>
int main()
{
int x[5] = { 10, 20, 30 };
printf("%ld", sizeof(x)/sizeof(x[0]));
return 0;
}
- 3
- 4
- 5
- 6
Answer: C) 5
100. What will be the output of the following C program?
#include <stdio.h>
int main()
{
int x[5] = { 10, 20, 30 };
printf("%d", x[3]);
return 0;
}
- 0
- 30
- Garbage value
- Error
Answer: A) 0
101. What will be the output of the following C program?
#include <stdio.h>
int main()
{
int x[5] = { 10, 20, 30 };
printf("%d", x[-1]);
return 0;
}
- 0
- 10
- Garbage value
- Error
Answer: C) Garbage value
102. If we pass an array as an argument to a function, what actually gets passed?
- Value of elements in array
- First element of the array
- Base address of the array i.e., the address of the first element
- Address of the last element of array
Answer: C) Base address of the array i.e., the address of the first element
7) C Structures and Union MCQs
103. Which of the following is the collection of different data types?
- structure
- string
- array
- All of the above
Answer: A) structure
104. Which operator is used to access the member of a structure?
- –
- >
- *
- .
Answer: D) .
105. Which of these is a user-defined data type in C?
- int
- union
- char
- All of these
Answer: B) union
106. “A union can contain data of different data types”. True or False?
- True
- False
Answer: A) True
107. Which keyword is used to define a union?
- un
- union
- Union
- None of these
Answer: B) union
108. The size of a union is ___.
- Sum of sizes of all members
- Predefined by the compiler
- Equal to size of largest data type
- None of these
Answer: C) Equal to size of largest data type
109. All members of union ___.
- Stored in consecutive memory location
- Share same memory location
- Store at different location
- All of these
Answer: B) Share same memory location
110. Which of the below statements is incorrect in case of union?
- Union is a user-defined data structure
- All data share same memory
- Union stores methods too
- union keyword is used to initialize
Answer: C) Union stores methods too
111. The members of union can be accessed using ___.
- Dot Operator (.)
- And Operator (&)
- Asterisk Operator (*)
- Right Shift Operator (>)
Answer: A) Dot Operator (.)
112. In which case union is better than structure?
- Less memory is available
- Faster compilation is required
- When functions are included
- None of these
Answer: A) Less memory is available
113. Which is the correct syntax to create a union?
- union union_name { };
- union union_name { }
- union union_name ( );
- union union_name ( )
Answer: A) union union_name { };
114. What will be the output of the following C program?
#include <stdio.h>
union values {
int val1;
char val2;
} myVal;
int main()
{
myVal.val1 = 66;
printf("val1 = %p", &myVal.val1);
printf("\nval2 = %p", &myVal.val2);
return 0;
}
A. val1 = 0x54ac88dd2012 val2 = 0x55ac76dd2014
B. Error
C. val1 = 0x55ac76dd2014 val2 = 0x55ac76dd2014
D.Exception
Answer: C) val1 = 0x55ac76dd2014 val2 = 0x55ac76dd2014
8) C Functions MCQs
115. What is a function in C?
- User defined data type
- Block of code which can be reused
- Declaration syntax
- None of these
Answer: B) Block of code which can be reused
116. Functions in C can accept multiple parameters. True or False?
- True
- False
Answer: A) True
117. Which keyword is used to return values from function?
- Return
- Value
- Return type
- All of these
Answer: C) Return type
118. Which of these is not a valid parameter passing method in C?
- Call by value
- Call by reference
- Call by pointer
- All of these
Answer: C) Call by pointer
119. A C program contains ___.
- At least one function
- No function
- No value from command line
- All of these
Answer: A) At least one function
120. A recursive function in C ___.
- Call itself again and again
- Loop over a parameter
- Return multiple values
- None of these
Answer: A) Call itself again and again
121. The scope of a function is limited to?
- Current block
- Only function
- Whole file
- Directory
Answer: C) Whole file
122. Which of the below syntax is the correct way of declaring a function?
A. return function_name () { }
B. data_type function_name (parameter) { }
C. Void function_name ( )
D. None of these
Answer: B)
data_type function_name (parameter){ }
123. The sqrt() function is used to calculate which value?
- Square
- Square of reverse bits
- Square root
- None of these
Answer: C) Square root
124. What will be the output of the following C program?
#include <stdio.h>
int myFunc(int x){
return (--x);
}
int main(){
int a = myFunc(13);
printf("%d", a);
return 0;
}
- 13
- 12
- 14
- Error
Answer: B) 12
9) C Pointers MCQs
125. Before using a pointer variable, it should be ___.
- Declared
- Initialized
- Both A. and B.
- None of the above
Answer: C) Both A. and B.
126. An uninitialized pointer in C is called ___.
- Void pointer
- Empty pointer
- Invalid pointer
- Wild pointer
Answer: D) Wild pointer
127. ___ is a pointer that occurs at the time when the object is de-allocated from memory without modifying the value of the pointer.
- Dangling pointer
- Wild pointer
- Void pointer
- Null pointer
Answer: A) Dangling pointer
128. A ___ can be assigned the address of any data type.
- Dangling pointer
- Wild pointer
- Void pointer
- Null pointer
Answer: C) Void pointer
129. Which pointer is called general-purpose pointer?
- Dangling pointer
- Wild pointer
- Void pointer
- Null pointer
Answer: C) Void pointer
130. Pointer arithmetic is not possible on ___.
- Integer pointers
- Float pointers
- Character pointers
- Void pointers
Answer: D) Void pointers
131. Comment on the following pointer declaration?
int *p, x;
- p is a pointer to integer, x is not
- p and x, both are pointers to integer
- p is pointer to integer, x may or may not be
- p and x both are not pointers to integer
Answer: A) p is a pointer to integer, x is not
132. What will be the output of the following C code?
#include <stdio.h>
int main(){
int x = 10, *ptr;
ptr = &x;
*ptr = 20;
printf("%d", x);
}
- 10
- 20
- Error
- A garbage value
Answer: B) 20
133. What will be the output of the following C code?
#include <stdio.h>
int main(){
char* ptr;
ptr = "progies";
printf("%c", *&*ptr);
return 0;
}
- progies
- I
- Some address
- Error
Answer: B) I
134. What is the correct syntax to declare pointer to pointer i.e., double pointer?
- type **pointer_name;
- type *&pointer_name;
- type *(*pointer_name);
- type **(pointer_name);
Answer: A) type **pointer_name;
135. What is ptr in the given statement?
int (*ptr)[5];
- ptr is an array of 5 pointers
- ptr is a simple integer array
- ptr is a pointer to a 5 elements integer array
- None of the above
Answer: C) ptr is a pointer to a 5 elements integer array
136. What is the correct syntax to declare a pointer to a constant?
- const type *pointer_name;
- type const *pointer_name;
- Both A. and B.
- None of the above
Answer: A) const type *pointer_name;
10) C File Handling MCQs
137. Which function is used to open a file in C?
- open()
- fopen()
- file_open()
- fileopen()
Answer: B) fopen()
138. Which character(s) is/are used to open a binary file in append mode in C?
- a
- b
- ba
- ab
Answer: D) ab
139. Which character(s) is/are used to open a binary file in reading and writing mode in C?
- rw
- rwb
- rb+
- rwb
Answer: C) rb+
140. Which is the correct syntax to declare a file pointer in C?
- File *file_pointer;
- FILE *file_pointer;
- File file_pointer;
- FILE *file_pointer;
Answer: B) FILE *file_pointer;
141. Which function is used to close an opened file in C?
- close()
- fclose()
- file_close()
- fileclose()
Answer: B) fclose()
142. Function fwrite() works with ___.
- Text files
- Binary files
- Both A. and B.
- None of the above
Answer: B) Binary files
143. What is the value of EOF in C?
- -1
- 0
- 1
- Null
Answer: A) -1
144. Which function checks the end-of-file indicator for the given stream in C?
- eof()
- EOF
- feof()
- None of the above
Answer: C) feof()
145. Which function is used to seek the file pointer position in C?
- seek()
- fseek()
- fileseek()
- fmove()
Answer: B) fseek()
146. Which function is used to delete an existing file in C?
- delete()
- fremove()
- frem()
- remove()
Answer: D) remove()
11) C Preprocessor MCQs
147. What is CPP in C programming?
- C processing platform
- C PreProcessor
- C pre-platform
- None of these
Answer: B) C PreProcessor
148. Which symbol is used to begin a preprocessor?
- @
- !
- #
- All of these
Answer: C) #
149. Which of these is a valid preprocessor in C?
- #include
- #if
- #error
- All of these
Answer: D) All of these
150. (\) operator in C is ___.
- Macro continuation operator
- Stringize operator
- Tokenizer
- None of these
Answer: A) Macro continuation operator
151. Which operator is used to stringize variables in C?
- /
- &
- *
- #
Answer: D) #
152. Is it possible in a C program to merge two tokens into one token?
- Yes
- No
Answer: A) Yes
153. Which of these is not a valid preprocessor in C?
- \
- ?
- ###
- None of these
Answer: B) ?
154. Header files ___.
- Contain function declarations
- Can be included to a program
- End with .h extension
- All of these
Answer: D) All of these
155. Can programmers create their own header files?
- Yes
- No
Answer: A) Yes
156. Which of these is valid syntax to include a header in C?
- #include <header>
- #include “header”
- Both A and B
- All of these
Answer: C) Both A and B
157. What will happen if a header file is included in a program twice?
- Program will throw an error
- Program will throw an exception
- Program will run normally
- None of these
Answer: A) Program will throw an error
158. Which syntax is correct to include a specific preprocessor based on configuration?
- #defif system1 <system.h>
- #include system1 “system.h”
- import <system.h> if system1
- All of these
Answer: B) #include system1 “system.h”