Practice IB Computer Science (CS) Topic 4.2 Connecting Computational Thinking and Program Design with authentic exam-style questions for both SL and HL students. This question bank focuses on the exact syllabus content for 4.2 Connecting Computational Thinking and Program Design 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)
Jackson City University has a Music Department that provides music lessons to students in a number of high schools in the city. The Jackson City University Music Department teachers visit the different schools in the city to teach students a range of musical instruments. The following diagram shows an unnormalized table of student data. | Student_
ID | First_
Name | Family__
Name | Date_of_
birth | Student_Choice | School | School__
Post_Code | School_
phone_no |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| 305 | JOE | PARKAR | | VIOLIN,
PERCUSSION | Tampines | 512233 | 065544335,
065544336 |
| 306 | MARY | ALCHIN | | GUITAR,
KEYBOARD | Arab
Street | 198876 | 065543213 |
| 307 | RAM | WONG | | GUITAR | Bedok | 467501 | 06543321,
065433222 |
| 308 | KATE | MOHAMA | | PERCUSSION | Simei | 512233 | 065444412 |
| 309 | RYAN | TAN | | GUITAR | Seng
Kang | 208563 | 065667898 |
| 310 | PHILIP | BALMER | | VIOLIN | Orchard | 309893 | 065756379 |
| 311 | MIKE | MOSES | | GUITAR | Clementi | 308978 | 065745677 |
| | | | | | | | |
Explain one benefit of normalizing a database.
Identify three ways that incorrect data could be prevented from being added into the School_phone_no field.
Outline what would be necessary to make the above unnormalized table conform to 1st Normal Form (1NF).
Construct the 3rd Normal Form (3NF) of the unnormalized relation shown above.
Explain the difference between 2nd Normal Form (2NF) and 3rd Normal Form (3NF).
A medical centre uses a computer system to manage both patients’ data and appointments. This system, which is used by the doctors, nurses and secretaries, has two unordered files: a patients’ file and an appointments’ file, both of which can only be accessed sequentially.
Every evening the following processing takes place:
Outline the logical steps that the processing must follow when the system sends out the text reminders.
Describe two different methods that the medical centre could use that would allow data to be restored should it be lost for any reason.
The medical centre is concerned about the privacy of the data it is storing and has to make decisions concerning:
Discuss the issues that should be considered before making these decisions.