What will be the output of the following Python code?

ICSE Class 10 Robotics & AI PYQ · 2026 Paper · Section A

2(x)1 Mark · 2026 · Section A · 2026 Paper

What will be the output of the following Python code?

s = "Great Day"
print(s.count('a'))
print(s.startswith('g'))
Show SolutionHide Solution↓
2
False

In the string "Great Day":

  1. The statement s.count('a') counts the number of occurrences of lowercase 'a' in the string. It appears 2 times, hence the output is 2.

  2. The statement s.startswith('g') checks whether the string starts with lowercase 'g'. Since the string starts with uppercase 'G', it returns False as Python is case-sensitive.

Hence, the output is:

2
False
← Previous questionNext question →

Browse the free Robotics & AI sample bank