Programming Foundations Exam |
100% Correctly Answered and Rated
A+ | 2025/2026 Guide
Why are functions useful?
- Correct Answer - Decomposing a program into functions can greatly aid
program readability, helping yield an initially correct program, and easing
future maintenance
An invocation of a function's name, causing the function's statements to
execute
- Correct Answer - Function Call
What is a parameter in a function?
- Correct Answer - A function input specified in a function definition. Ex: A
pizza area function might have diameter as an input.
What is an argument in a function?
- Correct Answer - A value provided to a function's parameter during a
function call. Ex: A pizza area function might be called as
PrintPizzaArea(12.0) or as PrintPizzaArea(16.0).
, What happens if you define a function but do not call it?
- Correct Answer - A function does not automatically get executed
What does a return statement do?
- Correct Answer - returns the specified value and immediately exits the
function.
What is the algorithm used for searching a sorted and directly accessible
list?
- Correct Answer - Binary Search
How does the Binary Search algorithm work?
- Correct Answer - First checks the middle element of the list. If the
search key is found, the algorithm returns the matching location. If the
search key is not found, the algorithm repeats the search on the
remaining left sublist (if the search key was less than the middle
element) or the remaining right sublist (if the search key was greater
than the middle element)
How does the linear search algorithm work?
- Correct Answer - It starts from the beginning of a list, and checks each
element until the search key is found or the end of the list is reached.