Worksheets2.2 Programming
Total questions: 55
Worksheet time: 29mins
The following is not true about variable names ?
They should be descriptive
They must be in capital letters
They can’t start with numbers or contain spaces
They point to memory locations
In an assignment operation, what appears on the right hand side ?
Variable identifier / name
The assignment operator (=)
data to be assigned
Which of the following is not a valid data type?
Real
String
Character
Fraction
Quotation marks around data implies the data type is?
an integer
a string
a Boolean
a real
This variable type can only have True or False values
Boolean
Integer
String
Character
Casting refers to
joining two strings together
Converting one data type to another
The operator used to divide and returns a INTEGER answer is?
DIV (//)
MOD (%)
Division (/)
**
The main difference between a procedure & a functions is
Functions return values, procedures don’t.
Functions use parameter passing, procedures don’t.
Which loop requires a condition to be met before running?
WHILE
FOR
Which line of code lets us input a number?
x = int(input("enter a number")
x = input("enter a number")
x = str(input("Enter a number"))
x = int(input("enter a number"))
Why would the code not run?
You do not give a condition to an else loop
The elif statement is wrong
Age needs a capital letter
The indentation is wrong
What is the name of the sub-routine?
say_my_name
my_name
name
def
What is the name of the parameter?
say_my_name
my_name
name
def
There are none
What is the name of the list?
my_name
correct
names
item
What does the code do?
Creates a random number between 1 and 100 and prints to the user
Prints the number 100
Nothing, there is an error
Asks the user to guess a random number
What is the correct term for this type of loop?
Count controlled
Condition controlled
What is the correct term for this type of loop?
Count controlled
Condition controlled
Which of these statements apply to the term 'variable'
A named memory location that stores a value
value cannot change whilst the program is running
value can change whilst the program is running
State a constant in the program above
PlayerKey
Position
KeyPressed
x
State a variable in the program above
PlayerKey
Position
IF
REPEAT
What is the name given to this common convention for variable names - FirstName
Camel case
Snake case
Dog case
Fish case
What does the arithmetic operator do in this code: print(5**2)
Division returning a real / float
Division returning an integer
Division returning the remainder
Multiplying a number by itself (to the power of)
What is the function of the operator == ?
Equal to: Checks if two values are equal
Not equal to: Checks if two values are not equal
Assignment: Assigns data to a variable
Greater than or equal to: Checks to see if one value is greater than or equal to another
Which of the following key terms are evidenced in the image?
Function
Procedure
Parameter
Variable
Iteration
Which statements are true of global variables
Only accessible inside the function they were originally declared
Declared inside a function
Declared outside a function
Can be accessed anywhere in the program
Only contain integers
Concatenation refers to
joining two strings together
Converting one data type to another
Which of these statements apply to the term 'constant'
A named memory location that stores a value
value cannot change whilst the program is running
value can change whilst the program is running
What does the arithmetic operator do in this code: print ( 5 // 2 )
Division returning a real / float
Division returning an integer
Division returning the remainder
Multiplying a number by itself (to the power of)
8 != 9 AND 20>3
True
False
NOT ( 7*2 == 14 )
True
False
Which word is missing from the following SQL statement?
Select * table_name
WITH
WHERE
FROM
AND
How do we select all data from the "Designer" table?
SELECT * FROM Designer
SELECT [All] FROM Designer
SELECT Designer.*
SELECT FROM Designer
How would we script a SQL query to select "Description" from the Item table?
SELECT Item.Description
EXTRACT Description FROM Item
SELECT Item FROM Description
SELECT Description FROM Item
Which query would return only the fields DesignerID and Designer?
SELECT * FROM Designers
SELECT DesignerID, Name FROM Designers
SELECT DesignerID AND Designer FROM Designers
SELECT DesignerID, Designer FROM Designers
How would you display Chairs in the Items table that have a Price greater than £50.
SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50
SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100
SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50
SELECT * FROM Items WHERE Price > 50
When examining a row in a table, we refer to it as a...
row number
result number
record
result
When examining a column in a table, we refer to it as a...
field
folder
column
table
When creating a table, each field has to have both a ...
table name and a database
command and an argument
name and a data type
What would the SQL query pictured do?
Find all the men
Find all of the female writers
Find all of Elgar's friends
Find all the male writers
Find all the fish
Which of the queries is most likely to have produced this result?
ANSWER: SELECT id, name, year FROM movies WHERE year > 2010;
ANSWER: SELECT id, name, year FROM movies WHERE year < 2010;
ANSWER: SELECT * FROM movies WHERE year > 2010;
ANSWER: SELECT id, name, year FROM movies WHERE YEAR > 2010;
