C questions in placement tests and university exams are rarely about syntax alone. Most of what you will find here is output prediction, pointer arithmetic, arrays and strings, structures and unions, storage classes, recursion, and file handling. The explanations walk through memory behaviour step by step, which is usually where the confusion sits rather than in the code itself.
The ## operator concatenates two tokens into one. For example, #define CONCAT(a,b) a##b creates CONCAT(hello, world) → helloworld.
Q.282Easy
Which predefined macro gives the line number in the source file?
Answer: B
__LINE__ expands to the current line number. __FILE__ gives filename, __DATE__ gives compilation date, __STDC__ indicates C standard compliance.
Q.283Easy
Which header file contains the definition of NULL macro?
Answer: C
NULL is defined in multiple headers including <stdio.h>, <stdlib.h>, <stddef.h>, and others. Any of these can be included to use NULL.
Q.284Easy
What does #undef directive do?
Answer: A
#undef cancels the definition of a macro, allowing it to be redefined later. After #undef, the macro name becomes undefined.
Q.285Easy
In C99, which of the following is a valid use of token pasting operator (##)?
Answer: D
Both options A and B are valid. The ## operator pastes two tokens together. Whitespace around ## doesn't matter. #define CONCAT(a,b) a##b could be used as CONCAT(var, 1) to create var1.
Q.286Easy
Which header file is required to use assert() macro in C?
Answer: A
assert.h contains the assert() macro which is useful for debugging. It tests a condition and aborts the program if the condition is false. This macro is only active when NDEBUG is not defined.
Q.287Easy
What is the difference between #include <file.h> and #include "file.h"?
Answer: B
#include <file.h> searches in standard system include directories. #include "file.h" searches in the current working directory first, then system directories. This allows you to override system headers with local versions.
Q.288Easy
What happens when #if 0...#endif wraps a block of code?
Answer: B
#if 0...#endif is used to disable code during preprocessing. The enclosed code is skipped entirely and doesn't appear in the compiled output. This is more efficient than C-style comments for large blocks and maintains nested comment compatibility.
Q.289Easy
What is the purpose of defined() operator in preprocessor conditionals?
Answer: A
defined(MACRO) is used in #if and #elif directives to test if a macro is defined. Example: #if defined(DEBUG) ... #endif. It's equivalent to #ifdef but can be used in expressions with logical operators like && and ||.
Q.290Easy
What is the primary purpose of the C preprocessor?
Answer: A
The preprocessor is a text processing tool that processes source code before actual compilation, handling directives like #define, #include, and macros.
Q.291Easy
Which directive is used to conditionally compile code based on a logical condition?
Answer: B
#if evaluates constant expressions for conditional compilation. #ifdef checks if a macro is defined, #define creates macros, and #pragma provides compiler-specific directives.