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
Explain the following concepts:
(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 required criteria for a specific format, range, or type of data. For example, an input field for a date should only accept date values and not text or symbols.
Step 2
(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 that the correct option has been selected or correct data has been entered. This is often achieved through confirmation messages or review prompts before submission.
Step 3
Explain how the component suggested for data input (1) in QUESTION 5.1.1 will ensure that valid data is entered.
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
Using the appropriate input components, such as drop-down lists or radio buttons, restricts user input to predefined options. This reduces the chance of invalid data entry, as users can only select from valid choices.
Step 4
Explain what is meant by a 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 produces incorrect results or output due to flawed logic or calculations.
Step 5
Replace x and y in the statement, so that the total for each month will be correctly stored in the 2D array.
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
Replace x and y with counter1 and 3, respectively, in the statement so that it reads: arrVisitors[counter1, 3] ← total.
Step 6
Which ONE of the statements (A–C) below describes the position in the algorithm where this statement must be inserted 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
A, between lines 6 and 7.
Step 7
Indicate the changes that need to be made in lines 2 to 5.
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
Modify line 2 to reflect the correct counting of columns instead of rows. Use:
For counter1 ← 1 to 2
total ← 0
For counter2 ← 1 to 12
total ← total + arrVisitors[counter2,counter1]
End inner loop
End outer loop
This allows the calculation of totals for each park.
Step 8
Write pseudocode to swap the two values in the array.
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Sign up now to view full answer, or log in if you already have an account!
Answer
OOP stands for Object-Oriented Programming, which is a programming paradigm based on the concept of 'objects' that can contain data and code.
Step 10
What is the purpose of a constructor method in a class?
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 is to initialize an object when it is created, setting initial values for its attributes.
Step 11
Motivate why it is NOT necessary to have the field numberOfDays as an attribute of the class.
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 derived from other attributes (like startDate and endDate) whenever needed, thus avoiding redundancy.
Step 12
What is the implication of declaring the method 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 calcDays() as a private method means it cannot be accessed outside the class, promoting encapsulation and restricting unintended interference.
Step 13
Explain why a setStartDate(startDate) can alter the state of the booking changed.
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(startDate) method allows external code to change the start date attribute of the object. This method alters the state by updating the object's properties.
Step 14
Explain the purpose of a 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 the attributes into a single readable format.