Year 8
Lesson details
Key learning points
- In this lesson, we will extend and improve a guess the number game. This will consolidate the learning that has taken place in this unit of work.
Licence
This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.
Loading...
3 Questions
Q1.
How many times will line 3 be executed?
1
4
Infinitely (the condition in line 2 will never become False)
None (the condition in line 2 will be False the first time it is checked)
Q2.
How many times will line 3 be executed?
1
3
4
None (the condition in line 2 will be False the first time it is checked)
Q3.
How many times will line 3 be executed?
1
3
Infinitely (the condition in line 2 will never become False)
None (the condition in line 2 will be False the first time it is checked)
10 Questions
Q1.
When this program is executed, what will be displayed on the screen if the user enters 0 at the prompt?
0 is positive
Option 1
The program will not display anything because 0 is neither positive nor negative.
Q2.
When this program is executed, what will be displayed on the screen, if the user enters 0 at the prompt?
0 is non-zero
0 is zero
0 is zero, 0 is non-zero
Q3.
When this program is executed, what will be displayed on the screen, if the user enters 30 at the prompt?
30 minutes is 0.5 hours
30 minutes is less than an hour, 30 minutes is 0.5 hours
There is a syntax error in the condition in line 3.
Q4.
When this program is executed, what will be displayed on the screen, if the user enters 90 at the prompt?
90 minutes is less than an hour
90 minutes is less than an hour, 90 minutes is 1.5 hours
There is a syntax error in the condition in line 3.
Q5.
When this program is executed, what will be displayed on the screen, if the user enters 90 at the prompt?
90 minutes is 1.5 hours
90 minutes is less than an hour, 90 minutes is 1.5 hours
There is a syntax error in the condition in line 3.
Q6.
When this program is executed, what will be displayed on the screen?
large
medium, large
small
Q7.
How many times will line 4 be executed?
1
10
Infinitely (the condition in line 2 will never become False)
None (the condition in line 2 will be False the first time it is checked)
Q8.
When this program is executed, what will be displayed on the screen, as a result of executing line 5?
1
It is impossible to determine in advance
There is an error in the program, because line 5 should have been indented
Q9.
When this program is executed, how many times will line 4 be executed?
Line 4 will be executed 1357 times.
Line 4 will be executed an infinite number of times (the while loop will never terminate).
Line 4 will be executed once.
Q10.
When this program is executed, how many times will line 4 be executed?
Line 4 will be executed 1357 times.
Line 4 will be executed at least once.
Line 4 will be executed once.