aimnova.
DashboardMy LearningPaper MasteryStudy Plan

Aimnova site navigation

Stay in the loop

Get the latest study resources and updates

New features, study tips and exam insights — straight to your inbox.

IB Diploma

  • IB Past Papers
  • IB Study Notes
  • IB Question Bank
  • IB Mock Exams
  • IB Revision

IB Subjects

  • IB Math AA
  • IB Math AI
  • IB Economics
  • IB Business Management
  • IB Physics
  • IB Biology
  • View all IB subjects→

IB Past Papers

  • IB Math AA HL Past Papers
  • IB Math AA SL Past Papers
  • IB Math AI HL Past Papers
  • IB Math AI SL Past Papers
  • IB Economics HL Past Papers
  • IB Economics SL Past Papers
  • IB ESS Past Papers
  • View all past papers→

Study Resources

  • Study Notes
  • Question Bank
  • Mock Exams
  • Flashcards
  • Revision Guide
  • Exam Skills
  • Command Terms
  • Grade Calculator
  • Exam Timetable 2026

Aimnova

  • Features
  • Pricing
  • For Schools
  • For Parents
  • About Us
  • Blog
  • Contact
aimnova.

AI-powered study platform for smarter revision, past-paper analysis and examiner-style feedback.

TermsPrivacyCookies·© 2026 Aimnova. All rights reserved.8afc4e3

Aimnova is not affiliated with or endorsed by the International Baccalaureate Organization (IB).

NotesComputer ScienceTopic 6.3Sequence
Back to Computer Science Topics
6.3.16 min read

Sequence

IB Computer Science • Unit 6

AI-powered feedback

Stop guessing — know where you lost marks

Get instant, examiner-style feedback on every answer. See exactly how to improve and what the markscheme expects.

Try It Free

Contents

  • Order is not a detail
  • Three ways order goes wrong
  • Getting the order right first time
  • Exam-style question
The big idea: Instructions run one after another, in the order written.

So two correct instructions in the wrong order give a wrong program — and nothing warns you, because both lines are perfectly valid.
The general rule: A value must be set before it is used, and used before it is changed again.

Most sequence errors are one of those two, and both are invisible to the computer.

Free preview

This is the free notes preview

You're reading the free notes. Aimnova Pro unlocks the full study experience — and you can try it with your first topic free to keep:

  • FlashcardsLock in vocabulary and key terms with spaced repetition.
  • Practice questionsAnswer exam-style questions and get instant AI marking.
  • Mock exams & past-paper vaultSit full mocks and see exactly how examiners award marks.
  • Personalised study planA daily plan built around your exam date and weak areas.
Start Studying Free Full access to Aimnova Pro · cancel anytime
1

Infinite loop

2

Incorrect output

3

Deadlock

Avoiding deadlock: The standard fix is to make every part claim shared resources in the same fixed order — always the file first, then the printer.

If nobody can be holding the second while waiting for the first, the circle cannot form.

Practice with real exam questions

Answer exam-style questions and get AI feedback that shows you exactly what examiners want to see in a full-marks response.

Try Practice FreeYour first topic is free to keep • No credit card required

Before the loop

  • Set up anything the loop will use: totals at 0, counters at their start
  • Read anything needed to decide how many times to go round
  • Setting a total inside the loop resets it every time

Inside the loop

  • Do the work for one item
  • Update whatever the loop's test depends on — every time round
  • Ask: could this line ever fail to run?

After the loop

  • Print or return the finished result
  • Printing inside the loop shows a running value, not the final one
  • Divide for an average here, once the count is complete
The three-question check: Is every value set before it is used? Does the loop's test always change? Is the result used after it is complete, not during?

Three questions catch nearly every sequence error there is.

How this is tested — you must say WHICH line is in the wrong place and what the effect is. It comes up two ways:

Paper 2 — working with code

  • Identify and correct a sequence error, 3-5 marks
  • Explain why a loop never ends
  • Put given instructions into the right order

Paper 2 — the algorithmic-thinking question

  • Reason about ordering with no code shown
  • Explain how deadlock arises and how to prevent it
The classic trap: Saying "the order is wrong" without naming the line. Marks come from which line, where it should go, and what the wrong order produced — one value behind, a loop that never ends.
IB-style questionIdentify[5 marks]

This should print the average mark but prints a smaller number. Find and correct the error.

total = 0 count = 0 for mark in marks: count = count + 1 print(total / count) total = total + mark

Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic
IB-style questionIdentify[5 marks]

This should print the average mark but prints a smaller number. Find and correct the error.

int total = 0; int count = 0; for (int mark : marks) { count = count + 1; System.out.println((double) total / count); total = total + mark; }

Model answer plan

See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.

Claim your free topic

Try an IB Exam Question — Free AI Feedback

Test yourself on Sequence. Write your answer and get instant AI feedback — just like a real IB examiner.

the output of: SET a TO 3; SET a TO 10; SET b TO a + 2; OUTPUT b. [2 marks]

Related Computer Science Topics

Continue learning with these related topics from the same unit:

6.1.1Variables and data types
6.1.2Substrings
6.1.3Exception handling
6.1.4Debugging
View all Computer Science topics

Improve your exam technique

Command terms, paper structure, and mark-scheme tips for Computer Science

Previous
6.2.4Queues (FIFO)
Next
Selection6.3.2

21 exam-style questions ready for you

Students who practice on Aimnova improve their scores by 15% on average. Get instant feedback that shows exactly how to improve your answers.

Practice Now — FreeView All Computer Science Topics