Grade 9 · Computer science
Grade 9 Algorithms & logic worksheet
20 questions on algorithms & logic. The answer key is a separate download.
What is on the worksheet
Start with total = 68. Repeat 35 times: add 9 to total. What is the final total?
Start with total = 28. Repeat 14 times: add 5 to total. What is the final total?
FOR i FROM 4 TO 112 INCLUSIVE STEP 6: print i. How many numbers are printed?
An outer loop runs 28 times. Each time, an inner loop prints once on each of 19 iterations. How many prints occur?
Using zero-based indexing, what is values[4] for values = [54, 36, 65, 97, 45]?
Using zero-based indexing, what is values[3] for values = [80, 68, 38, 97, 34]?
Using zero-based indexing, what is values[2] for values = [66, 79, 93, 27, 60]?
Convert the binary number 110010011 to decimal.
FOR i FROM 11 TO 235 INCLUSIVE STEP 8: print i. How many numbers are printed?
FOR i FROM 3 TO 95 INCLUSIVE STEP 4: print i. How many numbers are printed?
FOR i FROM 14 TO 122 INCLUSIVE STEP 4: print i. How many numbers are printed?
FOR i FROM 2 TO 58 INCLUSIVE STEP 2: print i. How many numbers are printed?
Start with total = 15. Repeat 18 times: add 12 to total. What is the final total?
Start with total = 5. Repeat 28 times: add 19 to total. What is the final total?
FOR i FROM 10 TO 66 INCLUSIVE STEP 4: print i. How many numbers are printed?
Using zero-based indexing, what is values[2] for values = [49, 64, 19, 87, 41]?
An outer loop runs 24 times. Each time, an inner loop prints once on each of 18 iterations. How many prints occur?
FOR i FROM 13 TO 132 INCLUSIVE STEP 7: print i. How many numbers are printed?
Start with total = 41. Repeat 37 times: add 2 to total. What is the final total?
Convert the binary number 10000 to decimal.
More worksheets like this
Grade 5 Computer science practice
20 questions
Grade 5 Algorithms & logic worksheet
20 questions
Grade 5 Digital literacy worksheet
20 questions
Grade 6 Computer science practice
20 questions
Grade 6 Algorithms & logic worksheet
20 questions
Grade 6 Digital literacy worksheet
20 questions