What will be the output of the Python code given below?

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

1(xx)1 Mark · 2026 · Section A · 2026 Paper

What will be the output of the Python code given below?

x = "BOARD EXAMINATION"
print(x[0:4:2])
Show SolutionHide Solution↓

BA

Reason — The string "BOARD EXAMINATION" is stored in variable x. Python uses 0-based indexing.

Index Table:

IndexCharacter
0B
1O
2A
3R
4D
5(space)
6E
7X
8A
9M
10I
11N
12A
13T
14I
15O
16N

The slice x[0:4:2] means:

  • Start from index 0
  • Go up to index 4 (excluded)
  • Take every 2nd character (step = 2)

So selected indices:
→ 0 → B
→ 2 → A

Thus, the output is BA.

← Previous questionNext question →

Browse the free Robotics & AI sample bank