Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.2 Programming

Total questions: 55

Worksheet time: 29mins

Name
Class
Date
1.

The following is not true about variable names ?

a)

They should be descriptive

b)

They must be in capital letters

c)

They can’t start with numbers or contain spaces

d)

They point to memory locations

2.

In an assignment operation, what appears on the right hand side ?

a)

Variable identifier / name

b)

The assignment operator (=)

c)

data to be assigned

3.

Which of the following is not a valid data type?

a)

Real

b)

String

c)

Character

d)

Fraction

4.

Quotation marks around data implies the data type is?

a)

an integer

b)

a string

c)

a Boolean

d)

a real

5.

This variable type can only have True or False values

a)

Boolean

b)

Integer

c)

String

d)

Character

6.

Casting refers to

a)

joining two strings together

b)

Converting one data type to another

7.

The operator used to divide and returns a INTEGER answer is?

a)

DIV (//)

b)

MOD (%)

c)

Division (/)

d)

**

8.

The main difference between a procedure & a functions is

a)

Functions return values, procedures don’t.

b)

Functions use parameter passing, procedures don’t.

9.

Which loop requires a condition to be met before running?

a)

WHILE

b)

FOR

10.

Which line of code lets us input a number?

a)

x = int(input("enter a number")

b)

x = input("enter a number")

c)

x = str(input("Enter a number"))

d)

x = int(input("enter a number"))

11.

Why would the code not run?

a)

You do not give a condition to an else loop

b)

The elif statement is wrong

c)

Age needs a capital letter

d)

The indentation is wrong

12.

What is the name of the sub-routine?

a)

say_my_name

b)

my_name

c)

name

d)

def

13.

What is the name of the parameter?

a)

say_my_name

b)

my_name

c)

name

d)

def

e)

There are none

14.

What is the name of the list?

a)

my_name

b)

correct

c)

names

d)

item

15.

What does the code do?

a)

Creates a random number between 1 and 100 and prints to the user

b)

Prints the number 100

c)

Nothing, there is an error

d)

Asks the user to guess a random number

16.
State whether this program uses sequence, selection or iteration
a)
Sequence
b)
Selection
c)
Iteration
17.
State whether this program uses sequence, selection or iteration
a)
Sequence
b)
Selection
c)
Iteration
18.
State whether this program uses sequence, selection or iteration
a)
Sequence
b)
Selection
c)
Iteration
19.

What is the correct term for this type of loop?

a)

Count controlled

b)

Condition controlled

20.

What is the correct term for this type of loop?

a)

Count controlled

b)

Condition controlled

21.

Which of these statements apply to the term 'variable'

a)

A named memory location that stores a value

b)

value cannot change whilst the program is running

c)

value can change whilst the program is running

22.

State a constant in the program above

a)

PlayerKey

b)

Position

c)

KeyPressed

d)

x

23.

State a variable in the program above

a)

PlayerKey

b)

Position

c)

IF

d)

REPEAT

24.

What is the name given to this common convention for variable names - FirstName

a)

Camel case

b)

Snake case

c)

Dog case

d)

Fish case

25.
What is the name given to this common convention for variable names?  student_name
a)
Camel case
b)
Snake case
c)
Dog case
d)
Fish case
26.

What does the arithmetic operator do in this code: print(5**2)

a)

Division returning a real / float

b)

Division returning an integer

c)

Division returning the remainder

d)

Multiplying a number by itself (to the power of)

27.

What is the function of the operator == ?

a)

Equal to: Checks if two values are equal

b)

Not equal to: Checks if two values are not equal

c)

Assignment: Assigns data to a variable

d)

Greater than or equal to: Checks to see if one value is greater than or equal to another

28.
What is the function of the operator <=  ?
a)
Equal to: Checks if two values are equal
b)
Not equal to: Checks if two values are not equal
c)
Less than or equal to: Checks to see if one value is less than or equal to another
d)
Greater than or equal to:  Checks to see if one value is greater than or equal to another
29.
What is the function of the operator  != ?
a)
Equal to: Checks if two values are equal
b)
Not equal to: Checks if two values are not equal
c)
Less than or equal to: Checks to see if one value is less than or equal to another
d)
Greater than or equal to:  Checks to see if one value is greater than or equal to another
30.
What data type would you use to store the value of pi to 2 decimal places i.e. 3.14?
a)
String
b)
Integer
c)
Real or Float
d)
Boolean
31.
What data type would you use to store someone's age?
a)
String
b)
Integer
c)
Real or Float
d)
Boolean
32.
What data type would you use to store someone's name?
a)
String
b)
Integer
c)
Real or Float
d)
Boolean
33.
What data type would you use to store yes or no?
a)
String
b)
Integer
c)
Real or Float
d)
Boolean
34.
What programming concept is being shown in the image on Line 4?
a)
Concatenating
b)
Function
c)
Joiniating
d)
Merging
35.
File Handling: what does the last line of code do?
a)
Opens the files
b)
Closes the program
c)
Closes the file
d)
Writes to the file
36.
What is the index position of the element 'cantelope' in this 1 dimensional array?
a)
0
b)
1
c)
2
d)
3
37.
What does print(fruits[0:3]) output?
a)
apple, cantelope, satsuma
b)
apple, cantelope, satsuma and orange
c)
apple, cantelope
d)
app
38.

Which of the following key terms are evidenced in the image?

a)

Function

b)

Procedure

c)

Parameter

d)

Variable

e)

Iteration

39.

Which statements are true of global variables

a)

Only accessible inside the function they were originally declared

b)

Declared inside a function

c)

Declared outside a function

d)

Can be accessed anywhere in the program

e)

Only contain integers

40.

Concatenation refers to

a)

joining two strings together

b)

Converting one data type to another

41.

Which of these statements apply to the term 'constant'

a)

A named memory location that stores a value

b)

value cannot change whilst the program is running

c)

value can change whilst the program is running

42.

What does the arithmetic operator do in this code: print ( 5 // 2 )

a)

Division returning a real / float

b)

Division returning an integer

c)

Division returning the remainder

d)

Multiplying a number by itself (to the power of)

43.

8 != 9 AND 20>3

a)

True

b)

False

44.

NOT ( 7*2 == 14 )

a)

True

b)

False

45.
Which SQL statement is used to extract data from a database?
a)
OPEN
b)
GET 
c)
EXTRACT
d)
SELECT
46.

Which word is missing from the following SQL statement?


Select * table_name

a)

WITH

b)

WHERE

c)

FROM

d)

AND

47.

How do we select all data from the "Designer" table?

a)

SELECT * FROM Designer

b)

SELECT [All] FROM Designer

c)

SELECT Designer.*

d)

SELECT FROM Designer

48.

How would we script a SQL query to select "Description" from the Item table?

a)

SELECT Item.Description

b)

EXTRACT Description FROM Item

c)

SELECT Item FROM Description

d)

SELECT Description FROM Item

49.

Which query would return only the fields DesignerID and Designer?

a)

SELECT * FROM Designers

b)

SELECT DesignerID, Name FROM Designers

c)

SELECT DesignerID AND Designer FROM Designers

d)

SELECT DesignerID, Designer FROM Designers

50.

How would you display Chairs in the Items table that have a Price greater than £50.

a)

SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50

b)

SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100

c)

SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50

d)

SELECT * FROM Items WHERE Price > 50

51.

When examining a row in a table, we refer to it as a...

a)

row number

b)

result number

c)

record

d)

result

52.

When examining a column in a table, we refer to it as a...

a)

field

b)

folder

c)

column

d)

table

53.

When creating a table, each field has to have both a ...

a)

table name and a database

b)

command and an argument

c)

name and a data type

54.

What would the SQL query pictured do?

a)

Find all the men

b)

Find all of the female writers

c)

Find all of Elgar's friends

d)

Find all the male writers

e)

Find all the fish

55.

Which of the queries is most likely to have produced this result?

a)

ANSWER: SELECT id, name, year FROM movies WHERE year > 2010;

b)

ANSWER: SELECT id, name, year FROM movies WHERE year < 2010;

c)

ANSWER: SELECT * FROM movies WHERE year > 2010;

d)

ANSWER: SELECT id, name, year FROM movies WHERE YEAR > 2010;