H446/2 Exam Prep - Q2 Search

Quiz
•
Computers
•
12th Grade
•
Easy
RHSC Computing
Used 6+ times
FREE Resource
8 questions
Show all answers
1.
FILL IN THE BLANK QUESTION
1 min • 1 pt
2(a). A computer program stores data in an array named words.
The data in the array needs to be searched for a value that the user inputs.
i. One example of a searching algorithm is a binary search.
Identify the precondition for a binary search. The array/data must be
Answer explanation
A few candidates were too vague giving unqualified answers such as ‘must be sorted’, without specifying what had to be sorted.
The array/data must be in order/sorted
2.
REORDER QUESTION
1 min • 4 pts
i. A second example of a searching algorithm is a linear search.
Describe how a linear search works.
the end of the array has been reached or
the search item is found
repeat the above process until either
then compare the search item with the next value
return the array position or -1/flase
Compare the search item with the first value
Answer explanation
1 mark per bullet
1-Compare the search item with the first
value
2-….then compare the search item with
the next value
3-repeat the above process until either
4….the end of the array has been
-reached or
5-the search item is found and then
stop
6-….then return the array position //
return -1 / False if not found
3.
HOTSPOT QUESTION
1 min • 2 pts
The pseudocode function useWords() here uses the global array words. The number of words in the array words is passed as a parameter.
i. Identify two variables in the function useWords().
Answer explanation
1 mark for each variable
contents
count
numberOfWords
words / words[]
Do not award numberOfWords if there are
obvious spaces in ‘number of Words’. It
must be a valid identifier
4.
DRAG AND DROP QUESTION
1 min • 1 pt
numberOfWords is a parameter passed by value. Describe the difference between passing a parameter by value and by referenceBy (a) the function receives the (b) location of the data By (c) the function receives a (d) of the variable
Answer explanation
1 mark per bullet
By reference the function receives the
memory location of the data
By value the function receives a copy
of the variable
By reference will make changes to the
original variable
By value will make changes to the copy
of the variable
By reference will overwrite data in the
original variable
By value will not overwrite the data in
the original variable
By reference will keep the changes
after the function ends
By value will not keep the changes
after the function ends
5.
DRAG AND DROP QUESTION
1 min • 1 pt
Rewrite the function using a while
contents = ""
count = 0
(a) count (b) numberOfWords
contents = contents + (c) [count] + " "
count = count + 1
endwhile
(d) content
6.
CLASSIFICATION QUESTION
3 mins • 1 pt
Identify benefits and drawbacks of declaring an array as a global variable instead of a local variable.
Groups:
(a) Benefit
,
(b) Drawback
You don’t need to return a value
Alterations within the function may have unwanted side effects elsewhere in the program
Variable doesn’t need passing as a parameter (byref)
Can be accessed from any function / anywhere in the program
Increases memory usage (as it is used until full program execution is over)
Answer explanation
Drawbacks were poorly described.
Potential side effects and resultant
complexity debugging were frequently
alluded to as ‘accidental change’ but not
fully developed into complete qualified
points.
There was also a frequent misconception
that you cannot have multiple variables
with the same name, which is not true.
When a local variable is declared with the
same name as a global variable that
already exists, it takes precedence within
the local scope.
7.
CLASSIFICATION QUESTION
3 mins • 1 pt
Identify features of an Integrated Development Environment (IDE) that can be used to help write a program and one feature that can be used to help test a program.
Groups:
(a) Write a program
,
(b) Test a program
syntax highlighting
Auto-indent
Variable watch window
Stepping
Auto-complete
Breakpoints
Answer explanation
1 mark per identification 1 mark for
expansion, max 2 each.
Write:
e.g.
Auto-complete
Start typing an identifier/command and
it fills in the rest
Auto-indent
Indents code automatically within
structures to avoid errors
Coloured command words // pretty
printing // syntax highlighting
Shows which commands are correct //
help identify key elements
Test
e.g.
Breakpoints
Stop the program running at a set point
to check variables
Variable watch window
Display the values of the variables
while the program is run
Stepping
Run one line at a time and check
variables
Unit Testing
Automated tests to be run to check
changes ensure changes haven’t
introduced errors
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Functions and procedures are reusable components. Give two benefits of writing a program with reusable components
Saves time from having to write the same algorithm repeatedly
Increased testing requirements
Cannot be taken and used in different programs as well as the program they are written in
can be used in a program library
Similar Resources on Wayground
11 questions
Understanding Linear Search Algorithm

Quiz
•
12th Grade
10 questions
Python массив

Quiz
•
9th - 12th Grade
10 questions
Technical Terms - Internet (A-Z) - Bot

Quiz
•
12th Grade
10 questions
Tes Sumatif Fase E

Quiz
•
9th - 12th Grade
11 questions
Computational Thinking

Quiz
•
12th Grade
8 questions
2.3.1(f) Binary Search

Quiz
•
12th Grade
12 questions
Arrays Intro

Quiz
•
9th - 12th Grade
11 questions
Understanding Binary Search Algorithm

Quiz
•
12th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade