5.1 The travel agency uses the interface below as a booking form for holiday accommodation - NSC Information Technology - Question 5 - 2017 - Paper 2
Question 5
5.1 The travel agency uses the interface below as a booking form for holiday accommodation. The different types of available accommodation can be categorised as 'cam... show full transcript
Worked Solution & Example Answer:5.1 The travel agency uses the interface below as a booking form for holiday accommodation - NSC Information Technology - Question 5 - 2017 - Paper 2
Step 1
5.1.1(a)(i) Valid data
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Valid data refers to information that meets the specific criteria or format defined for an input field. It ensures that the data entered is appropriate for the intended use and conforms to the expected type, such as numbers for age or a specific date format for a booking.
Step 2
5.1.1(a)(ii) Verified data
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Verified data indicates that the user has confirmed the correctness of the data they have entered. This can involve reviewing the input against the requirements or checking it for consistency before it is processed or stored.
Step 3
5.1.1(b)
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The component suggested for data input in QUESTION 5.1.1, such as a dropdown menu for accommodation type, ensures valid data entry by restricting users to a predefined list of options. This minimizes the risk of invalid entries and enforces data integrity by only allowing acceptable values.
Step 4
5.2.1 Logical error
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
A logical error occurs when the program runs without crashing, but it produces incorrect results. This often happens due to flawed logic in the algorithm or incorrect assumptions about how the data should be manipulated.
Step 5
5.2.2(a) Replace x and y
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
In the statement arrVisitors[x, y] = total, replace x with counter1 and y with 2. This ensures that the correct total for visitors is stored in the appropriate column of the 2D array.
Step 6
5.2.2(b) Insert statement correctly
97%
121 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The statement should be inserted in option A, which is between lines 6 and 7, to capture the total after it is calculated for each month.
Step 7
5.2.3 Changes in the algorithm
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Changes needed include:
For counter1 ← 1 to 12
total ← 0
For counter2 ← 1 to 2
total ← total + arrVisitors[counter1, counter2]
This updates the algorithm to find the sum of visitors instead of rows.
Step 8
5.2.4 Pseudocode to swap values
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To swap the values for 'Fun park' and 'Animal park' for May, use the following pseudocode:
This correctly swaps the visitors' numbers for May.
Step 9
5.3.1 OOP abbreviation
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
OOP stands for Object-Oriented Programming. It is a programming paradigm based on the concept of 'objects', which can contain data and methods together.
Step 10
5.3.2 Purpose of a constructor
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The purpose of a constructor method in a class is to initialize new objects and set initial values for their attributes when the object is created. It ensures that an object is in a valid state before use.
Step 11
5.3.3 Necessity of numberOfDays
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
It is not necessary to have numberOfDays as an attribute because it can be calculated from other attributes like startDate and endDate. This avoids redundancy and keeps the class design simplified.
Step 12
5.3.4 Implication of calcDays() as a private method
97%
121 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Declaring the method calcDays() as a private method means it can only be accessed within the class itself. This encapsulation protects its implementation from external modification and ensures the method's integrity.
Step 13
5.3.5 Importance of setStartDate() method
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The setStartDate() method is essential because it allows for changing the starting date of a booking after its creation. This promotes flexibility in the object's use and helps meet changing user needs.
Step 14
5.3.6 Purpose of toString() method
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The toString() method is used to provide a string representation of the object, combining all attributes into a readable format. This makes it easier to display object details and debug during development.