WESTERN GOVERNORS UNIVERSIT Y
Bachelor of Science in Computer Science
D278 Scripting and Programming Foundations Academic Year: 2026/2027
Final Review: Complete Question Bank (All
Terms)
Question 1
In a program, a problem's cause is called a ____, and troubleshooting is called ____.
A. bug, debugging
B. error, fixing
C. fault, repairing
D. mistake, correcting
CORRECT ANSWER: A. bug, debugging
RATIONALE: In programming, a problem's cause is called a bug, and the process of
finding and fixing bugs is called debugging.
,Question 2
Looking at each statement one-by-one to try to find a bug is called what?
A. Visual inspection
B. Debug output
C. Binary search
D. Trial and error
CORRECT ANSWER: A. Visual inspection
RATIONALE: Visual inspection is the process of looking at each statement one-by-one to
try to find a bug.
Question 3
For each statement, this process has the hypothesis: "This statement has a bug." The
test is a visual inspection of the statement. If a bug is found, is the hypothesis validated
or invalidated?
A. Hypothesis is validated
B. Hypothesis is invalidated
CORRECT ANSWER: A. Hypothesis is validated
RATIONALE:If a bug is found through visual inspection, the hypothesis that the
statement contains a bug is validated.
,Question 4
A programmer may divide the statements into regions, and insert one debug output
statement after each region. If a region's output is bad (doesn't match expected
output), the programmer can then create sub-hypotheses for the statements in that
region. What is this method called and when is it used?
A. Hierarchical debugging. Used for larger programs with 10's to 100's of statements.
B. Linear debugging. Used for small programs.
C. Binary debugging. Used for medium programs.
D. Visual debugging. Used for all programs.
CORRECT ANSWER:
A. Hierarchical debugging. Used for larger programs with 10's to 100's of statements.
RATIONALE: Hierarchical debugging is used for larger programs by dividing statements
into regions and inserting debug output statements after each region.
Question 5
Program has 12 statements. Assume each debug output statement requires 60 seconds
(some time to insert, and some to check the output). How many seconds would be
required if a debug output statement is inserted after every statement in the program?
A. 60 seconds
B. 180 seconds
C. 720 seconds
CORRECT ANSWER: C. 720 seconds
RATIONALE: 12 statements × 60 seconds = 720 seconds required.
, Question 6
Program has 12 statements. Assume each debug output statement requires 60 seconds.
How many seconds would be required if one debug statement is inserted after a first,
second, and third region of the program?
A. 60 seconds
B. 180 seconds
C. 720 seconds
CORRECT ANSWER: B. 180 seconds
RATIONALE: 3 debug statements × 60 seconds = 180 seconds required.
Question 7
Program has 12 statements. After determining that region 2 has a bug, which approach
can be used to debug region 2?
A. Visual inspection only
B. Debug output statement insertion only
C. Either visual inspection or debug output statement insertion
CORRECT ANSWER: C. Either visual inspection or debug output statement insertion
RATIONALE: Once a bad region is identified, the programmer can use either visual
inspection or insert more debug output statements to find the specific bug.
Bachelor of Science in Computer Science
D278 Scripting and Programming Foundations Academic Year: 2026/2027
Final Review: Complete Question Bank (All
Terms)
Question 1
In a program, a problem's cause is called a ____, and troubleshooting is called ____.
A. bug, debugging
B. error, fixing
C. fault, repairing
D. mistake, correcting
CORRECT ANSWER: A. bug, debugging
RATIONALE: In programming, a problem's cause is called a bug, and the process of
finding and fixing bugs is called debugging.
,Question 2
Looking at each statement one-by-one to try to find a bug is called what?
A. Visual inspection
B. Debug output
C. Binary search
D. Trial and error
CORRECT ANSWER: A. Visual inspection
RATIONALE: Visual inspection is the process of looking at each statement one-by-one to
try to find a bug.
Question 3
For each statement, this process has the hypothesis: "This statement has a bug." The
test is a visual inspection of the statement. If a bug is found, is the hypothesis validated
or invalidated?
A. Hypothesis is validated
B. Hypothesis is invalidated
CORRECT ANSWER: A. Hypothesis is validated
RATIONALE:If a bug is found through visual inspection, the hypothesis that the
statement contains a bug is validated.
,Question 4
A programmer may divide the statements into regions, and insert one debug output
statement after each region. If a region's output is bad (doesn't match expected
output), the programmer can then create sub-hypotheses for the statements in that
region. What is this method called and when is it used?
A. Hierarchical debugging. Used for larger programs with 10's to 100's of statements.
B. Linear debugging. Used for small programs.
C. Binary debugging. Used for medium programs.
D. Visual debugging. Used for all programs.
CORRECT ANSWER:
A. Hierarchical debugging. Used for larger programs with 10's to 100's of statements.
RATIONALE: Hierarchical debugging is used for larger programs by dividing statements
into regions and inserting debug output statements after each region.
Question 5
Program has 12 statements. Assume each debug output statement requires 60 seconds
(some time to insert, and some to check the output). How many seconds would be
required if a debug output statement is inserted after every statement in the program?
A. 60 seconds
B. 180 seconds
C. 720 seconds
CORRECT ANSWER: C. 720 seconds
RATIONALE: 12 statements × 60 seconds = 720 seconds required.
, Question 6
Program has 12 statements. Assume each debug output statement requires 60 seconds.
How many seconds would be required if one debug statement is inserted after a first,
second, and third region of the program?
A. 60 seconds
B. 180 seconds
C. 720 seconds
CORRECT ANSWER: B. 180 seconds
RATIONALE: 3 debug statements × 60 seconds = 180 seconds required.
Question 7
Program has 12 statements. After determining that region 2 has a bug, which approach
can be used to debug region 2?
A. Visual inspection only
B. Debug output statement insertion only
C. Either visual inspection or debug output statement insertion
CORRECT ANSWER: C. Either visual inspection or debug output statement insertion
RATIONALE: Once a bad region is identified, the programmer can use either visual
inspection or insert more debug output statements to find the specific bug.