AmbifulWorksheets
Practice that never repeats
CBSE · Class 9 · Computational Thinking and AI

Algorithms and Flowcharts

Standard difficulty · 20 questions · 40 marks · Time: 39 minutes

Name: Date: Score: ____ / 40

Show your working for Sections B and C. Answers are on the last page — try every question first!

Section A — Choose the correct answer8 × 1 = 8 marks
1.
An algorithm is:
  1. a picture of data
  2. a list of random guesses
  3. a kind of computer
  4. a finite set of clear steps that solves a problem
2.
What does this algorithm print?
1. Start
2. Read N (N = 13)
3. Set S = 0 and I = 3
4. If I > N, go to step 7
5. Set S = S + I, then I = I + 4
6. Go to step 4
7. Print S
8. Stop
  1. 21
  2. 32
  3. 10
  4. 91
3.
How many times is step 5 carried out?
1. Start
2. Read N (N = 13)
3. Set S = 0 and I = 3
4. If I > N, go to step 7
5. Set S = S + I, then I = I + 1
6. Go to step 4
7. Print S
8. Stop
  1. 10
  2. 12
  3. 13
  4. 11
4.
In a flowchart, what does an oval show?
  1. start or stop
  2. the direction of flow
  3. input or output
  4. a decision with a yes or no answer
5.
What does this algorithm print?
1. Start
2. Read N (N = 27654)
3. Set R = 0
4. If N = 0, go to step 7
5. Set R = R × 10 + (last digit of N), then remove the last digit of N
6. Go to step 4
7. Print R
8. Stop
  1. 45,672
  2. 24
  3. 27,654
  4. 45,673
6.
What does this algorithm print?
1. Start
2. Read A, B, C (A = 96, B = 66, C = 82)
3. If A > B, set M = A; otherwise set M = B
4. If C > M, set M = C
5. Print M
6. Stop
  1. 97
  2. 66
  3. 96
  4. 82
7.
This algorithm should print 1 + 2 + … + N, but for N = 14 it prints 91 instead of 105. Which step is wrong?
1. Start
2. Read N (N = 14)
3. Set S = 0 and I = 1
4. If I ≥ N, go to step 7
5. Set S = S + I, then I = I + 1
6. Go to step 4
7. Print S
8. Stop
  1. step 7
  2. step 3
  3. step 5
  4. step 4
8.
What value of A is printed?
1. Start
2. Set A = 13 and B = 16
3. Set T = A
4. Set A = B
5. Set B = T
6. Set A = A + 8
7. Print A and B
8. Stop
  1. 16
  2. 21
  3. 24
  4. 13
Section B — Short answer8 × 2 = 16 marks
9.
What is the difference between an algorithm and a flowchart?
10.
What does this algorithm print?
1. Start
2. Read N (N = 66469)
3. Set R = 0
4. If N = 0, go to step 7
5. Set R = R + (last digit of N), then remove the last digit of N
6. Go to step 4
7. Print R
8. Stop
11.
How many times is step 4 carried out?
1. Start
2. Set N = 2468 and C = 0
3. If N = 0, go to step 5
4. Set N = whole part of N ÷ 2 and C = C + 1, then go to step 3
5. Print C
6. Stop
12.
Put the steps of an algorithm for charging a tablet in order. Write the letters in order.
(a) Find the charger
(b) Check that the charging sign appears
(c) Plug the charger into the socket
(d) Connect the cable to the tablet
(e) Switch on the socket
13.
Which flowchart symbol is used for (a) start or stop (b) a process, such as a calculation?
14.
What values of A and B are printed?
1. Start
2. Set A = 16 and B = 10
3. Set A = A + B
4. Set B = A − B
5. Set A = A − B
6. Set B = B × 2
7. Print A and B
8. Stop
15.
An algorithm multiplies by adding: it sets P = 0, then repeats “P = P + 25” 11 times. (a) What is P at the end? (b) How many additions are made?
16.
An algorithm reads four numbers one at a time and keeps the largest seen so far, starting with the first. For the input 86, 14, 92, 80, write the value it keeps after each number.
Section C — Word problems4 × 4 = 16 marks
17.
Write an algorithm and describe its flowchart for finding the sum of the first N natural numbers.
18.
Trace this algorithm.
1. Start
2. Read N (N = 10)
3. Set S = 0 and I = 1
4. If I > N, go to step 7
5. Set S = S + I, then I = I + 4
6. Go to step 4
7. Print S
8. Stop
(a) What is printed? (b) How many times is step 5 carried out? (c) What is the value of I when the algorithm stops?
19.
This algorithm should print 1 + 2 + … + N.
1. Start
2. Read N (N = 8)
3. Set S = 0 and I = 1
4. If I > N, go to step 7
5. Set S = S + I, then I = I + 2
6. Go to step 4
7. Print S
8. Stop
(a) What does it actually print for N = 8? (b) Which step number is wrong? (c) What should it print?
20.
An algorithm takes the last digit of N, adds it to a total S, and removes it from N, until N is 0. For N = 735744: (a) what is S at the end? (b) how many times does the loop run? (c) what is S after the first two passes?
AmbifulWorksheets
Practice that never repeats
CBSE · Class 9 · Computational Thinking and AI

Answer key

Algorithms and Flowcharts · AW-9CT-FLW-2026-V1 · For parents — fold back or tear off before handing the sheet to your child.

QAnswerWorking
1(d) a finite set of clear steps that solves a problem—
2(a) 213 + 7 + 11
3(d) 11I takes the values 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
4(a) start or stop—
5(a) 45,672the digits of 27654 in reverse
6(c) 96it keeps the larger value each time
7(d) step 4step 4 should be: If I > N, go to step 7
8(c) 24after the swap A = 16, B = 13; then A = 16 + 8
9An algorithm is the list of steps; a flowchart is a diagram that shows those steps with standard symbols and arrows.—
10316 + 6 + 4 + 6 + 9
11122468 halves to 0 in 12 steps
12a, c, d, e, bFind the charger → Plug the charger into the socket → Connect the cable to the tablet → Switch on the socket → Check that the charging sign appears
13(a) oval; (b) rectangleoval: start/stop; parallelogram: input/output; rectangle: process; diamond: decision
14A = 10, B = 32A = 26, B = 16, A = 10, then B = 16 × 2
15(a) 275; (b) 1125 added 11 times = 25 × 11
1686, 86, 92, 92compare each new number with the one kept
17Start; read N; set S = 0, I = 1; while I ≤ N, set S = S + I and I = I + 1; print S; stop. Flowchart: oval, parallelogram, rectangle, diamond with a loop back, parallelogram, oval.—
18(a) 15; (b) 3; (c) 13I: 1, 5, 9, then 13 > 10
19(a) 16; (b) 5; (c) 36step 5 should be: Set S = S + I, then I = I + 1
20(a) 30; (b) 6; (c) 8last digits first: 4, 4, 7, 5, 3, 7