Practice B2.3 Programming constructs with authentic IB Computer Science (First Exam 2027) exam questions for both SL and HL students. This question bank mirrors Paper 1, 2, 3 structure, covering key topics like programming concepts, algorithms, and data structures. Get instant solutions, detailed explanations, and build exam confidence with questions in the style of IB examiners.
Define what is meant by "sequence" in programming constructs.
Explain why sequence is considered the most fundamental programming construct and describe how it relates to other programming constructs.
A program needs to calculate a student's final grade by adding homework (40%), midterm (30%), and final exam (30%) scores. Describe the sequence of operations that would be required, explaining why the order matters.
Define what is meant by "guard conditions" in programming constructs.
Explain the importance of guard conditions in preventing infinite loops and handling edge cases.
A program calculates the factorial of a number entered by the user. Describe what guard conditions would be necessary and explain why each is important.
Define what is meant by "iteration" in programming constructs.
Compare pre-test loops (while loops) with post-test loops (do-while loops) in terms of when the condition is checked and minimum number of executions.
A teacher wants to input student grades until they enter -1 to stop. Justify which type of loop would be most appropriate for this scenario and explain why.
State two types of iteration construct commonly found in programming languages.
Explain the difference between definite iteration and indefinite iteration, providing an example scenario for each.
A program processes a list of 100 student records to calculate average scores. Analyse why a definite iteration construct would be more suitable than indefinite iteration for this task.
State what is meant by "selection" in programming constructs.
Distinguish between simple selection (if-then) and complex selection (if-then-else), providing scenarios where each would be most appropriate.
A grade classification system assigns letter grades based on numerical scores: A (90-100), B (80-89), C (70-79), D (60-69), F (below 60). Explain why nested or multiple selection statements would be necessary for this system.
Define what is meant by "nested constructs" in programming.
Describe the advantages and potential challenges of using nested programming constructs.
A program needs to find the highest score for each student across multiple subjects, then find the overall highest score among all students. Explain why nested iteration would be necessary for this task.
State what is meant by a "compound condition" in programming.
Explain the role of logical operators (AND, OR, NOT) in creating compound conditions and describe how they affect program flow control.
A login system requires both a valid username AND a valid password, OR administrator privileges. Analyse how compound conditions would be used to implement this logic and discuss the importance of operator precedence.
Define what is meant by "loop control variables" in programming.
Describe the three main components typically found in a for loop and explain the purpose of each component.
A programmer wants to process every third element in an array of 30 elements (elements at positions 0, 3, 6, 9, etc.). Explain how the loop control variable would need to be modified to achieve this.
State what is meant by "control flow" in programming.
Describe how the three fundamental programming constructs (sequence, selection, iteration) work together to create complex program logic.
A student grade management system needs to: read student data sequentially, check if each student passes (selection), and repeat for all students (iteration). Analyse how these constructs would be combined and explain the importance of proper structure.