Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q391: Where does the compiler search for a file included using #include<somefile>?
- A: Current working directory
- B: User's home directory
- C: Specific include directory
- D: Temporary folder
View Answer
C
Q392: What file extension is usually used for header files in C?
- A: .c
- B: .h
- C: .cpp
- D: .exe
View Answer
B
Q393: What is the difference between using angle brackets and quotation marks with #include?
- A: Angle brackets search current directory
- B: Quotation marks search specific folder
- C: Angle brackets search specific directory
- D: Quotation marks search parent directory
View Answer
C
Q394: What is a macro in C?
- A: A special type of variable
- B: A constant
- C: A function
- D: A symbolic name replaced by its definition
View Answer
D
Q395: Which directive is used to define a macro in C?
- A: #define
- B: #include
- C: #undef
- D: #ifdef
View Answer
A
Q396: What happens when a macro is used in the code?
- A: It is executed like a function
- B: It is replaced by its definition
- C: It generates an error
- D: It is ignored
View Answer
B
Q397: Why should parentheses be used in parameterized macros?
- A: To ensure correct calculation precedence
- B: To make it look neat
- C: To avoid syntax errors
- D: To allow function calls
View Answer
A
Q398: What is conditional compilation in C?
- A: Compiling code based on conditions
- B: Compiling code selectively based on macros
- C: Skipping errors in compilation
- D: Running the code conditionally
View Answer
B
Q399: Which directive checks if a symbol is defined before executing a block of code?
- A: #define
- B: #include
- C: #ifdef
- D: #endif
View Answer
C
Q400: Which directive is used to undefine a previously defined macro?
- A: #undef
- B: #ifndef
- C: #ifdef
- D: #else
View Answer
A