PRACTICE • LEARN • GROW
Module 12: Advanced C Topics - Final Quiz MCQs
Solve topic-wise placement questions and improve your skills.
Module 12: Advanced C Topics - Final Quiz Progress
0 of 8 completed
0%
Topic Track
You are viewing MCQs in preview mode. Log in to select options, submit answers, and track your progress.
Log In to Answer
1
Which of the following is the correct syntax to declare a pointer
fp to a function that accepts two int arguments and returns an int?
A.
int *fp(int, int);
B.
int (*fp)(int, int);
C.
(int*) fp(int, int);
D.
int fp*(int, int);
Explanation & Key
Correct Answer:
2
What is the primary practical use case for an array of function pointers (jump table)?
A.
To allocate functions on the heap
B.
To dispatch state-machine or command handlers in O(1) time without long if-else or switch ladders
C.
To prevent stack overflow
D.
To encrypt code in the text segment
Explanation & Key
Correct Answer:
3
What bug can occur when passing an expression with side-effects into a macro?
#define SQUARE(x) ((x) * (x))
int a = 3;
int res = SQUARE(a++);
A.
Syntax error during compilation
B.
Undefined Behavior because
a++ is expanded twice in an unsequenced expression
C.
Calculates 9 cleanly
D.
Stack overflow
Explanation & Key
Correct Answer:
4
What is the primary function of "header guards" (
#ifndef, #define, #endif) in C header files?
A.
To restrict access to authorized users
B.
To prevent duplicate inclusion of the same header file across compilation translation units, avoiding multiple symbol redefinition errors
C.
To automatically compile header files to .o files
D.
To allocate static memory
Explanation & Key
Correct Answer:
5
What does the
volatile type qualifier tell the C optimizing compiler?
A.
That the variable must be stored in the fastest CPU register
B.
That the variable's value may change at any time outside the program's direct control (e.g. by hardware or an interrupt service routine), preventing the compiler from caching it in a register
C.
That the variable is constant and cannot be altered
D.
That the variable is allocated dynamically
Explanation & Key
Correct Answer:
6
Which header file must be included to utilize variable-length argument lists (such as in custom
printf-style functions)?
A.
<stdarg.h>
B.
<vararg.h>
C.
<stdlib.h>
D.
<stddef.h>
Explanation & Key
Correct Answer:
7
What is the role of the
inline function specifier in C99 and later?
A.
Forces the function to execute on a single thread
B.
Suggests to the compiler to replace the function call directly with the function's body code, eliminating call-overhead for small, critical functions
C.
Requires the function to be written in assembly
D.
Prevents recursion
Explanation & Key
Correct Answer:
8
In C preprocessor macros, what does the stringizing operator
# do when placed before a macro parameter (e.g. #x)?
A.
Calculates the length of the string
B.
Converts the literal argument tokens into a quoted string literal
C.
Concatenates two tokens together
D.
Includes an external header file
Explanation & Key
Correct Answer:
Question Palette
Answered
Current
Not Attempted
Wrong