Which header from the C standard library must be included to call printf in a portable C program?
Cpp Cle Basic Concepts
Question · Easy
In the standard C compilation pipeline, which tool processes #include and #define directives before the compiler proper sees the source code?
Which gcc command compiles main.c into an object file without invoking the linker?
Tech Exam Prep Podcast
Listen on Spotify
Podcast
Which statement about the entry point of a hosted C program is correct?
Which of the following is a valid single-line comment in C99 or later?
Which form of #include is conventionally used for headers shipped with the C standard library?
Which identifier is INVALID in standard C?
What does the following macro produce when called as SQUARE(2 + 3)? #define SQUARE(x) x * x
Question · Medium
Which preprocessor pattern is the traditional include guard for a header file?
What is the role of the linker in a typical C build?
Which statement about C source files and translation units is correct?
Given the program below, which statement about its return value is correct? #include <stdio.h> int main(void) { printf("hello\n"); }
Which item is NOT a C reserved keyword?
Which type from <stdint.h> is guaranteed to be exactly 32 bits wide and signed on every conforming implementation that provides it?
Cpp Cle Data Types Evaluations Io
What does the following code print? #include <stdio.h> int main(void) { int a = 7, b = 2; double r = (double)a / b; printf("%.2f\n", r); return 0; }
Which printf conversion specifier should be used to print an unsigned long value?
Which type should be used to hold the result of sizeof or the length of an array index across portable C?
Which statement about char in standard C is TRUE?
What is printed by the following program? #include <stdio.h> int main(void) { char c = 'A'; printf("%d\n", c); return 0; }
Which header is required to use the bool type and the macros true and false in C?
Which scanf call correctly reads an int into the variable n declared as int n;?
What is the result of the expression sizeof('A') in standard C (not C++)?
Question · Hard
Which of the following is a valid floating-point literal of type double?
What value does the expression 5 / 2 + 5 % 2 evaluate to in C, where both operands are int literals?
Which conversion specifier should printf use to print a void pointer value safely?
Which printf format specifier reads a long long integer correctly with scanf in C99 and later?
What does the expression 1 << 3 evaluate to in C?
Cpp Cle Arithmetic Logical Bitwise Operators
What does the expression 1 && 0 || 1 evaluate to in C?
Given int x = 10; what is x after the statement x += 5 * 2;?
Which expression uses short-circuit evaluation to safely test whether a pointer p references a non-zero int?
What is the value of the expression ~0 stored in an unsigned int on a typical platform with 32-bit int?
What does the postfix expression i++ do in C?
Which expression correctly checks whether the third bit (mask 0x4) of an int flags is set?
Which expression uses the conditional (ternary) operator to return the larger of two ints a and b?
Given int x = 4, y = 5; what does the expression (x = y, x + 1) evaluate to, and what is x afterward?
What does the expression (int)3.7 evaluate to in standard C?
What does the following code print, considering operator precedence? int a = 2 + 3 * 4; printf("%d\n", a);
What does the following snippet print? int x = 10; if (x = 0) { printf("true\n"); } else { printf("false\n"); } printf("%d\n", x);
Cpp Cle Decision Making Statements
Which control statement is best suited to dispatching among many integer constant cases in C?
What does this switch print when n is 2? switch (n) { case 1: printf("one\n"); case 2: printf("two\n"); case 3: printf("three\n"); default: printf("other\n"); }
Which type may a switch statement's controlling expression have in standard C?
What is the output of this program for the input value n = -3? if (n > 0) printf("positive\n"); else if (n < 0) printf("negative\n"); else printf("zero\n");
Which statement about the dangling else in nested if statements is correct in C?
Which value is treated as FALSE in C, causing the body of an if statement to be skipped?
In a switch statement, which keyword exits the switch immediately and prevents fall-through to the next case?
Which condition correctly tests whether int x is in the inclusive range [10, 20] in C?
Why might MISRA-C and similar style guides recommend always using braces around if/else bodies in C?
Loading more…