Open the incomplete project file called Question1_P.dpr in the Question 1 folder - NSC Information Technology - Question 1 - 2020 - Paper 1
Question 1
Open the incomplete project file called Question1_P.dpr in the Question 1 folder.
Enter your examination number as a comment in the first line of the Question1_U.pas... show full transcript
Worked Solution & Example Answer:Open the incomplete project file called Question1_P.dpr in the Question 1 folder - NSC Information Technology - Question 1 - 2020 - Paper 1
Step 1
Button [1.1 - Colours]
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
To implement the button functionality for changing the combo box, you should:
Change the font size of cmbQ1_1 to 12pt.
Add 'Blue' to the combo box cmbQ1_1.
Set the item index of cmbQ1_1 to 0, making 'Green' the default selection.
Step 2
Button [1.2 - Kite]
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 calculate the area of the kite, you need to:
Declare a variable rArea to store the area.
Check if idiagA is greater than idiagB.
If true, compute the area using:
rArea=2idiagA×idiagB
Display the result in label formatted to one decimal place.
If false, show an error message.
Step 3
Button [1.3 - Binary number]
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
To convert an integer to a binary number, follow these steps:
Retrieve the integer from edtQ1_3 and convert it.
Initialize sBinary as an empty string.
While the decimal value is greater than 0, execute:
Compute decimalValue MOD 2 to get the remainder.
Prepend the remainder to sBinary.
Divide the integer value by 2 for the next iteration.
Display the binary string in label lblQ1_3.
Step 4
Button [1.4 - Word game]
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
For the word game, you need to:
Read the input from edtQ1_4 and convert it to uppercase.
Check if multiple words are entered (look for spaces); if true, clear the input and set focus back to the edit box.
If it’s valid, initialize a score variable.
Loop through each character in the input word:
If the character is a vowel, add 3 points.
If it’s a consonant, add 2 points.
If it’s a special character or space, add 1 point.
Finally, display the total score in a designated output area.