ProgrammingHardGATE CS · Campus placements
uint32_t value = (uint32_t)-1; printf("%d", value == 0xFFFFFFFFu); What is printed?
- A. 1
- B. 0
- C. compile error
- D. undefined
Correct answer: A. 1
-1 converted to uint32_t is 2^32 - 1, which equals 0xFFFFFFFF. The comparison is true and prints 1.
More C Programming questions
- How many index pairs i < j in the array {3, 5, 3, 5, 7} satisfy a[i] XOR a[j] == 0?
- How many integers from 1 to 30 are multiples of 8?
- A circular buffer of size n = 5 steps back from index 0 with (idx + n - 1) % n. What index results?
- A qsort comparator orders the elements in descending order. After sorting {5, 9, 2}, what is the first element?
- uint32t x = 491u; What is (x >> 3) & 7? (491 is 0x1EB.)
- uint32t r = 2147483648u % 1000u; What is r?