Font size
Worksheets2.2 Programming Fundamentals
Total questions: 86
Worksheet time: 46mins
Which of the following is NOT one of the three basic programming constructs used to control the flow of a program?
Sequence
Selection
Iteration
Declaration
What are the common Boolean operators mentioned in the programming fundamentals?
AND, OR, NOT
ADD, SUBTRACT, DIVIDE
TRUE, FALSE, MAYBE
IF, ELSE, WHILE
Which of the following is NOT a data type listed in the section on Data Types?
Integer
Real
Object
Boolean
Which of the following is NOT a basic file handling operation?
Open
Read
Write
Execute
What is used to store data in a structured way according to the learning material?
Arrays
Records
Functions
SQL
What is essential to produce structured code in programming?
Random number generation
Using SQL to search for data
Basic string manipulation
Using subprograms (functions and procedures)
What type of arrays are mentioned in the learning material for solving problems?
One dimensional arrays
Two dimensional arrays
Three dimensional arrays
Both one and two dimensional arrays
What is a variable in computer programming?
A data type used when storing alphanumeric characters and symbols.
A section of code that is repeated.
Used within a computer program to store a single piece of data. The contents can be changed.
Data which is entered into the computer program.
What does the term 'constant' refer to in computer programming?
A section of code that is repeated a specific number of times.
Data which is sent out by the computer program.
Used within a computer program to store a single piece of data. The data does not change within the program.
A data type used when storing alphanumeric characters and symbols.
What is an operator in the context of computer programming?
A data type used when storing alphanumeric characters and symbols.
Used within a program to represent an action, e.g., '+' which represents addition.
Data which is entered into the computer program.
A section of code that is repeated until a certain condition is met.
What is meant by 'iteration' in programming?
When a value is set/given to a variable.
When the code/instructions are all in order, so that one piece of code executes, followed by the next.
One of the three basic programming constructs, where a section of code is repeated.
When strings are brought together and combined.
What is 'string concatenation'?
When a string is altered or edited to suit the means of the program.
When strings are brought together and combined.
When a string is split at specific points, separating the single string into multiple strings.
A data type used when storing alphanumeric characters and symbols.
What is a Database used for?
To store data beyond whilst the program is not running
To store large amounts of data beyond whilst the program is running
To manage single pieces of data per data subject
To store multiple pieces of data in the same location
What does a Record refer to in a database?
A single column within a table
A single data subject within a table
The various categories for which data is collected
The language used to manage a database
What is the purpose of the SQL (Structured Query Language)?
To extract data from within a database
To store data beyond whilst the program is running
To store multiple pieces of data in the same location
To manage, maintain, and query a database
What is the difference between a Function and a Procedure in a sub-program?
A Function is used to pass data, while a Procedure is used to pass variables
A Function allows for the same piece of code to be used without repetition, while a Procedure does not
A Function is a sequence of instructions which return a value, while a Procedure is a sequence of instructions which do not return a value
A Function is a sequence of instructions which do not return a value, while a Procedure returns a value
What is a One Dimensional List used for in a program?
To store multiple pieces of data per data subject, identified using two indices
To store one piece of data per data subject, identified using a single index
To store large amounts of data beyond whilst the program is running
To extract data from within a database
Which SQL query element is used to determine from which table the data will be extracted?
SELECT
FROM
WHERE
SQL Query
What data type is used to store whole numbers?
Character
Boolean
Integer
Real/Float
Which data type is used to store numbers that require decimal places?
Integer
Character
Boolean
Real/Float
What does the Boolean data type store?
Single characters
Whole numbers
TRUE/FALSE values
Numbers with decimal places
What is the process of altering a variable's data type within a program called?
Arithmetic Operator
Casting
DIV
Random
What does the DIV operator find in a division operation?
The remainder of a division
The quotient of a division
The sum of two numbers
The product of two numbers
What does the MOD operator find in a division operation?
The quotient of a division
The sum of two numbers
The remainder of a division
The product of two numbers
Which operator is used to perform comparisons on data within a program that provides more focused results like AND, OR, NOT?
Arithmetic Operator
Casting
DIV
Boolean Operator
What is the function built into Python that allows for random choices to be made, used during random number generation?
Casting
Arithmetic Operator
Random
DIV
What is the main difference between a variable and a constant in a program?
A) A variable is used to store data that does not change, while a constant can change at any time.
B) A constant is used to store multiple pieces of data, while a variable is used for single pieces of data.
C) A variable is used to store data that can change at any time, while a constant does not change throughout the program.
D) There is no difference; both variable and constant can change at any time within the program.
What would likely be checked later in the program example provided to verify if the user has entered the correct credentials?
A) The program will check if the inputted_username and inputted_password are empty strings.
B) The program will check the inputted_username and inputted_password against the correct_username and correct_password.
C) The program will change the correct_username and correct_password based on user input.
D) The program will ask the user to input their username and password again.
What is the operator used for addition in Python programming?
%
/
+
//
Which operator is used for subtraction in Python programming?
*
-
%
//
In Python programming, what symbol is used for multiplication?
+
-
*
/
What is the operator for division in Python programming?
+
*
%
/
Which operator is used to find the modulus in Python programming?
%
/
+
*
What does the '//' operator represent in Python programming?
Addition
Modulus
Floor Division
Multiplication
What is the purpose of using input in a computer program?
To display a message to the user
To enter data into the program
To store data in a file
To print a message on the screen
Which command is used in Python to get user input?
input
get
read
What does the command print do in Python?
It reads data from the user
It saves data to a file
It outputs data to the screen
It inputs data from the screen
What will be the output of the Python code snippet shown in the image if the user enters the name "Alex"?
What symbol is used in Python to assign a value to a variable?
==
=
:=
+=
In Python, what will be the value of z after the following lines of code? x = 5 y = 10 z = x + y
15
5
10
20
What are the three main constructs used when producing a computer program?
Sequencing, Selection, Repetition
Sequencing, Functions, Variables
Input, Output, Looping
Data Types, Operators, Conditionals
What is sequencing in the context of programming?
The process of iterating over a block of code multiple times
The process of selecting different outcomes based on conditions
The process of ensuring all instructions are executed in order
The process of declaring and initializing variables
What is selection in the context of programming?
The process of iterating over a block of code multiple times
The process of selecting different outcomes based on conditions
The process of ensuring all instructions are executed in order
The process of declaring and initializing variables
What will the Python program print if the user inputs a temperature of -5?
It's mild, dress sensibly!
It's hot, get those shorts on!
Freezing! Get a thick coat on!
Error
What will the Python program print if the user inputs a temperature of 15?
It's mild, dress sensibly!
It's hot, get those shorts on!
Freezing! Get a thick coat on!
Error
What will the Python program print if the user inputs a temperature of 25?
It's mild, dress sensibly!
It's hot, get those shorts on!
Freezing! Get a thick coat on!
Error
Which Python keyword is used to utilize selection in the provided example?
for
while
if
def
What will the program output if the temperature input by the user is -3?
It's mild, dress sensibly!
Freezing! Get a thick coat on!
It's hot, get those shorts on!
No output will be displayed.
What must be true for the code under the first condition to execute?
The temperature must be greater than 0.
The temperature must be less than or equal to 0.
The temperature must be greater than or equal to 20.
The temperature must be between 0 and 20.
According to the text, how many elif conditions can you have in a program?
Only one
Exactly two
As many as needed
None, only if and else are allowed
What is the purpose of the else clause in the program?
To execute code if the temperature is less than 0.
To execute code if the temperature is between 0 and 20.
To execute code if none of the above conditions have been met.
To execute code if the temperature is greater than or equal to 20.
What is the output of the program if the temperature is 20?
It's mild, dress sensibly!
Freezing! Get a thick coat on!
It's hot, get those shorts on!
No output will be displayed.
What is iteration in the context of programming?
The process of debugging a section of code
The process of repeating a section of code
The process of compiling a section of code
The process of commenting a section of code
What is Count Controlled Iteration?
Code is repeated until a condition is met
Code is repeated a specific number of times, regardless of any condition
Code is repeated based on user input
Code is executed only once without repetition
What is Condition Controlled Iteration?
Code is repeated a specific number of times, regardless of any condition
Code is repeated until a condition is met, with no specific number of times
Code is executed only once without repetition
Code is repeated based on user input
What type of iteration is used in the Python example provided?
Infinite iteration
Count controlled iteration
Conditional iteration
Uncontrolled iteration
What does the Python program do when it is run?
It counts down from a number to zero.
It outputs all numbers from 0 to the user's number, excluding the user's number.
It outputs all numbers from 1 to the user's number, including the user's number.
It repeats a message a number of times.
Why is using a for loop in this Python program more efficient?
It allows the user to input the number only once.
It prevents the program from stopping unexpectedly.
It condenses the amount of code needed to repeat an action multiple times.
It makes the program run faster.
What important point should be remembered about the program's output?
The program includes the user's number in the output.
The program stops before reaching the user's number.
The program starts counting from the user's number.
The program asks the user to input the number twice.
What is the purpose of the while loop in the provided Python code example?
To calculate the sum of test scores
To repeat a block of code until a certain condition is met
To print the test score entered by the user
To generate random test scores between 0 and 50
What will happen if the user enters a test score of 51 in the provided Python code example?
The program will accept the score and move on to the next operation.
The program will terminate immediately.
The program will output "Invalid score entered" and prompt the user to re-enter a valid test score.
The program will calculate the average score.
Which of the following test scores would cause the while loop to terminate and proceed with the rest of the program in the provided Python code example?
-1
0
51
100
What is the term used to describe the type of iteration shown in the Python code example?
Infinite iteration
Condition controlled iteration
Unconditional iteration
Fixed iteration
What does a string refer to in Python?
A sequence of characters stored inside speech marks
A numerical value stored inside parentheses
A list of items separated by commas
A type of Python function
Which of the following variables is NOT a string based on the information provided?
string1
string2
not_a_string1
string3
What would be the result of storing data inside a variable without speech marks in Python?
It would be stored as a string.
It would be stored as an integer or cause a syntax error.
It would be ignored by Python.
It would automatically convert into a string.
What is string manipulation in Python?
Changing the integer values in a program
Editing or adapting a string to ensure it is in the required format
Storing variables inside speech marks
Creating lists of strings
What does string concatenation refer to in Python?
Multiplying two or more strings
Dividing one string by another
Bringing together two or more strings
Subtracting one string from another
Which operator is used for string concatenation in Python?
*
/
+
-
What will be the result of concatenating the strings '12', '06', and '1976' in the order provided?
1994
12061976
12+06+1976
An error message
What happens if you try to concatenate integers in Python using the '+' operator?
The integers will be concatenated as strings.
The integers will be multiplied.
The integers will be added together.
An error message will occur.
What function is used in Python to split a string into multiple strings?
A) .divide()
B) .separate()
C) .split()
D) .cut()
When splitting a string at specific characters in Python, what must you specify?
A) The variable to store the result
B) The length of the string
C) The character where the split should occur
D) The number of splits to perform
What will Python automatically store input as if you don't specify a data type?
A) An integer
B) A list
C) A string
D) A float
Which of the following is a way to store new strings after splitting them?
A) In a tuple
B) In a list or separate variables
C) In a dictionary
D) In a set
What is the purpose of splitting strings in the context provided in the image?
A) To concatenate strings
B) To make it easier for the user to input all their details in one entry
C) To convert strings to integers
D) To encrypt user data
What is the purpose of the split method in the context of the program described in the image?
To combine multiple strings into one
To divide a string into multiple parts based on a delimiter
To sort the characters in a string alphabetically
To replace certain characters in a string with others
What will be stored in the variable 'list_of_words' after executing the code snippet shown in the image?
A single string with the user's input
The user's input split into a list of numbers
The user's input split into a list of words
An error message
When splitting a string to store in variables, why must you specify the variable names?
Because the split method requires variable names to function
Because you need to know the exact number of parts the string will be split into
Because the split method cannot determine how many variables are needed
Because it is a syntax requirement of the programming language
What is the delimiter used in the code snippet to split the user's input into a list of words?
A comma
A semicolon
A space
A slash
What function is used to split a string into a list, based on a specified delimiter?
.join()
.append()
.split()
.strip()
What is the delimiter used in the .split function in the example provided?
A comma
A space
A period
A semicolon
After splitting the string "meow snooze plethora" using the .split function, how many strings are stored in the list?
1
2
3
4
What function is used to create a list from a string where each character of the string becomes an individual element in the list?
split()
join()
list()
map()
What is the purpose of splitting a word into its individual characters and storing them in a list, as described in the example?
To create a unique password
To count the number of characters in the word
To sort the characters alphabetically
To find duplicate characters
How can the list of individual characters be used during user login, as suggested in the text?
Users must enter the entire list of characters
Users must enter the word in reverse order
Users must enter specific characters from the list, such as the first, third, and eighth letters
Users must enter a random selection of characters from the list
