Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Take Free Test
C Preprocessor Questions
Semantics check: Can #undef be applied only to a macro that was previously #define’d?
After preprocessing, do macro names and their definitions remain in the compiler’s input, or are they removed from the expanded source?
Must every valid C program contain at least one preprocessor directive?
Content of typical C header files: Do headers commonly contain macros, structure declarations, and function prototypes?
C preprocessor macros – does a macro “receive control” at runtime? Consider the statement: “In a macro call the control is passed to the macro.” Decide whether this is accurate in C programming.
C preprocessor directives – are they messages from the compiler to the linker? Evaluate the accuracy of this statement about the build pipeline.
C macro naming conventions – must macros always be written in uppercase letters? Judge the correctness of this style-related statement.
C preprocessor – are macros with arguments permitted? Decide whether parameterized (function-like) macros are allowed in standard C.
C macros and scope – do macros have local scope by default? Evaluate the statement about the visibility and lifetime of macro definitions.
Preventing multiple inclusion of the same header – is there a standard way? Decide whether C provides mechanisms to avoid including a file twice.
Macro-defined infinite loop – will this program print the message endlessly? #include
#define INFINITELOOP while(1) int main() { INFINITELOOP printf("CuriousTab"); return 0; }
Conditional compilation with #ifdef – does this program compile and what is printed? #include
int main() { #ifdef NOTE int a; a = 10; #else int a; a = 20; #endif printf("%d ", a); return 0; }
typedef and preprocessor syntax – would this construct work? Code to assess: typedef #include l;
Mutually recursive macro definitions – will this program compile? #include
#define X (4+Y) #define Y (X+3) int main() { printf("%d ", 4X + 2); return 0; }
In C/C++, is it strictly necessary for a header file to use the .h extension, or can headers be named without .h (for example, project-specific headers or C++ standard headers like
)? Provide the most accurate answer and rationale.
C language: Will this program compile successfully and what does the concatenation of adjacent string literals do? #include
int main() { printf("India" "CURIOUSTAB "); return 0; }
If the same header file is included twice in a C project, will it always cause an error, or can compilation still succeed? Choose the most accurate statement about multiple inclusion and header guards.
1
2