wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Year 8 Intro to Python Programming Quiz (NCCE Unit)

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

Q1: Read the Python program below:

When this program is executed, what will be displayed on the screen?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. "I live in", location

b)

B. "I live in", "Leeds"

c)

C. I live in location

d)

D. I live in Leeds

2.

Q2: When this program is executed, what will be displayed on the screen, as a result of executing line 3?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A.           I’ve never been to and whatever the user has typed at the keyboard

b)

B. I’ve never been to location

c)

C. I’ve never been to input()

d)

D. It is not possible to know the output without executing the program.

3.

Q3: Read the Python program below:

When this program is executed, what will be displayed on the screen?

Note: There may be errors in the program and/or it may not behave as expected.

a)

The Answer is 3 + 13 * 3

b)

The Answer is 42

c)

The Answer is 48

d)

The Answer is answer

4.

Q4. Read the Python program below:

a)

A. 13 42

b)

B. 42 13

c)

C. a b

d)

D. There is an error in the program because variables a and b are not assigned values in the right order.

5.

Q5. Read the Python program below:

a)

A. 13 42

b)

B. 42 13

c)

C. There is an error in the program because variables a and b are not assigned values in the right order.

d)

D. There is an error in the program because when line 1 is executed, variables a and b have not been assigned values.

6.

Q6. Read the Python program below:

a)

A. 13

b)

B. 42

c)

C. 13 42

d)

D. There is an error in the program because variable a cannot hold two values at the same time.

7.

Q7. Read the Python program below:

a)

A. 13 42

b)

B. 13 13

c)

C. 42 13

d)

D. 42 42

e)

E. There is an error in the program because when line 4 is executed, variable b no longer has a value.

8.

Q8. Read the Python program below:

When this program is executed, what will be displayed on the screen?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. 13 14

b)

B. 13 a+1

c)

C. a b

d)

D. There is an error in the program because when line 3 is executed, variable a no longer has a value.

9.

Q9. Read the Python program below:

When this program is executed, what will be displayed on the screen?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. 13

b)

B. 14

c)

C. 13 14

d)

D. There is an error in the program because there are no values for variable a that could be used in the equation in line 3.

10.

Q10. Read the Python program below:

When this program is executed, what will be displayed on the screen?

a)

A. 14

b)

B. 43

c)

C. 14 43

d)

D. There is an error in the program because variable b cannot hold two values at the same time.

11.

Q11. Read the Python program below:

When this program is executed, what will be displayed on the screen, as a result of executing line 3?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. 13

b)

B. 26

c)

C. 13 26

d)

D. Line 3 will not be executed because there is an error in line 2: print cannot display expressions such as 2*a.

12.

Q12. Read the Python program:

When this program is executed, what will be displayed on the screen, if the user enters Python at the prompt?

a)

A. You should try a little Python too

b)

B. Hello Pythonista

c)

C. You should try a little Python too

Hello Pythonista

d)

D. Hello Pythonista

You should try a little Python too

e)

E. There is an error in the program, because there should not be any quotes around "Python" in line 3.

13.

Q13. Read the Python program below:

When this program is executed, what will be displayed on the screen, if the user enters Python at the prompt?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. You should try a little Python too

b)

B. Hello Pythonista

c)

C. You should try a little Python too

Hello Pythonista

d)

D. Hello Pythonista

You should try a little Python too

e)

E. There is an error in the program, because there should not be any quotes around "Python" in line 3.

14.

Q14. Read the Python program below:

When this program is executed, what will be displayed on the screen, if the user enters Python at the prompt?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. You should try a little Python too

b)

B. Hello Pythonista

c)

C. You should try a little Python too

Hello Pythonista

d)

D. There is an error in the program, because there should be quotes around Python in line 3.

15.

Q15. Read the Python program below:

When this program is executed, what will be displayed on the screen, if the user enters Python at the prompt?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. You should try a little Python too

b)

B. Hello Pythonista

c)

C. You should try a little Python too

Hello Pythonista

d)

D. Nothing will be displayed on the screen

e)

E. There is an error in the program, because there is no else.

16.

Q16. Read the Python program below:

When this program is executed, what will be displayed on the screen if the user enters 0 at the prompt?

a)

A. 0 is positive

0 is negative

b)

B. 0 is positive

c)

C. 0 is negative

d)

D. The program will not display anything because 0 is neither positive nor negative.

17.

Q17. Read the Python program below:

When this program is executed, what will be displayed on the screen, if the user enters 0 at the prompt?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. 0 is zero

0 is non-zero

b)

B. 0 is zero

c)

C. 0 is non-zero

d)

D. There is a syntax error in the condition in line 3.

18.

Q18. Read the Python program below:

When this program is executed, what will be displayed on the screen, if the user enters 30 at the prompt?

a)

A. 30 minutes is 0.5 hours

b)

B. 30 minutes is less than an hour

c)

C. 30 minutes is less than an hour

30 minutes is 0.5 hours

d)

D. There is a syntax error in the condition in line 3.

19.

Q19. Read the Python program below:

When this program is executed, what will be displayed on the screen, if the user enters 90 at the prompt?

a)

A. 90 minutes is 1.5 hours

b)

B. 90 minutes is less than an hour

c)

C. 90 minutes is less than an hour

90 minutes is 1.5 hours

d)

D. There is a syntax error in the condition in line 3.

20.

Q20. Read the Python program below:

When this program is executed, what will be displayed on the screen, if the user enters 90 at the prompt?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. 90 minutes is 1.5 hours

b)

B. 90 minutes is less than an hour

c)

C. 90 minutes is less than an hour

90 minutes is 1.5 hours

d)

D. There is a syntax error in the condition in line 3.

21.

Q21. Read the Python program below:

When this program is executed, what will be displayed on the screen?

a)

A. Nothing will be displayed on the screen.

b)

B. zero

c)

C. 13

0

d)

D. 13

0

zero

22.

Q22. Read the Python program below:

When this program is executed, what will be displayed on the screen?

a)

A. Nothing will be displayed on the screen.

b)

B. 13

c)

A. 13

zero

d)

D. 13

zero

0

23.

Q23. Read the Python program below:

When this program is executed, what will be displayed on the screen?

a)

A. There is an error in the program because when line 1 is executed, variable number has not been assigned a value.

b)

B. Nothing will be displayed on the screen.

c)

C. 13

zero

d)

D. 13

zero

0

24.

Q24. Read the Python program below:

When this program is executed, what will be displayed on the screen?

a)

A. small

b)

B. medium

c)

C. medium

large

d)

D. large

25.

Q25. Read the Python program below:

When this program is executed, what will be displayed on the screen?

a)

A. small

b)

B. medium

c)

C. medium

large

d)

D. large

26.

Q26. Read the Python program below:

a)

A. None (the condition in line 2 will be False the first time it is checked)

b)

B. 1

c)

C. 3

d)

D. 4

e)

E. Infinitely (the condition in line 2 will never become False)

27.

Q27. Read the Python program below:

How many times will line 3 be executed?

Note: There may be errors in the program and/or it may not behave as expected.

a)

A. None (the condition in line 2 will be False the first time it is checked)

b)

B. 1

c)

C. 3

d)

D. 4

e)

E. Infinitely (the condition in line 2 will never become False)

28.

Q28. Read the Python program below:

How many times will line 3 be executed?

a)

A. None (the condition in line 2 will be False the first time it is checked)

b)

B. 1

c)

C. 3

d)

D. 4

e)

E. Infinitely (the condition in line 2 will never become False)

29.

Q29. Read the Python program below:

How many times will line 3 be executed?

a)

A. None (the condition in line 2 will be False the first time it is checked)

b)

B. 1

c)

C. 2

d)

D. 3

e)

E. Infinitely (the condition in line 2 will never become False)

30.

Q30. Read the Python program below:

How many times will line 4 be executed?

a)

A. None (the condition in line 2 will be False the first time it is checked)

b)

B. 1

c)

C. 10

d)

D. It is impossible to determine in advance

e)

E. Infinitely (the condition in line 2 will never become False)

31.

Q31. Read the Python program below:

When this program is executed, what will be displayed on the screen, as a result of executing line 5?

a)

A. 10

b)

B. 1

c)

C. It is impossible to determine in advance

d)

D. There is an error in the program, because line 5 should have been indented

32.

Q32. Read the Python program below:

When this program is executed, how many times will line 4 be executed?

a)

A. Line 4 will be executed once.

b)

B. Line 4 will be executed at least once.

c)

C. Line 4 will be executed 1357 times.

d)

D. Line 4 will be executed an infinite number of times (the while loop will never terminate).

33.

Q33. Read the Python program below:

When this program is executed, how many times will line 4 be executed?

a)

A. Line 4 will be executed once.

b)

B. Line 4 will be executed at least once.

c)

C. Line 4 will be executed 1357 times.

d)

D. Line 4 will be executed an infinite number of times (the while loop will never terminate).

34.

Q34. Read the Python program below:

When this program is executed, what will be displayed on the screen after line 6 is executed and the user types 1357 on the keyboard?

a)

A. Wrong pin, try again

b)

B. Wrong pin, try again

Welcome

c)

C. Welcome

d)

D. Wrong pin, try again

Enter pin

35.

Q35. A set of precise instructions that is meant to solve a problem is

a)

A. a computer

b)

B. an algorithm

c)

C. a program

d)

D. an interpreter

36.

Q36. The instructions in an algorithm .

a)

A. can be expressed in any language

b)

B. can be expressed in any language, as long as they are precise

c)

C. can only be expressed using a programming language

d)

D. can only be expressed using binary digits

37.

Q37. The instructions in an algorithm, when expressed precisely in English, _______

a)

A.          can only be carried out by humans

b)

B. can only be carried out by computers

c)

C. can be carried out by both humans and computers

38.

Q38. The instructions in a program, when expressed in Python, ___________-

a)

A. can only be carried out by humans, as long as they understand Python

b)

B. can only be carried out by computers

c)

C. can be carried out by computers, as long as an interpreter is available

d)

D. can be carried out by humans, as long as they understand Python, and computers, as long as an interpreter is available

39.

Q39. The instructions in a program __________

a)

A. can be expressed in any language

b)

B. can be expressed in any language, as long as they are precise

c)

C. can only be expressed using a programming language

d)

D. can only be expressed using binary digits

40.

Q40. A Python program requires _________ to be executed.

a)

A. a computer

b)

B. a program called ‘the Python translator’

c)

C. a program called ‘the Python interpreter’

d)

D. a program called ‘a development environment’