NEW
Font size
WorksheetsAlgorithms, linear and binary search questions
Total questions: 20
Worksheet time: 12mins
While the program is running, if the program makes a choice if it should run some code or not, it is called a...
variable
sequence
selection
mistake
When a program repeats, looping over the same sequence, it is called...
iteration
a variable
an instruction
Instructions carried out one after another in order is a...
List
Sequence
Collection
Series
Why is iteration important?
It determines the order in which instructions are carried out
It allows code to be simplified by removing duplicated steps
It allows multiple paths through a program
Only allowing one bit of code to run when something happens.
Example:
• Only run this bit of code “When” or “If” this bit has run
• WHEN you press on the keyboard, on the arrows, DO move.
Selection
Sequence
Iteration
Variable
Select the best description to explain what a binary search algorithm is.
Put the elements in order, check each item in turn.
Put the elements in order, compare with the middle value, split the list in order and repeat.
Elements do not need to be in order, check each item in turn.
Elements do not need to be in order, compare to the middle value, split the list in order and repeat
12 6 8 1 3
How many comparisons would it take to find number 1?
3 5 9 10 23
How many comparisons would it take to find number 9?
Which symbol is Input/Output?
What does this symbol represent?
Input/Output
Decision
Off-Page Connector
Process
What is the difference between a flowchart and pseudocode?
A flowchart is diagrammatic whilst pseudocode is written in a programming language
A flowchart is textual but pseudocode is diagrammatic
A flowchart is a diagrammatic description of an algorithm whilst pseudocode is a textual description of an algorithm
A flowchart and pseudocode are the same thing
An Algorithm asks the user to enter their gender (M or F) and prints out a different comment depending on what they entered.
This is an example of which of the algorithm constructs?
Decision (Selection)
Loop (Iteration)
Order (Sequence)
All of the above
What is the best case scenario in a linear search?
The item being searched for is at the end of the list
The item being searched for is at the start of the list
The item is not present in the list
The item being searched for is exactly in the middle of the list
How is the midpoint of the list calculated?
midpoint= round ((first_element+last_element)/2)
midpoint=(lower_bound+upper_bound)/2
midpoint= round ((lower_bound+upper_bound)/2)
midpoint= round ((lower_bound+upper_bound))
What is an Array?
A group of elements of same data type.
An array contains more than one element
Array elements are stored in memory in continuous or contiguous locations.
All the above.
