InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
In the directive, #pragma pack(n), which of the following is not a valid value of n?(a) 1(b) 2(c) 3(d) 4This question was addressed to me during an interview.Origin of the question is Pragma topic in portion C Preprocessor of C |
|
Answer» RIGHT ANSWER is (c) 3 Explanation: Valid ARGUMENTS are 1,2,4 and 8. 3 is not a valid VALUE for n. |
|
| 2. |
_______________ is the preprocessor directive which is used to end the scope of #ifdef.(a) #elif(b) #ifndef(c) #endif(d) #ifI got this question during an interview.This intriguing question originated from Conditional Preprocessor Directives topic in chapter C Preprocessor of C |
|
Answer» Correct option is (c) #endif |
|
| 3. |
The correct syntax of the attribute packed is _________(a) __attribute__((packed));(b) _attribute(packed);(c) _attribute_((packed));(d) __attribute__(packed);I have been asked this question in quiz.My question is based upon Pragma topic in division C Preprocessor of C |
|
Answer» The CORRECT choice is (a) __attribute__((packed)); |
|
| 4. |
The preprocessor directive used to give additional information to the compiler, beyond which is conveyed in the language _____________(a) #include(b) #define(c) #pragma(d) #elifThis question was posed to me by my college director while I was bunking the class.I would like to ask this question from Pragma topic in division C Preprocessor of C |
|
Answer» CORRECT answer is (c) #pragma Best EXPLANATION: The PREPROCESSOR DIRECTIVE #pragma is used to give additional information to the compiler, other than what is conveyed in the LANGUAGE itself. |
|
| 5. |
Which of the following attributes is used to specify that the minimum required memory to be used to represent the types?(a) packed(b) aligned(c) unused(d) deprecatedThe question was posed to me in final exam.My enquiry is from Pragma topic in section C Preprocessor of C |
|
Answer» Correct option is (a) packed |
|
| 6. |
The function of __attribute__((packed)); can also be performed using _________(a) #pragma pack(1);(b) #pragma pack(2);(c) #pragma pack(4);(d) #pragma pack(8);The question was asked in examination.The above asked question is from Pragma topic in section C Preprocessor of C |
|
Answer» The correct answer is (a) #PRAGMA PACK(1); |
|
| 7. |
In the directive #pragma pack(n), if the value of ‘n’ is given to be 5, then what happens?(a) Error(b) Warning but no error(c) Executes the pragma statement(d) Ignores the pragma statement and executes the programI had been asked this question in an internship interview.My doubt stems from Pragma in portion C Preprocessor of C |
|
Answer» Right choice is (d) Ignores the PRAGMA STATEMENT and executes the program |
|
| 8. |
The pragma ___________________ is used to remove an identifier completely from a program.(a) GNU piston(b) GCC poison(c) GNU poison(d) GCC pistonI got this question in class test.This key question is from Pragma in portion C Preprocessor of C |
|
Answer» The correct CHOICE is (B) GCC poison |
|
| 9. |
The purpose of the preprocessor directive #error is that ____________(a) It rectifies any error present in the code(b) It rectifies only the first error which occurs in the code(c) It causes the preprocessor to report a fatal error(d) It causes the preprocessor to ignore an errorThe question was asked during an online exam.My question comes from Conditional Preprocessor Directives topic in section C Preprocessor of C |
|
Answer» The CORRECT answer is (C) It causes the PREPROCESSOR to report a fatal error |
|
| 10. |
The preprocessor directive which checks whether a constant expression results in a zero or non-zero value __________(a) #if(b) #ifdef(c) #undef(d) #ifndefI had been asked this question by my college director while I was bunking the class.I want to ask this question from Conditional Preprocessor Directives topic in section C Preprocessor of C |
|
Answer» CORRECT choice is (a) #if The best explanation: #if checks whether a constant expression RESULTS in ZERO or not. If the expression is a non-zero value, then the statements between #if and #ENDIF will be executed.If the constant expression results in a zero value, the statements between #if and #endif will not be executed. |
|