CBSE · 083Class XII · 2025Section A1 mark

Question 03

4 March 2025 · Computer Science (083)

Identify the correct output of the following code snippet :

python
game="Olympic2024"
print(game.index("C"))

Answer

(d) ValueError

Explanation

The string contains lowercase 'c' but not uppercase 'C'. The index() method raises a ValueError if the substring is not found.