Font size
WorksheetsCS Edexcel Unit 6 Parts 1-3
Total questions: 25
Worksheet time: 14mins
What is the purpose of the 'input' statement in Python?
To display a message to the user
To store a value in a variable
To ask the user for information
To terminate the program
What happens when a 'print()' statement is executed in Python?
The program waits for user input
The program displays a message and continues
The program stops execution
The program stores a value in a variable
Why does an 'input()' statement need a variable assigned to it?
To display a message
To allow the data to be used in the program
To terminate the program
To continue the program execution
The place where input data gets stored by the program
(a)
What is a 'string' in programming?
A variable
A data type consisting of keyboard characters
A function to print text
A data type consisting of whole numbers
What is a 'string' in programming?
A variable
A data type consisting of keyboard characters
A function to print text
A data type consisting of whole numbers
A string can contain...
Letters
Numbers
Symbols
Words
Dates
What happens if you don't use quotes around a string in a print() statement in Python?
The program will print the string as is
The program will output an error
The program will look for a variable with that name
The program will ignore the statement
What is the term for joining together strings and variables?
(a)
How can you join a string and a variable in a print() statement in Python?
Using the '-' operator
Using the '*' operator
Using the '+' operator
Using the '/' operator
What happens when using '+' compared to ',' to join strings and variables?
(a)
Why does this program output '55' instead of '10' when adding 5 and 5?
The program has a syntax error
The numbers are being added
The inputs are treated as strings
The program is using a subtraction operation
What data type is a whole number?
(a)
What is the purpose of the int() function in Python?
To convert a string to an integer
To convert an integer to a string
To convert a string to a float
To convert a float to a string
Which function is used to cast a string to a decimal number in Python?
int()
str()
float()
decimal()
Which operator in Python is used to perform integer division, returning the whole number part of the division?
/
//
%
**
What does the '%' operator in Python return when used in a division operation?
The whole number part of the division
The fractional part of the division
The remainder of the division
The square of the division
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?
2
3
4
5
If you use the '%' operator in Python with 10 sweets and 3 children, what is the remainder?
0
1
2
3
What is the purpose of selection in programming?
To execute the same lines of code repeatedly
To allow programs to take different pathways based on conditions
To store data in variables
To iterate over an array
How does an if-else statement work in programming?
It repeats a block of code a specific number of times
It evaluates a condition and executes different outcomes based on the evaluation
It stores multiple values in a single variable
It converts code into machine language
In this code snippet, what will be output?
The number equals 10
The number equals 5
The number doesn't equal 10
Nothing
In this code snippet, what will be output?
The number equals 10
The number equals 5
The number doesn't equal 10
Nothing
What is the purpose of using ELIF statements in programming?
To create infinite loops
To handle errors
To extend if-else statements for multiple conditions
To provide an exit when the condition is not true
Why is it important to use indentation in Python code?
To make the code run faster
To ensure the code is correctly evaluated
To save memory
To make the code look more organised
