INFORMATION TECHNOLOGY
PAPER 1
GRADE 12
NSC PAST PAPERS AND MEMOS
FEBRUARY/MARCH 2018
INSTRUCTIONS AND INFORMATION
NOTE:
Candidates must use the file DataENGMarch2018.exe.
Do the following:
Once extracted, the following list of files will be available in the folder DataENGMarch2018:
SUPPLIED FILES
Question 1:
Question 2:
Question 3:
SECTION A
QUESTION 1: GENERAL PROGRAMMING SKILLS
Do the following:
1.1 Button [1.1 – Total area]
The user must use the edit boxes provided to enter the radius of the circle and the base and height of one of the triangles in the figure.
Write code to do the following:
Example of input:
Example of output:
Area of circle = 233.433959996 Total area of triangles = 112.6912 Total area = 346.13 |
(12)
1.2 Button [1.2 – Next blue moon]
The first blue moon was seen in the year 1862. Thereafter, a blue moon was seen every three years.
Extract the year in which the first blue moon was seen from the lblInfo label. Use the year from the system date and the year extracted from the label to determine the year when the next blue moon will appear (excluding the current year). Display the output in the edit box provided. (9)
Example of output:
1.3 Button [1.3 – Highest common factor]
The user must enter two integer numbers. The highest common factor is the largest number that can divide into the two numbers without a remainder.
Write code to do the following:
Example of input and output:
(10)
1.4 Button [1.4 – Remove vowels]
The user must enter a sentence in the edit box provided.
Write code to do the following:
(11)
1.5 Button [1.5 – Slide show]
A space exhibition centre presents a slide show to visitors in their conference centre which seats 100 people. Groups of people can attend the slide show as long as there are seats available for all the people in the group. Groups who can be accommodated will each be assigned a number, starting with the value 1 for the first group, 2 for the second group, and so on. If large groups are rejected, smaller groups can still be accommodated until all the seats are taken.
Write code to do the following:
NOTE: Even though some of the groups will not be accepted to attend the slide show, the program must continue to allow the user to enter groups until a total of 100 people are accepted to attend the slide show.
(12)
|
TOTAL SECTION A: 54
SECTION B
QUESTION 2: OBJECT-ORIENTATED PROGRAMMING
A constellation is a group of related stars that covers the night sky. Some stars are considered to be navigational, while others are passive. A navigational star is used to assist with direction and movement. |
Do the following:
2.1 An incomplete object class called TStar, which represents a celestial star, has been provided.
The declaration of the attributes and an accessor method for the fName attribute (getName) has been provided.
The attributes for the Star object have been declared as follows:
NAMES OF ATTRIBUTES | DESCRIPTIONS |
fName | Name of the star |
fMagnitude | The magnitude of a star is related to its brightness. The magnitude of the brightest star is -1. As the magnitude of a star increases, the star gets dimmer. Example: The magnitude of a dim star, such as Mimosa, is 1.25. |
fDistance | The distance of a star from Earth is an integer value measured in light years. Example: The distance of the star Mimosa from Earth is 279 light years. |
fConstellation | The name of the constellation the star belongs to |
fNavigationalStatus | A Boolean value which indicates whether the star is regarded as a navigational star or not |
2.1 Complete the code in the object class, as described in QUESTION 2.1.1 to QUESTION 2.1.5 below.
2.1.1 Write code for a constructor method that will receive the name of the star, its magnitude, its distance from Earth and the constellation it belongs to as parameters. Set the FOUR respective attributes to the received parameter values and initialise the fNavigationalStatus attribute to 'false'. (4)
2.1.2 Write code to create an accessor method for the constellation attribute fConstellation. (2)
2.1.3 Write code for a mutator method called setNavigationalStatus, which will receive a Boolean value as a parameter and set the navigational status attribute to the received value. (3)
2.1.4 Write code for a method called determineVisibility that will determine and return a description of the visibility of the star. The visibility of a star depends on its distance from Earth in light years and its magnitude.
Use the following criteria to determine the description of visibility that applies to a star: (11)
DISTANCE | MAGNITUDE | DESCRIPTION OF VISIBILITY |
Fewer than 80 light years | Any value | Clearly visible |
Between 80 and 900 light years (inclusive) | Up to 2 | Hardly visible to the naked eye |
Larger than 2 | Visible by means of standard optical aid | |
More than 900 light years | Any value | Only visible by means of specialised optical aid |
2.1.5 Write code to create a toString method which returns a string formatted as follows, depending on whether the star is a navigational star or not:
<name of star> belongs to the <constellation> constellation.
The star has a magnitude of <magnitude> and is <distance from Earth> light years away from Earth.
If the star is a navigational star, add the following line:
<name of star> is a navigational star.
If the star is NOT a navigational star, add the following line:
<name of star> is a passive star. (6)
2.2 An incomplete unit, Question2_U, has been provided which contains code for the following:
A text file called StarData.txt contains the data of an unknown number of stars (both passive and navigational). The details of each star appears in the following format in the file:
<common name of the star> |
Example of the details of the first two stars in the text file:
Acrux Mimosa |
Do the following to complete the code for the buttons in the main form unit, as described below:
2.2.1 Button [2.2.1 – Instantiate object]
The user is required to select the name of a star in the combo box. Write code to do the following:
2.2.2 Button [2.2.2 – Display]
Display the details of the star in the rich edit component redQ2 using the toString method.
Load the image of the constellation that the star belongs to into the imgQ2 image component. The file name of the image to be displayed is the name of the constellation the star belongs to. The image files have the extension .jpg.
Example of output if the selected star is Mimosa:
(3)
2.2.3 Button [2.2.3 – Visibility]
The brightness and visibility of a star is dependent on the magnitude and the distance of the star from Earth. Call the relevant methods to display the name and visibility of the star.
(3)
TOTAL SECTION B: 56
SECTION C
QUESTION 3: PROBLEM-SOLVING PROGRAMMING
SCENARIO |
Do the following:
Supplied GUI:
The GUI below represents the interface of the program.
NOTE:
Supplied code:
The program contains the following code for the declaration of a two-dimensional array called arrGame:
arrGame: array [1..9, 1..9] of char;
The program must do the following:
3.1 Button [3.1 – Start game]
A dash character (-) represents an open space in the two-dimensional array arrGame and a hash character (#) represents a planet.
The two-dimensional array must first be populated with open-space characters. Its content must be displayed in the game board area.
The level of difficulty selected from the radio group rgbQ3 determines the number of planets to be placed randomly in arrGame. The following applies:
Difficulty level 1: 50 positions in the array must be replaced by planets (#)
Difficulty level 2: 40 positions in the array must be replaced by planets (#)
Difficulty level 3: 30 positions in the array must be replaced by planets (#)
The value '0' must be displayed on panel pnlQ3NumberOfGuesses, which indicates the total number of guesses.
The 'Play' button must be enabled and the rich edit components cleared.
NOTE: The positions of the planets on the game board should NOT be visible (not displayed) to the player.
Example of output when the Start game button is clicked:
(22)
3.2 Button [3.2 – Play]
The player must guess the position of a planet by selecting a row number and a column number from the combo boxes provided. Then click the 'Play' button to see whether the position of a planet was guessed correctly.
If the position of a planet is guessed correctly:
HINT: Replace the planet character (#) that was guessed correctly with another character to show which planets were identified during the game play session. This information is required for Button 3.3 ('Reveal planets').
If the position guessed is NOT the position of a planet:
The player must be able to guess the positions of planets repeatedly until he/she wins or loses the game.
NOTE: A game is won as soon as the positions of two planets are correctly guessed within the allowed five guesses.
Use a message box to display a suitable message based on the outcome of the game, either 'Game won' or 'Game lost'.
Disable the play button when the game is over.
Example of output if the positions of two planets were guessed correctly within two guesses:
Example of output if the player lost the game. The position of only one planet was guessed correctly within five guesses:
(13)
3.3 Button [3.3 – Reveal planets]
Write code to display the game board with all the randomly placed planets revealed.
Example of the output if the planets were randomly placed but the player has not played yet:
Example of output if the player won by identifying the positions of two planets within two guesses:
NOTE: The array in the sample output may be different because the indices for the planet symbols are randomly generated. (5)
|
TOTAL SECTION D: 40
GRAND TOTAL: 150