wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CS Edexcel Unit 6 Parts 1-3

Total questions: 25

Worksheet time: 14mins

Name
Class
Date
1.

What is the purpose of the 'input' statement in Python?

a)

To display a message to the user

b)

To store a value in a variable

c)

To ask the user for information

d)

To terminate the program

2.

What happens when a 'print()' statement is executed in Python?

a)

The program waits for user input

b)

The program displays a message and continues

c)

The program stops execution

d)

The program stores a value in a variable

3.

Why does an 'input()' statement need a variable assigned to it?

a)

To display a message

b)

To allow the data to be used in the program

c)

To terminate the program

d)

To continue the program execution

4.

The place where input data gets stored by the program

(a)  

5.

What is a 'string' in programming?

a)

A variable

b)

A data type consisting of keyboard characters

c)

A function to print text

d)

A data type consisting of whole numbers

6.

What is a 'string' in programming?

a)

A variable

b)

A data type consisting of keyboard characters

c)

A function to print text

d)

A data type consisting of whole numbers

7.

A string can contain...

a)

Letters

b)

Numbers

c)

Symbols

d)

Words

e)

Dates

8.

What happens if you don't use quotes around a string in a print() statement in Python?

a)

The program will print the string as is

b)

The program will output an error

c)

The program will look for a variable with that name

d)

The program will ignore the statement

9.

What is the term for joining together strings and variables?

(a)  

10.

How can you join a string and a variable in a print() statement in Python?

a)

Using the '-' operator

b)

Using the '*' operator

c)

Using the '+' operator

d)

Using the '/' operator

11.

What happens when using '+' compared to ',' to join strings and variables?

​ ​

​ ​ ​

(a)  

Choose from the below words
'+' will not leave a space ',' will leave a space
Neither '+' or ',' will leave a space
Both '+' and ',' will leave a space
'+' will leave a space ',' will not leave a space
12.

Why does this program output '55' instead of '10' when adding 5 and 5?

a)

The program has a syntax error

b)

The numbers are being added

c)

The inputs are treated as strings

d)

The program is using a subtraction operation

13.

What data type is a whole number?

(a)  

14.

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

a)

To convert a string to an integer

b)

To convert an integer to a string

c)

To convert a string to a float

d)

To convert a float to a string

15.

Which function is used to cast a string to a decimal number in Python?

a)

int()

b)

str()

c)

float()

d)

decimal()

16.

Which operator in Python is used to perform integer division, returning the whole number part of the division?

a)

/

b)

//

c)

%

d)

**

17.

What does the '%' operator in Python return when used in a division operation?

a)

The whole number part of the division

b)

The fractional part of the division

c)

The remainder of the division

d)

The square of the division

18.

In the example given, if you have 10 sweets and divide them among 3 children using the '//' operator, how many sweets does each child get?

a)

2

b)

3

c)

4

d)

5

19.

If you use the '%' operator in Python with 10 sweets and 3 children, what is the remainder?

a)

0

b)

1

c)

2

d)

3

20.

What is the purpose of selection in programming?

a)

To execute the same lines of code repeatedly

b)

To allow programs to take different pathways based on conditions

c)

To store data in variables

d)

To iterate over an array

21.

How does an if-else statement work in programming?

a)

It repeats a block of code a specific number of times

b)

It evaluates a condition and executes different outcomes based on the evaluation

c)

It stores multiple values in a single variable

d)

It converts code into machine language

22.

In this code snippet, what will be output?

a)

The number equals 10

b)

The number equals 5

c)

The number doesn't equal 10

d)

Nothing

23.

In this code snippet, what will be output?

a)

The number equals 10

b)

The number equals 5

c)

The number doesn't equal 10

d)

Nothing

24.

What is the purpose of using ELIF statements in programming?

a)

To create infinite loops

b)

To handle errors

c)

To extend if-else statements for multiple conditions

d)

To provide an exit when the condition is not true

25.

Why is it important to use indentation in Python code?

a)

To make the code run faster

b)

To ensure the code is correctly evaluated

c)

To save memory

d)

To make the code look more organised