💻 Coding and Computational Thinking
Master the fundamentals of writing, reading, and modifying code with nested loops and events. This quiz covers sequential logic, conditionals, input handling, and computational problem-solving aligned with Ontario Grade 7 mathematics standards. **What you'll learn:** - How to read and understand code with nested loops and conditionals - How sequential logic and order of operations affect code output - How to trace through code and predict results - How to use input to solve simple computational problems - How conditionals and loops work together to control program flow
Questions in this quiz
Answers hidden — play to find out.
- Question 1
Look at the following code that calculates the sum of numbers from 1 to . What is the final value of
totalwhen ? - Question 2
Which of the following best describes the purpose of a conditional statement (if/else) in a program?
- Question 3
In a nested loop, the inner loop completes all of its iterations before the outer loop advances to its next iteration.
- Question 4
Look at the following code. How many times does the inner loop execute in total?
- Question 5
What is the output of the following code?
- Question 6
A program reads a student's test score and prints 'Pass' if the score is 60 or higher, otherwise 'Fail'. Which code segment correctly implements this logic?
- Question 7
In the sequence of code execution, statements are always executed one at a time from top to bottom unless a loop or conditional changes that order.
- Question 8
Look at the following code. What value does
resulthave after execution? - Question 9
Which statement best explains what 'tracing through code' means?
- Question 10
Look at the following code. What is printed?
- Question 11
A program needs to check if a number is even. Which condition correctly identifies an even number?
- Question 12
A loop can contain another loop inside it, but a conditional statement cannot contain a loop.
- Question 13
Look at the following code. What does it print?
- Question 14
A program receives a user's age as input and must determine if they are eligible to vote (18 or older). What is the correct comparison operator to use?
- Question 15
The order of operations in code is always the same regardless of whether parentheses are used.
- Question 16
Look at the following code that counts how many times a certain condition is met. What is the value of
counterat the end? - Question 17
Which of the following best describes the benefit of using a loop in a program?