NEW
Font size
WorksheetsProblem Solving, Algorithm Development and Program Design
Total questions: 40
Worksheet time: 24mins
Which algorithm correctly calculates the average and sum of two user inputted numbers and displays the result of both?
read a
read b
c=a+b
d=a+b/2
print c, d
read a
read b
c=a+b
d=c/2
print c, d
read a
c=a+b
d=(a+b)/2
print c, d
read a
read b
d=c/2
c=a+b
print c, d
Which construct should be used to count from 1 to 5 and print each number consecutively?
IF-THEN-ELSE
FOR-DO-ENDFOR
WHILE-ENDWHILE
IF-THEN-ELSE-IF
Which pseudocode prints out the two times table for the numbers 1 to 6?
For number = 1 to 6 do
product =number *2
print number
Endfor
Display "Number", "Product"
While number <= 6 do
product =number *2
print number, product
Endwhile
Display "Number", "Product"
For number = 1 to 6 do
product =number *2
print number, product
Endfor
Display "Number", "Product"
While number = 1 to 6 do
product =number *2
print number, product
Endwhile
Which of these is an example of a language a computer would understand?
Binary
Pascal
C
All the above
Which of these is an example of a debugging technique
Documentation
Execution
Error Checking
Dry run
Which of the following is not a high level programming language?
Assembly
C
Java
Pascal
What command would you use to create prompting instructions in Pascal?
read
char
integer
A user enters the letter A during the execution of a program. How would you describe that data?
Character constant
String constant
Integer variable
Character variable
distanceToSchool = 10
Which part is the identifier?
distanceToSchool = 10
What is the value of the variable?
To separate these comments from the actual code, what character(s) are used?
You have declared the variable totalheight in a program. It stores the total height of several students, measured in centimeters. What type of data is this most likely to be?
integer
real
character
string
What are the two main ways that algorithms can be designed?
Images or text
In pseudocode or as a flowchart
By hardware or software
What is pseudocode?
A way of describing a set of instructions in text form
A specific programming language that all computers use
A diagrammatic representation of a set of instructions
What is the symbol for a decision in a flowchart?
A parallelogram
A diamond
A circle
Which of these is the correct symbol for a process in a flowchart?
A diamond
A rectangle
A parallelogram
How are symbols connected together in a flowchart?
Symbols do not get connected together in a flowchart
With lines and an arrow to show the direction of flow
By numbers
What is important to remember when designing an algorithm?
whether to use a flowchart or pseudocode
the instructions are in the correct order
that it must be easy to read
An integer is...
A whole number
A number with a decimal part
Letters, numbers or punctuation
True or False
A real is...
A whole number
A number with a decimal part
Letters, numbers or punctuation
True or False
Pick the correct line which creates a variable called 'name' which is a string.
name as string
string = name
name = string
string as name
The best data type for a name is...
integer
real
string
boolean
The best data type for an average is...
integer
real
string
boolean
The best data type for a counter is...
integer
real
string
boolean
What are the two main categories of loop?
Count & Sentinel Controlled
Count & For Controlled
While & Sentinel Controlled
Sentinel & Selection Controlled
Which of the following correctly creates a variable?
DIM age AS x
DECLARE age AS INTEGER
DECLARE CORRECT AS string
INPUT user's full name
What does the following pseudocode snippet do?
DECLARE car AS STRING
It creates a character variable named car.
Creates a new car object.
Nothing
It creates an address in memory which is referenced by the label car.
What does the following pseudocode snippet do?
car <- "Honda"
Assigns car to Honda.
Assigns a string value to car.
Assigns an integer value to car.
Nothing.
What is a CHAR datatype?
A datatype that can hold any single character.
A datatype that can hold only numbers.
A datatype that can hold a set of characters.
A datatype that can hold only letters
What is a STRING datatype?
It can store a sequence of numbers.
It can store a sequence of characters.
It can store a sequence of letters.
All of the above.
x is equal to "yes"; y is equal to "maybe"; z is equal to "no"
x is equal to "no"; y is equal to "maybe"; z is equal to "yes"
x is equal to "no"; y is equal to "maybe"; z is equal to "x"
x is equal to "yes, no"; y is equal to "yes, maybe"; z is equal to "yes, no"
x is equal to "no"; y is equal to "maybe"; z is equal to "no"
Answer
Makes sure the value of x is not equal to 10
Makes sure the value of x is less than 5
Makes sure the value of x is between 10 and 5
It always sets x equal to 5
This code will cause an error
x is equal to 8; y is equal to 8; z is equal to 12
x is equal to 8; y is equal to 4; z is equal to 84
x is equal to 8; y is equal to 8; z is equal to 16
x is equal to 8; y is equal to 8; z is equal to "x + y"
x is equal to 8; y is equal to 4, 8; z is equal to 12
apple
apple
apple
orange
orange
orange
apple
orange
apple
orange
apple
orange
apple
orange
Nothing will be printed
It will be different each time you run it
Under 40
And under 21
And contains a 3
Under 40
And contains a 3
Under 40
And under 21
And contains a 3
Which of the following statement describes a logic error?
The program has run out of memory
The steps to solve the problem are in the wrong sequence
The incorrect terminology was used
The program is stuck in a loop
