Practice IB Computer Science (CS) Topic 4.3 Introduction to Programming with authentic exam-style questions for both SL and HL students. This question bank focuses on the exact syllabus content for 4.3 Introduction to Programming and mirrors Paper 1, 2, 3 style where relevant.
Get instant solutions, detailed explanations, and build confidence with questions aligned to IB examiner expectations.
A company has 600 employees whose names are currently stored using an array called NAMES. The names are stored as surname, first name. For example: Smith, Jane, Uysal, Rafael, Ahmed, Ishmael, Jonsonn, Sara, ...
The names in the array are kept in a random order. However, it would be more useful if they were kept in alphabetical order.
The company's staff list is now organized in arrays in alphabetical order.
A binary search was used to find a specific name in the surname array.
Describe the process a binary search would follow to find a record in the surname array.
Outline one benefit of using sub-programmes to implement your algorithms from the sorting and searching parts of this question.
Construct a pseudocode algorithm that will store the surnames in one array and first names in another.
Construct a pseudocode algorithm that will sort the surnames into alphabetical order using the bubble sort method. The order of the first names must also be changed so that they keep the same index as their corresponding surname.
A school has 100 students. All student names (strings) and student ID numbers (five-digit integers) are held in two separate one-dimensional arrays named SID and SNAMES.
| SID | [0] | SNAMES | |
|---|---|---|---|
| [0] | 10011 | Aron Zucker | |
| [1] | 10002 | [1] | Cary Armand |
| [2] | 11876 | [2] | Pia Baranger |
| [3] | 10122 | [3] | Peter Bow |
| [4] | 22103 | [4] | John Buffet |
| ... | ... | ... | ... |
| [99] | 32000 | [99] | Evan Apples |
For example, student Pia Baranger has ID number 11876.
A binary search algorithm is not used to find a particular name in array SNAMES.
Three collections store the student ID numbers of students who have chosen each sport:
Each Collection supports the methods resetNext(), hasNext() and getNext().
State the reason for not using a binary search.
Construct an algorithm in pseudocode for the method isIn(x, COL).
Construct an algorithm in pseudocode that will output the number of students who have chosen both tennis and football. The method isIn() should be used in your answer.
Construct an algorithm in pseudocode that will output the names of students who have not yet chosen any one of the three sports. An appropriate message should be displayed if every student has chosen a sport.
IB Computer Science SL Paper 1
Construct a logic diagram for the following expression. NOT A OR (A AND B)
Outline two advantages of developing software in a high-level language, such as Java, rather than a low-level language, such as Assembly.
Define the term variable.