ProgrammingHardTCS NQT · Accenture
What is printed?
What is printed?
#include <stdio.h>
int main(void) {
printf("%s", "ab" "cd");
}- A. ab
- B. cd
- C. abcd
- D. abcdab
Correct answer: C. abcd
Adjacent string literals are concatenated during translation, so the argument is the single string abcd.
More C Programming questions
- What is printed? Assume unsigned int is 32 bits. c #include <stdio.h> int main(void) { printf("%u", 1 ? -1 : 0u); }
- How many partitions of 6 into distinct parts are there? The recursion below counts them. What is printed? c #include <stdio.h> int dp(int…
- How many ways are there to tile a 1 by 4 strip with 1 by 1 and 1 by 2 tiles? The recursion computes it. What is printed? c #include…
- What is printed? The program computes the parity of the set bits of 0b1101. c #include <stdio.h> int parity(unsigned x) { return x == 0 ?…
- What is the position of the lowest set bit of 0x0300 (counting bit 0 as position 0)? Compute with this program. c #include <stdio.h> int…
- What is printed? The program inverts the Gray code 6 by XOR-folding its bits. c #include <stdio.h> int main(void) { unsigned g = 6, n = 0…