Programming Foundations Exam |
Questions and Answers Rated A+ |
2025/2026 Guide
Loops commonly consists of three parts:
- Correct Answer - Loop variable initialized before the loop
A decision statement with the loop expression
Loop variable updated at the end of the loop body
While loop
- Correct Answer - A loop that repeatedly executes the loop body while
the loop's expression evaluates to true
Generally used when a number of iterations is not known
For loop
- Correct Answer - A loop consisting of a loop variable initialization, a
loop expression, and a loop variable update that typically describes
iterating for a specific number of times.
Generally used when a number of iterations is known.
Nested loop
- Correct Answer - A loop that appears in the body of another loop
(commonly referred to as inner and outer loop)
Do-while loop
,- Correct Answer - Loop that first executes the loop body's statements,
then checks the loop condition.
Useful when the loop should iterate at least once
Array
- Correct Answer - A special variable having one name, but storing a list
of data items with each item being directly accessible (also called a
Vector)
Must be an integer type, cannot be floating-point
Element
- Correct Answer - Each item in an array
Index
- Correct Answer - Each elements location number within an array (the
number in backets)
Swapping
- Correct Answer - Means to assign two variables with each others value
(ex. x=3 y=7 swap x=7 y=3)
A common method is to use a third variable
ex.
x=22 y=99
tempVal = x
x=y
y = tempVal
x=99 y=22
, Function definition - Correct Answer - Consists of the new function's
name and a block of statements. The function's name can be any valid
identifier
Local variable - Correct Answer - AA variable declared in a function,
which is then accessible only within that function
Parameter - Correct Answer - A functions input specified in a function
definition
Ex. pizza area function might have diameter as a parameter
Argument - Correct Answer - A value provided to a function's parameter
during a function call.
Return variable - Correct Answer - What function returns (return value)
Modular development - Correct Answer - The process of diving a
program into separate modules that can be developed and testing
separately and then integrated into a single program
Functional stub - Correct Answer - A function definition whose
statements have not yet been written
Computational problem - Correct Answer - Specifies the input that can
be answered using a computer and the desired output.
Np- complete - Correct Answer - A set of problems for which no efficient
algorithm exists