In some countries, on the third Sunday in March, daylight saving time begins when clocks move forward by one hour. A module AdjustClock() will take an integer parameter representing a year. The module will return an integer value representing the number of the day in March on which the clocks move forward. For example, the following line of pseudocode would assign DayNumber the value 20: DayNumber ← AdjustClock(2022) Write pseudocode for the function AdjustClock(). Date functions from the insert should be used in your solution.
- Write pseudocode for the function AdjustClock(). Date functions from the insert should be used in your solution.[7]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2024). The mark or mark type is shown in brackets.
- [1] MP1 Function heading, parameter, ending and return type
- [1] MP2 Declare local integer variable that is used to create a date
- [1] MP3 Loop until 3rd Sunday found
- [1] MP4 Attempt to use both SETDATE() and DAYINDEX() in a loop
- [1] MP5 Correctly generate value of type DATE using SETDATE() in a loop
- [1] MP6 Test if value represents a Sunday using DAYINDEX() in a loop
- [1] MP7 Increment Sunday count in a loop and initialised correctly before loop
- [1] MP8 Return day number of third Sunday
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →