wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.2 Programming Techniques

Total questions: 22

Worksheet time: 11mins

Name
Class
Date
1.

Which of the following is a valid keyword for an output? (1-4)

a)
PRINT
b)
SHOW
c)
DISPLAY
d)
INPUT
2.

Consider the following expression: a=b. This means: (6-9)

a)
a will always be equal to b
b)
b is being renamed into a
c)
value of memory location a gets copied to memory location b
d)
value of memory location b gets copied to memory location a
3.

Which of the following is not a valid data type? (1-4)

a)

Float

b)
String
c)

Integer

d)
Fraction
4.

Quotation marks around a variable’s value imply (1-4)

a)
It is an integer
b)
It is a string
c)
It is a Boolean
d)
It is a real
5.

The multiplication table is best displayed using this data type (4-6)

a)
Boolean
b)
Character
c)
Integer
d)
Real
6.

This variable type can only have True or False values (1-4)

a)
Boolean
b)
Integer
c)
String
d)
Character
7.

Casting refers to: (4-6)

a)
Boolean algebra
b)
Rounding of reals
c)
Converting between variable data types
d)
Printing out of the program’s results
8.

The operator used to find the remainder after division of two integers (4-6)

a)
Integer division
b)
MOD
c)
Division
d)
Subtraction
9.

The statement A OR B implies A and B are:

a)
Integers
b)
Strings
c)
Booleans
d)
Characters
10.

This function calculates the length of a string (4-6)

a)
UBOUND
b)
INDEX
c)
LEN
d)
COUNT
11.

The main difference between procedures & functions is

a)
Procedures are usually longer & have more instructions
b)
Functions use parameter passing, while procedures don’t
c)
Functions are more difficult to debug
d)
Functions return values, while procedures don’t
12.

The flowchart shape for selection is

a)
Parallelogram
b)
Square
c)
Diamond
d)
Rounded rectangle
13.
Variables cannot be changed.
a)
False
b)
True
14.
Constants cannot be changed.
a)
True
b)
False
15.

5.23 would be stored as:

a)

Integer

b)

Float

c)

String

d)

Character

e)

Boolean

16.

Which line of code lets us input an integer?

a)

int(input("enter a number"))

b)

input("Enter a number")

c)

str(input("Enter a number"))

d)

import random

17.

Complete this sentence: ……………………… is used to execute a particular set of statements repeatedly until a condition is satisfied.

a)
A.Sequence
b)
B.Iteration
c)
C.Selection
d)
D.All of the above
18.
7.Which of the following structure is used to iterate a set of statements by counting the number of times it needs to be executed?
a)
A.For structure
b)
B.Do…. While
c)
C.Repeat… Until
d)
D.None of the above
19.

Which of the following programming construct is used to print out multiplication tables?

a)
A.Iteration
b)
B.Selection
c)
C.Sequence
20.

Which of the following represents labels that represent values in computer and that can be changed during program execution?

a)
A.Variables
b)
B.Constants
c)
C.Data types
21.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

22.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” is "Andy"

a)

SELECT * FROM FirstName WHERE Persons

b)

SELECT * FROM Persons WHERE FirstName = "A*"

c)

SELECT * FROM Persons WHERE FirstName ="Andy"’

d)

SELECT FirstName FROM Persons WHERE FirstName="Andy"