Which header must be included to use printf, scanf, and FILE* operations in standard C?
Cpp Cla Environment
Question · Easy
What does the following C program print? #include <stdio.h> int main(void) { int x = 5, y = 2; printf("%d %d\n", x / y, x % y); return 0; }
Cpp Cla Data Operations
Which statement about C identifiers is TRUE?
Cpp Cla Language Elements
Tech Exam Prep Podcast
Listen on Spotify
Podcast
Which of the following is NOT a C reserved keyword?
Question · Medium
What is the size in bytes of `char` in standard C?
Which of the following correctly declares an integer constant `MAX` with the value 100?
What does the following snippet print? #include <stdio.h> int main(void) { int a = 10; int *p = &a; printf("%d %d\n", *p, *p + 1); return 0; }
Which standard library function returns the length of a null-terminated C string, NOT counting the terminating '\0'?
What does the following program print? #include <stdio.h> int main(void) { int arr[5] = {1, 2, 3}; printf("%d %d\n", arr[3], arr[4]); return 0; }
Which loop is GUARANTEED to execute its body at least once?
Cpp Cla Control Flow
What does this snippet print? #include <stdio.h> int main(void) { int i = 5; int j = i++; int k = ++i; printf("%d %d %d\n", i, j, k); return 0; }
Which preprocessor directive prevents a header file from being included more than once in the same translation unit?
Given `int arr[10];`, which expression is equivalent to `arr[3]`?
What does this program print? #include <stdio.h> void f(int x) { x = 99; } int main(void) { int a = 1; f(a); printf("%d\n", a); return 0; }
Which function correctly modifies the caller's int variable?
What does the following expression evaluate to? sizeof('A')
Question · Hard
Which conversion specifier is correct for printing an `unsigned int` with printf?
What does the following snippet print? #include <stdio.h> int main(void) { int a = 8; int b = 3; printf("%d %d\n", a & b, a | b); return 0; }
What does `1 << 3` evaluate to in C, assuming int is at least 16 bits?
What does this program print? #include <stdio.h> int main(void) { int n = 4; switch (n) { case 1: printf("one "); case 4: printf("four "); case 5: printf("five "); break; default: printf("other "); } return 0; }
Which storage class causes a local variable to retain its value between successive calls of the same function?
What does this snippet print after two calls? #include <stdio.h> void count(void) { static int n = 0; n++; printf("%d ", n); } int main(void) { count(); count(); return 0; }
Which statement about `extern` in C is correct?
Which function correctly allocates an array of 10 ints initialized to zero?
Which statement about `free()` is TRUE?
What is the result of `realloc(NULL, 100)` in standard C?
What does this snippet print? #include <stdio.h> #include <string.h> int main(void) { char s[] = "hello"; printf("%zu %zu\n", strlen(s), sizeof(s)); return 0; }
Which statement about strncpy is TRUE?
Which function searches for the first occurrence of a substring in a null-terminated string?
Given `char s[] = "a,b,c"; char *t = strtok(s, ",");`, what does t point to and what does the original buffer look like after the call?
What does the following printf produce? printf("%5d\n", 42);
Which scanf usage safely reads a string into a char buffer of size 32 from stdin?
Which struct definition is valid C and creates a type alias `Point` so you can write `Point p;` directly?
Given `struct Point { int x; int y; }; struct Point *p = malloc(sizeof *p);`, which is the correct way to set p's x to 5?
Which statement about C unions is TRUE?
What is the value of c after this code runs? enum Color { RED, GREEN, BLUE = 5, YELLOW }; enum Color c = YELLOW;
Which statement about `typedef` in C is TRUE?
Which declaration creates a function pointer that can hold the address of `int cmp(const void *a, const void *b)`?
Which standard library function performs a quicksort on an array given a comparator function pointer?
Which fopen mode opens a file for reading and writing, truncating any existing content?
What does fopen return on failure?
Which combination correctly reads a file named "data.bin" into a buffer of 100 ints?
Which function moves the file position indicator to a specified offset from a reference point?
What does this declaration mean? int *const p = &x;
What does this snippet print? #include <stdio.h> int main(void) { int arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; int (*p)[3] = arr; printf("%d\n", p[1][2]); return 0; }
Which prototype correctly accepts a 2D array of ints with 4 columns and any number of rows?
What is the value of x after this expression? int x = 1 + 2 * 3 - 4;
Loading more…