CBSE Class 12 Computer Science
Question 5 of 44
Solved 2025 Sample Question Paper CBSE Class 12 Computer Science (083) — Question 5
Back to all questionsce lo
The code
message[-2::-2]starts from the second-last (-2) character of the string "World Peace", which is "c".It moves backwards in steps of 2 to select every second character going towards the start of the string.
The traversal goes as follows:
- Index -2: Character is "c".
- Index -4: Character is "e".
- Index -6: Character is a space (" ").
- Index -8: Character is "l".
- Index -10: Character is "o".
The output is "ce lo".