CCEA AS-Level Software Systems Development CL4
Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures
Exception Handling and Managing Input and Output
Testing an Object Oriented Application
Graphical User Interface Objects and Events
Multiple Forms and Linking to Files
Designing, Testing and Evaluating an Event Driven Application
Program Control Structures
- 10 subtopics
- 30 things to know
- AS Unit 1
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. CCEA AS Software Systems Development students sit this topic in the first year.
- Sequence and the order of executionFlow of control in a program and task that is naturally pure sequence.Open →
- Methods and passing control between themReturn value do, and what does the keyword void, three benefits of dividing a program into methods and method having a single, well-defined purpose.Open →
- Selection with IF and IF ELSEDecision, in the context of program control, null ELSE and conditional operator.Open →
- Nested IF and multi-way selectionNested IFs and else-if ladders traced through worked Java fragments, ordering the conditions correctly, the dangling else, combining conditions with AND, counting paths for testing, and when a nested IF is clearer than a switch.Open →
- The switch statementSwitch statement, expression does a switch test and fall-through in a switch.Open →
- Count-controlled repetition with FORRepetition as a control structure, unconditional repetition and off-by-one error.Open →
- Conditional repetition with WHILE and DO WHILEConditional repetition and sentinel value.Open →
- Nested loops and tracing iterationsA loop inside a loop and how many times the inner body runs, tracing the output of a nested pair, triangular patterns where the inner limit depends on the outer counter, and breaking out early.Open →
- Breaking out of loops and avoiding infinite loopsHow a flag-controlled search loop works, infinite loop and loop guard.Open →
- Choosing and evaluating control structuresThree measures of a well-chosen control structure and structured programming.Open →
What you need to know
Answer each one before you reveal it.
What is a null ELSE, and how should if (raining) { } else { walk(); } be rewritten?
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");.
switch (month) { case 4: case 6: case 9: case 11: days = 30; break; } — what does this fragment achieve?
Why must case labels be constants, and why must they be distinct?
for (int i = 1; i <= 5; i++) { System.out.print(i + " "); } — what does this fragment print?
How does a pre-test loop differ from a post-test loop?
int n = 5; while (n > 0) { System.out.print(n + " "); n = n - 2; } — what does this fragment print?
int n = 0; do { System.out.print(n + " "); n++; } while (n < 0); — what does this fragment print?
Describe how a flag-controlled search loop works.
Evaluate the choice between a switch and an else-if ladder for a menu of six numbered options.
What is structured programming, and what does the single entry and single exit principle require?
Compare a loop that tests before the body with one that tests after, and give a case that suits each.
What does sequence mean as a program control structure?
What is a nested loop?
Which three basic control structures can any program be built from?
What is a method?
What is selection?
What is a nested IF?
What is repetition as a control structure?
An outer loop runs three times and an inner loop four times. How many times does the inner body execute in total?
What does break do inside a loop?
What is a statement, and what is a compound statement?
What happens to the flow of control when a method is called?
What is a decision, in the context of program control?
int mark = 85; if (mark >= 40) { System.out.println("Pass"); } else if (mark >= 70) { System.out.println("Distinction"); } — what is the defect?
What kind of expression does a switch test?
What is meant by unconditional repetition, and which construct normally implements it?
Why is using the same variable name for both counters of a nested loop a mistake?
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
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
Which three basic control structures can any program be built from?
Model answer
The three basic control structures are sequence, selection and repetition.
- 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
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
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
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.
What is inside Levo
Six ways to work the same material.
Program Control Structures revision questions
- Is Program Control Structures examined at AS in CCEA Software Systems Development?
- Yes. It sits in AS Unit 1, which you take in the first year, so it is on the AS paper as well as counting towards the full A level.
- What does Program Control Structures cover in CCEA AS-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.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.