Question 26Asked in Bihar STET 2025 Paper II Computer Science, 7 Nov 2025, Shift 1 (9:00 AM)

Identify the correct output of the following code snippet : game="olympic2024"निम्‍नलिखित कोड स्निपेट (Code Snippet) का सही आउटपुट (Out put) बताइये :

Identify the correct output of the following code snippet : game="olympic2024" print (game. index ("C") )
निम्‍नलिखित कोड स्निपेट (Code Snippet) का सही आउटपुट (Out put) बताइये : game="olympic2024" Print (game. Index ("C") )
  1. A00
  2. B66
  3. C-1-1
  4. DvalueErrorvalueError
Show answerHide answer

Correct answer: (D) valueErrorvalueError

Explanation

str.index() raises ValueError when the substring is not found. "olympic2024" contains a lowercase "c" but no uppercase "C", so the code raises ValueError. find() would return -1 instead.str.index() सबस्ट्रिंग न मिलने पर ValueError उठाता है। "olympic2024" में छोटा "c" है पर बड़ा "C" नहीं, इसलिए कोड ValueError उठाता है। find() इसके बजाय -1 लौटाता।

From Bihar STET 2025 Paper II Computer Science PYQ, 7 Nov 2025, Shift 1 (9:00 AM)

This is question 26 of Bihar STET 2025 Paper II Computer Science PYQ, 7 Nov 2025, Shift 1 (9:00 AM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.