levo

Program Control Structures

  • 10 subtopics
  • 30 things to know
  • AS Unit 1

Learn Program Control Structures in runs of four questions, then keep it with spaced repetition.

What Program Control Structures covers

Program Control Structures is examined in Unit AS 1, Introduction to Object Oriented Development — a written examination. It covers sequence and the order of execution, methods and passing control between them, selection with IF and IF ELSE, nested IF and multi-way selection, the switch statement, count-controlled repetition with FOR, conditional repetition with WHILE and DO WHILE, nested loops and tracing iterations, breaking out of loops and avoiding infinite loops and choosing and evaluating control structures.

Where it is assessed

AS Unit 1

Introduction to Object Oriented Development.

Check the CCEA specification ↗

The 10 subtopics

Each one has its own page.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What is recursion, and why must a recursive method have a base case?

Key term

What is a null ELSE, and how should if (raining) { } else { walk(); } be rewritten?

Key term

What is a dangling else? Explain which IF the else belongs to in: if (a > 0) if (b > 0) System.out.println("both"); else System.out.println("other");.

Key term

switch (month) { case 4: case 6: case 9: case 11: days = 30; break; } — what does this fragment achieve?

Key term

Why must case labels be constants, and why must they be distinct?

Key term

for (int i = 1; i <= 5; i++) { System.out.print(i + " "); } — what does this fragment print?

Key term

How does a pre-test loop differ from a post-test loop?

Key term

int n = 5; while (n > 0) { System.out.print(n + " "); n = n - 2; } — what does this fragment print?

Key term

int n = 0; do { System.out.print(n + " "); n++; } while (n < 0); — what does this fragment print?

Key term

Describe how a flag-controlled search loop works.

Evaluation

Evaluate the choice between a switch and an else-if ladder for a menu of six numbered options.

Key term

What is structured programming, and what does the single entry and single exit principle require?

Key term

Compare a loop that tests before the body with one that tests after, and give a case that suits each.

Process

What does sequence mean as a program control structure?

Key term

What is a nested loop?

Key term

Which three basic control structures can any program be built from?

Key term

What is a method?

Key term

What is selection?

Key term

What is a nested IF?

Key term

What is repetition as a control structure?

Key term

An outer loop runs three times and an inner loop four times. How many times does the inner body execute in total?

Key term

What does break do inside a loop?

Key term

What is a statement, and what is a compound statement?

Key term

What happens to the flow of control when a method is called?

Key term

What is a decision, in the context of program control?

Key term

int mark = 85; if (mark >= 40) { System.out.println("Pass"); } else if (mark >= 70) { System.out.println("Distinction"); } — what is the defect?

Key term

What kind of expression does a switch test?

Key term

What is meant by unconditional repetition, and which construct normally implements it?

Key term

Why is using the same variable name for both counters of a nested loop a mistake?

Key term

What does continue do inside a loop?

Take Program Control Structures further

The same content, four other ways.

Commonly confused

Pairs that lose marks when they are blurred together.

  • Flow of control vs Control structure

    Flow of control: the path execution actually takes through the statements on a given run. Control structure: a construct in the language that shapes that path.

  • Off-by-one error vs Infinite loop

    Off-by-one error: a fault in which a count ends after the wrong number of passes, usually one too many or too few. Infinite loop: a fault in which the test can never fail, so execution never leaves the block.

Questions from this topic

Each one with the model answer underneath.

  1. 1

    What does sequence mean as a program control structure?

    Model answer

    Sequence is the control structure in which statements are carried out one after another in the order they are written, each completing before the next begins.

  2. 2

    Which three basic control structures can any program be built from?

    Model answer

    The three basic control structures are sequence, selection and repetition.

  3. 3

    Using a total calculated from a price as the example, why does the order of statements within a sequence matter?

    Model answer

    A statement can only use values that already exist, so calculating total = price * quantity before price has been assigned uses an unset value and gives the wrong answer or refuses to compile.

  4. 4

    int a = 2; int b = 3; a = a + b; b = a - b; — what are the final values of a and b?

    Model answer

    The third statement makes a equal to 5, and the fourth then makes b equal to 5 minus 3, which is 2, so a finishes at 5 and b at 2.

  5. 5

    In the fragment int p = 2; int q = 3; q = p - q; p = p + q; work through each statement and give the values of p and q at the end.

    Model answer

    The third statement stores 2 minus 3 in q, giving −1, and the fourth then stores 2 plus −1 in p, so p ends at 1 and q at −1.

  6. 6

    Explain why swapping the contents of two variables needs a third variable, and give the three statements in order.

    Model answer

    Assigning one variable to the other destroys the value being overwritten, so a temporary variable must hold it first: temp = a; then a = b; then b = temp.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A null is the of one.
absencepresencetype

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Program Control Structures revision questions

What does Program Control Structures cover in CCEA A-Level Software Systems Development?
10 subtopics: sequence and the order of execution, methods and passing control between them, selection with if and if else, nested if and multi-way selection, the switch statement, count-controlled repetition with for, conditional repetition with while and do while, nested loops and tracing iterations, breaking out of loops and avoiding infinite loops and choosing and evaluating control structures. Each one has its own page with questions and model answers.
How is Program Control Structures organised?
By the CCEA CL4 specification, subtopic by subtopic, so it matches the order you are taught it in.

Every question in Program Control Structures, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.