ProgrammingModerateWipro · Capgemini pattern

What is printed?

What is printed?
char s[20] = "Code";
strcat(s, "Hub");
printf("%zu", strlen(s));
  1. A. 20
  2. B. 4
  3. C. 7
  4. D. 8

Correct answer: C. 7

strcat appends "Hub" after "Code", giving "CodeHub" with 7 characters. strlen ignores the '\0' and the unused space of the 20-byte array.

More C Programming questions

Exams that ask this topic