Difficulty: Easy
Correct Answer: K
Explanation:
Introduction / Context:
printf uses a format string to control how subsequent arguments are printed. With the "%s" format, printf expects a pointer to a null-terminated string. This question checks whether you can trace a simple printf call passing a one-character string with a newline.
Given Data / Assumptions:
Concept / Approach:
The "%s" format prints characters from the provided char until the terminating '\0'. Therefore, the two characters 'K' and '\n' are emitted. Many MCQs capture the visible part (“K”) and ignore that a newline follows; here the important visual output is the letter K followed by a line break.
Step-by-Step Solution:
Verification / Alternative check:
Change the literal to "K" (no newline) to see the cursor remain on the same line.
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting the newline is part of the literal; misreading the format string as a literal to be printed rather than a directive.
Final Answer:
K.
Discussion & Comments