Photo AI

SECTION A GENERAL PROGRAMMING SKILLS Do the following: Open the incomplete program in the Question 1 folder - NSC Information Technology - Question 1 - 2021 - Paper 1

Question icon

Question 1

SECTION-A---GENERAL-PROGRAMMING-SKILLS---Do-the-following:---Open-the-incomplete-program-in-the-Question-1-folder-NSC Information Technology-Question 1-2021-Paper 1.png

SECTION A GENERAL PROGRAMMING SKILLS Do the following: Open the incomplete program in the Question 1 folder. Enter your examination number as a comment in th... show full transcript

Worked Solution & Example Answer:SECTION A GENERAL PROGRAMMING SKILLS Do the following: Open the incomplete program in the Question 1 folder - NSC Information Technology - Question 1 - 2021 - Paper 1

Step 1

FormCreate event

96%

114 rated

Answer

To set the properties of the label lblQ1_1:

  • Set the caption to 'Coding'.
  • Set the font color to green using: lblQ1_1.Font.Color := clGreen;
  • Set the font size to 16 pt with: lblQ1_1.Font.Size := 16;
  • Set the font name to 'Arial' using: lblQ1_1.Font.Name := 'Arial';

Step 2

Button [1.2 - Number of rolls]

99%

104 rated

Answer

In this case, define a constant for SWEETS_PER_ROLL and create integer variables:

  • Use const SWEETS_PER_ROLL = 8;.
  • Declare integer variables for storing breaks from the spin edit, total number of rolls, etc.
  • Extract the number of breaks from the spin edit box.
  • Calculate total number of rolls using: ext{Total Rolls} = rac{ ext{Sweets}}{ ext{SWEETS_PER_ROLL}}
  • Round up using Ceil function,
  • Finally, display the total number of rolls in the label lblQ1_2.

Step 3

Button [1.3 - Calculate volume]

96%

101 rated

Answer

For the volume calculations:

  • Set rRadius := 3;.
  • The volume of the tetrahedron is given as 133 cm³. You can compute the volume of the sphere using: Vsphere=43πr3V_{sphere} = \frac{4}{3} \pi r^3
  • Calculate the combined volume as:
    Vcombined=133+12VsphereV_{combined} = 133 + \frac{1}{2} V_{sphere}
  • Finally, display the result in a ShowMessage box formatted to one decimal place.

Step 4

Button [1.4 - Display pattern]

98%

120 rated

Answer

To display the pattern:

  • Clear the output area: redQ1_4.Clear;
  • Extract the symbol selected from cmbQ1_4.
  • Use iSize = Position of symbol in cmbQ1_4 + 1; to define the size of rows and columns.
  • Loop through rows from 0 to iSize, and for each row, loop through columns and print the symbol.
  • Construct the output using a string variable.

Step 5

Button [1.5 - Characters]

97%

117 rated

Answer

To generate the random uppercase letter:

  • First, generate a random number r in the range 0 to 25, then convert it to a character using: chr(r + 65) where 65 is the ASCII value for 'A'.
  • Use a loop to compile the string until the same letter is generated consecutively.
  • Display the final string in redQ1_5.

Join the NSC students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;