ProgrammingHardTCS NQT · Accenture
What is printed? Assume double is 8 bytes.
What is printed? Assume double is 8 bytes.
#include <stdio.h>
int main(void) {
printf("%zu", sizeof(1 ? 'a' : 1.0));
}- A. 8
- B. 4
- C. 1
- D. 16
Correct answer: A. 8
In the conditional, 'a' and 1.0 undergo the usual arithmetic conversions, so the result type is double, which is 8 bytes.
More C Programming questions
- What is printed? c #include <stdio.h> #include <stdlib.h> #include <string.h> int cmp(const void a, const void b) { return strcmp((const…
- What index is printed when bsearch looks up "cat" in the sorted array {"ant", "bee", "cat", "dog"}? c #include <stdio.h> #include…
- How many ordered ways are there to write 10 as a sum of 1s, 2s and 3s? Compute with this program. c #include <stdio.h> int f(int n) { if…
- What is printed? c #include <stdio.h> int main(void) { unsigned n = 44; while (n & (n - 1)) n &= n - 1; printf("%u", n); }
- What is printed? c #include <stdio.h> int main(void) { unsigned n = 0; printf("%d", (n & (n - 1)) == 0); }
- What is printed? Assume uint32t is 32 bits. c #include <stdint.h> #include <stdio.h> int main(void) { uint32t h = 2166136261u; h ^=…