ProgrammingVery hardProduct company OA
What is printed?
What is printed?
#define STR(x) #x
printf("%zu", strlen(STR( a + b )));- A. 5
- B. 15
- C. 11
- D. 3
Correct answer: A. 5
When an argument is stringised, leading and trailing white space is removed and each run of white space between tokens becomes one space. The result is "a + b", 5 characters. '3' drops all spaces; '11' keeps them as written.
More C Programming questions
- What is printed? c char g[3][4] = {"abc", "def", "ghi"}; for (int j = 0; j < 3; j++) putchar(g[2 - j][j]);
- A file report.txt already exists and holds data. What does fopen("report.txt", "w") do?
- The user types hello and presses Enter. After char buf[8]; fgets(buf, sizeof buf, stdin);, what does buf hold?
- The user types abcdefghij and presses Enter. What is strlen(buf) after char buf[8]; fgets(buf, sizeof buf, stdin);?
- After scanf("%d", &n); reads the input 42 followed by Enter, why does the next getchar() return 'n' instead of waiting for new input?
- What is printed? c int buf[4], head = 0, count = 0; for (int v = 1; v <= 6; v++) { buf[(head + count) % 4] = v; if (count < 4) count++…