What is printed by this C code: struct { unsigned f : 2; } s; s.f = 7; printf(“%u”, s.f);?
Correct answer D. 3
Subject / 929 questions
Page 2 of Programming multiple-choice questions with answers. Tap an option to check yourself.
Page 2 of 47
Correct answer D. 3
Correct answer D. A null pointer
Correct answer D. It is freed automatically after its contents are copied
Correct answer C. If realloc fails it returns NULL, overwriting p and leaking the original block
Correct answer D. Nothing; the call has no effect
Correct answer A. 5
Correct answer D. malloc(10 * sizeof(double))
Correct answer C. 11
Correct answer B. a + b
Correct answer D. It joins two tokens into a single token
Correct answer A. __LINE__
Correct answer B. To stop the header's contents being processed more than once in a translation unit
Correct answer A. Opens it for writing at the end, creating the file if it does not exist
Correct answer C. "w+"
Correct answer D. It reads at most n - 1 characters, keeps the newline if read, and adds a null terminator
Correct answer B. So that EOF, a negative int, can be told apart from every valid character
Correct answer C. 3
Correct answer B. 0
Correct answer D. 240
Correct answer C. (x >> n) & 1