Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

BCHS - Y8 Python

Total questions: 25

Worksheet time: 14mins

Name
Class
Date
1.

What will be the output of the Python code below when run?

print("Hello there!")

a)

Hello there!

b)

print("Hello there!")

c)

Hello there

d)

"Hello there!"

2.

What happens if you remove the quotes around "there" in the code?

print("Hello there")

a)

The code will not run because "there" will be treated as an undefined variable.

b)

The code will run without any issues.

c)

The output will include the word "there" without quotes.

d)

The code will print a syntax error message.

3.

What is the output of the code if you change the word 'there' to 'you'?

print("Hello there")

a)

Hello you

b)

Hello there

c)

Hello

d)

An error occurs

4.

What effect does changing the 'p' in 'print' to a capital 'P' have on the code?

a)

The code will run without any issues.

b)

The code will not run because Python is case-sensitive.

c)

The output will be capitalized.

d)

The output will change to a different font.

5.

What is the primary purpose of the Python program described below?

a)

To calculate mathematical equations

b)

To print the user's name on the screen

c)

To draw a picture

d)

To play a video

6.

What will be the output of the Python code if the user inputs the name "John"?

a)

Hello John

b)

Hello + John

c)

What is your name? John

d)

John Hello

7.

What does the Python function 'input()' do in the code?

a)

Displays a message

b)

Pauses the program and waits for the user to enter some text

c)

Adds "Hello" to the user's name

d)

Prints the user's name on the screen

8.

What happens if you change 'name =' to 'word =' in this Python program?

a)

The script will stop executing

b)

The variable 'word' will be used instead of 'name'

c)

The script will output an error message

d)

Nothing changes in the script

9.

What is the effect of putting quotes around a variable name in the print statement in Python?

a)

The variable's value is printed

b)

The name of the variable is printed

c)

An error occurs

d)

The print statement is ignored

10.

How can you modify a Python script to ask for and include both the user's first name and surname in the output?

a)

Use separate input() functions for each name

b)

Combine the names into one input()

c)

Use a list to store names

d)

It's not possible to modify

11.

What is a correct way to greet a user by name using Python?

a)

print("Hello" + name)

b)

print("Hello name")

c)

Print("Hello" name)

d)

print("Hello", "name")

12.

Which Python script correctly stores a user's name and age and then displays them?

a)

name = input(); age = input(); print(name, age)

b)

name, age = input(); print(name + age)

c)

name = input(); print(name); age = input(); print(age)

d)

input(name); input(age); print(name + age)

13.

What will be the output of the following Python code if the inputs are 3 and 5?

a)

A) 8

b)

B) 35

c)

C) 15

d)

D) Error

14.

What is the purpose of the 'input' function in the provided Python code?

a)

A) To display a message to the user

b)

B) To assign a value to a variable

c)

C) To take user input as a string

d)

D) To perform arithmetic operations

15.

What happens if you enclose both of the input statements with the int() function in Python?

a)

It converts the inputs to integers before any operations.

b)

It causes a syntax error.

c)

It ignores the input values.

d)

It outputs the inputs as strings.

16.

What is the primary function of the int() function in Python?

a)

It converts a string or a number to an integer.

b)

It checks if the input is an integer.

c)

It multiplies two integers.

d)

It divides two integers.

17.

What modification should be made to a Python code to multiply two inputted values instead of adding them?

a)

Replace the '+' operator with the '*' operator in the code.

b)

Change the int() function to str().

c)

Remove any mathematical operators.

d)

Enclose the operation in a print() function.

18.

What operation does the program perform that takes two inputs and displays this result?

a)

Multiplication

b)

Division

c)

Addition

d)

Subtraction

19.

What is the first step in writing a program to calculate the volume of water required to fill a pool?

a)

Output the volume

b)

Input the depth of the pool

c)

Input the length, width, and depth of the pool

d)

Calculate the area using a formula

20.

What will the Python code output if the user inputs "Good"?

a)

Sorry you're unhappy

b)

Great to hear it!

c)

No output

d)

Error

21.

What will the Python code output if the user inputs any string other than "Good"?

a)

Great to hear it!

b)

Sorry you're unhappy

c)

No output

d)

Error

22.

What should happen when a user modifies a code to ask for a number and enters '1'?

a)

The program should terminate.

b)

The program should ask for another input.

c)

The program should respond with a specific message.

d)

The program should display an error.

23.

What is expected to occur if the last two lines of a given code are removed?

a)

The code will not compile.

b)

The code will run indefinitely.

c)

The code will execute without any output.

d)

The code will execute the remaining commands normally.

24.

Match the following types of data used in Python programming

a)

String

1.

hello

b)

Integer

2.

300

c)

Boolean

3.

true

d)

Array

4.

[1, 2, 3]

e)

Float

5.

2.55

25.

Complete the code below

age = (a)   ("Please enter your age")