Difficulty: Medium
Correct Answer: sundaytuesdayfridaysample
Explanation:
Introduction / Context:
This question examines indexing from the end of the argv array and how decrementing the index inside the print statement affects order. It also highlights that no spacing or newline is added by the given printf calls, so results appear concatenated.
Given Data / Assumptions:
Concept / Approach:
argv has elements argv[0]="sample", argv[1]="friday", argv[2]="tuesday", argv[3]="sunday". The code decrements the count first, then prints, so it begins from the last element and proceeds backward to 0, with no delimiters between prints.
Step-by-Step Solution:
Verification / Alternative check:
Adding a " " after %s would yield "sunday tuesday friday sample". Without that, it is contiguous.
Why Other Options Are Wrong:
Common Pitfalls:
Expecting spaces or newlines by default; printf("%s") does not add separators unless you include them.
Final Answer:
sundaytuesdayfridaysample
Discussion & Comments