Lists and strings: practice questions
Class 10 Computer Science. Ten questions with step-by-step answers, for CBSE and ICSE. Try each one before you open its answer.
Key ideas
- Indexing and slicing.
- First item has index 0
- xs[a:b] gives items from index a up to, but not including, b. Strings slice the same way: "gradient"[0:4] is "grad".
- A for loop visits each item in turn. Use it to add, count or search.
- These are the multi-step questions examiners like to set. Read each one twice, write down what you know, then plan before you calculate.
- These go beyond the syllabus. Each one has a neat idea that makes it short; brute force is slow.
Read each question twice and say the answer out loud before you check it. For code or binary questions, work it out on paper step by step, the way a computer would.
Ten questions
1.xs = [19, 27, 13, 28, 27, 4] print(xs[-3])
Show the answer
Think: Count from 0.
Work: Indexes start at 0; −1 is the last item.
Answer: 28
2.What does this print? x = 6 y = 9 print(x * y + 1)
Show the answer
Think: // is whole-number division, % is the remainder.
Work: Run it line by line.
Answer: 55
3.xs = [22, 26, 4, 22, 29, 12] print(xs[-2])
Show the answer
Think: Count from 0.
Work: Indexes start at 0; −1 is the last item.
Answer: 29
4.What does this print? x = 6 y = 3 print(x * y + 1)
Show the answer
Think: // is whole-number division, % is the remainder.
Work: Run it line by line.
Answer: 19
5.xs = [25, 26, 24, 25, 17, 23] print(xs[5])
Show the answer
Think: Count from 0.
Work: Indexes start at 0; −1 is the last item.
Answer: 23
6.What does this print? print(6 // 3)
Show the answer
Think: // is whole-number division, % is the remainder.
Work: Run it line by line.
Answer: 2
7.xs = [29, 8, 2, 10, 19, 24] print(xs[-2])
Show the answer
Think: Count from 0.
Work: Indexes start at 0; −1 is the last item.
Answer: 19
8.What does this print? print(29 % 7)
Show the answer
Think: // is whole-number division, % is the remainder.
Work: Run it line by line.
Answer: 1
9.xs = [19, 22, 14, 16, 30, 16] print(xs[4])
Show the answer
Think: Count from 0.
Work: Indexes start at 0; −1 is the last item.
Answer: 30
10.What does this print? x = 7 x = x + 9 print(x)
Show the answer
Think: // is whole-number division, % is the remainder.
Work: Run it line by line.
Answer: 16
Before you check an answer
- Count from 0.
- // is whole-number division, % is the remainder.
Questions students ask
- What does Lists and strings in Class 10 Computer Science cover?
- Indexing and slicing. First item has index 0 xs[a:b] gives items from index a up to, but not including, b. Strings slice the same way: "gradient"[0:4] is "grad".
- How should I practise Lists and strings?
- Read each question twice and say the answer out loud before you check it. For code or binary questions, work it out on paper step by step, the way a computer would. Try all ten questions on this page, then open the chapter in Gradient tuition for step-by-step lessons, a live experiment and an AI tutor who explains where you went wrong.
- Is this for CBSE or ICSE?
- The questions follow the Class 10 Computer Science syllabus shared by CBSE and ICSE / ISC, and suit most state boards too.
Stuck on one of these?
Gradient tuition teaches Lists and strings step by step, with experiments you can play with and an AI tutor who circles the part of the question you missed.
Open Lists and strings in tuition