Practice Flashcards
Flip to reveal answersWhy are sequence errors hard to spot?
Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.
All 5 Flashcards — Sequence
Sign up free to track progress and get spaced-repetition review schedules.
Question
Why are sequence errors hard to spot?
Answer
Both lines are perfectly valid, so nothing is reported. The program runs to completion and simply produces the wrong answer.
Question
What causes an infinite loop?
Answer
The thing the loop's test depends on never changes — most often because the counter is increased inside a branch that does not always run, so the test can never become false.
Question
Where do setup, work and reporting belong relative to a loop?
Answer
Set up before the loop — totals at 0, counters at their start. Do the work for one item inside. Print or return the finished result after, since printing inside shows a running value rather than the final one.
Question
What is deadlock and how is it prevented?
Answer
Two parts of a program each hold a resource the other is waiting for, so neither can move. It is prevented by having every part claim shared resources in the same fixed order.
Question
What three questions check that a sequence is right?
Answer
Is every value set before it is used? Does the thing the loop tests always change? Is the result used after it is complete rather than during? Those three catch nearly every sequence error.
Read the notes
Full study notes for Sequence
Topic 6.3 hub
Programming constructs
More from Topic 6.3
All flashcards in this topic
Computer Science exam skills
Paper structures & tips
Track your progress with spaced repetition
Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.
Start Free