Difficulty: Easy
Correct Answer: 1 == 1 isTRUE
Explanation:
Introduction / Context:
The problem demonstrates two C features: (1) adjacent string literals are concatenated at compile time, and (2) the ternary operator chooses the appropriate string to print. It asks for the exact text produced, including spacing.
Given Data / Assumptions:
Concept / Approach:
Because k equals 1, the conditional expression selects "TRUE". The printf
therefore substitutes k for %d and "TRUE" for %s. There is no extra space inserted between "is" and the %s field—so the output joins them directly.
Step-by-Step Solution:
Concatenated format → "%d == 1 is%s\n".Substitute k = 1 and string "TRUE".Printed line → "1 == 1 isTRUE" followed by a newline.
Verification / Alternative check:
Adding a space inside the first literal (e.g., "is ") would yield "1 == 1 is TRUE"; however, the given code has no space.
Why Other Options Are Wrong:
Options with a space do not match the exact format. The false option contradicts k == 1. The one using a lowercase k misprints the literal text.
Common Pitfalls:
Assuming printf
inserts a space automatically; it does not. Spacing must be explicit in the format string.
Final Answer:
1 == 1 isTRUE
Discussion & Comments