wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Intro to Python Programming - Year 8

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is an algorithm?

a)

A programming language.

b)

A set of precise instructions to solve a problem.

c)

A tool to debug Python programs.

d)

A type of variable used in programs.

2.

What is needed to execute a Python program?

a)

A text editor.

b)

A Python interpreter.

c)

A debugger.

d)

An operating system.

3.

What will the following Python code output? print("Hello world!")

a)

Hello Python!

b)

Hello World

c)

Hello world!

d)

SyntaxError

4.

What is the purpose of the input() function in Python?

a)

To display a message on the screen.

b)

To receive input from the keyboard.

c)

To declare a variable.

d)

To fix syntax errors.

5.

What type of value is assigned in the following code? user = "Claude"

a)

Integer

b)

String

c)

Boolean

d)

Float

6.

What will the following code output if the user types "Titanic"? print("Best film ever?") film = input() print(film, "is my favourite too!")

a)

Best film ever? Titanic

b)

Best film ever? Titanic is my favourite too!

c)

Titanic is my favourite too!

d)

Titanic

7.

What is a syntax error in Python?

a)

When the program doesn’t produce the correct output.

b)

When Python code doesn’t follow the language’s rules.

c)

When the computer runs out of memory.

d)

When a variable is not assigned a value.

8.

What is the output of this Python code?

lucky = 13

print("My lucky number is", lucky)

a)

My lucky number is 13

b)

My lucky number is lucky

c)

SyntaxError

d)

My lucky number is

9.

What is the role of variables in Python?

a)

To create syntax errors.

b)

To store values that can be referenced and manipulated.

c)

To display messages to the user.

d)

To pause the program for input.

10.

What is a program?

a)

A set of precise instructions expressed in a programming language.

b)

A tool used to write code in Scratch.

c)

A set of rules for syntax.

d)

A debugging tool for algorithms.

11.

What happens if your Python program contains a syntax error?

a)

It runs with warnings.

b)

It executes but may produce incorrect results.

c)

It cannot be translated or executed.

d)

It pauses for user input.

12.

In Python, which of the following is a correct way to greet a user by name?

a)

print(Hello + user)

b)

print("Hello" + user)

c)

print("Hello", user)

d)

print("Hello" user)

13.

Which of the following is an example of an integer in Python?

a)

"42"

b)

42.0

c)

42

d)

"forty-two"

14.

What should you do when encountering a syntax error in Python?

a)

Ignore it and continue coding.

b)

Use the debugger to find and fix the issue.

c)

Restart the Python interpreter.

d)

Rewrite the program from scratch.

15.

What is the primary purpose of the print() function in Python?

a)

To perform arithmetic calculations.

b)

To display information on the screen.

c)

To declare variables.

d)

To fix logical errors.

16.

What are the quotation marks (" " or ' ') used for in Python?

a)

To indicate a variable name.

b)

To enclose string values.

c)

To comment out code.

d)

To fix syntax errors.

17.

What is the output of this code if the user inputs "Alice"?

print("What’s your name?")

user = input()

print("Hello", user)

a)

What’s your name? Alice

b)

Hello Alice

c)

What’s your name? Alice Hello Alice

d)

Hello

18.

Why can syntax errors be frustrating for beginners?

a)

They make programs run slowly.

b)

They prevent programs from running at all.

c)

They are impossible to fix.

d)

They only happen in Python.

19.

What is the main purpose of the input() function?

a)

To assign a value to a variable.

b)

To pause the program and wait for user input.

c)

To display a message on the screen.

d)

To handle syntax errors.

20.

What does the following code do?

user = input("Enter your name: ")

print("Welcome,", user)

a)

Displays Welcome, user.

b)

Prompts the user for their name and displays a greeting.

c)

Assigns the string "Enter your name: " to the variable user.

d)

Causes a syntax error.