Computer Science For First Examination In 2021 9618 · 20

20.1 Programming paradigms

145 questions in this subtopic. Open a question to solve it and check the official answer.

Reset
2024 October-November · Paper 42 · Q1(c)

Programming paradigms · 4 marks · official answer ready

(c) The class Character stores data about the characters in the game. Each character has a skill level for each type of event. The skill level is an integer between 1 and 5 inclus…

2024 October-November · Paper 42 · Q1(d)

Programming paradigms · 4 marks · official answer ready

(d) The method CalculateScore() in the Character class calculates and returns the percentage chance of a character completing an event. When a character’s skill level is greater t…

2024 October-November · Paper 42 · Q1(e)

Programming paradigms · 0 marks

1 A computer game is designed for users to select characters. Each character can take part in a group of events. Each group has five events. There are four types of event: jump, s…

2024 October-November · Paper 42 · Q1(e)(i)

Programming paradigms · 2 marks · official answer ready

(i) Amend the main program to declare and create an instance of a Character object for Tarz and for Geni. Save your program. Copy and paste the program code into part 1(e)(i) in t…

2024 October-November · Paper 42 · Q1(e)(ii)

Programming paradigms · 7 marks · official answer ready

(ii) Both characters Tarz and Geni take part in each event in the group you created in part 1(b). These steps are repeated for all five events: • The percentage chance of each cha…

2024 October-November · Paper 42 · Q1(e)(iii)

Programming paradigms · 1 mark · official answer ready

(iii) Test your program. Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 1(e)(iii) in the evidence document. [1] 8

2024 October-November · Paper 43 · Q2(a)(i)

Programming paradigms · 4 marks · official answer ready

(i) Write program code to declare the class Horse and its constructor. Do not declare the other methods. Use your programming language’s appropriate constructor. All attributes mu…

2024 October-November · Paper 43 · Q2(a)(ii)

Programming paradigms · 3 marks · official answer ready

(ii) The get methods GetName() and GetMaxFenceHeight() each return the relevant attribute. Write program code for the get methods. Save your program. Copy and paste the program co…

2024 October-November · Paper 43 · Q2(b)(i)

Programming paradigms · 5 marks · official answer ready

(i) The program has two horses: • The horse named ‘Beauty’ can jump a maximum height of 150 cm and has a success percentage rate of 72%. • The horse named ‘Jet’ can jump a maximum…

2024 October-November · Paper 43 · Q2(b)(ii)

Programming paradigms · 1 mark · official answer ready

(ii) Test your program. Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 2(b)(ii) in the evidence document. [1] 8

2024 October-November · Paper 43 · Q2(c)(i)

Programming paradigms · 4 marks · official answer ready

(i) Write program code to declare the class Fence, its constructor and get methods. Use your programming language’s appropriate constructor. All attributes must be private. If you…

2024 October-November · Paper 43 · Q2(c)(ii)

Programming paradigms · 5 marks · official answer ready

(ii) The array Course stores four Fence objects. The user inputs the height and risk for each fence, and these are validated before each fence is created. Amend the main program t…

2024 October-November · Paper 43 · Q2(d)

Programming paradigms · 5 marks · official answer ready

(d) The chance of a horse jumping a fence without knocking it down is calculated as follows. If the height of the fence is more than the maximum height a horse can jump, the succe…

2024 October-November · Paper 43 · Q2(e)(i)

Programming paradigms · 3 marks · official answer ready

(i) Write program code to amend the main program to: • calculate and output the chance of the first horse jumping each of the four fences without knocking each fence down • calcul…

2024 October-November · Paper 43 · Q2(e)(ii)

Programming paradigms · 2 marks · official answer ready

(ii) Write program code to amend the main program to: • calculate and output the average chance of success for each horse jumping over all four fences without knocking each fence …

2024 October-November · Paper 43 · Q2(e)(iii)

Programming paradigms · 2 marks · official answer ready

(iii) Test your program with the following input data for four fences: Height Risk 152 5 121 1 130 3 145 4 Take a screenshot of the output. Save your program. Copy and paste the s…

2024 May-June · Paper 42 · Q2(a)(i)

Programming paradigms · 4 marks · official answer ready

(i) Write program code to declare the class Node and its constructor. Do not declare the other methods. Use the appropriate constructor for your programming language. If you are w…

2024 May-June · Paper 42 · Q2(a)(ii)

Programming paradigms · 3 marks · official answer ready

(ii) The get methods GetLeft(), GetRight()and GetData()each return the relevant attribute. Write program code for the three get methods. Save your program. Copy and paste the prog…

2024 May-June · Paper 42 · Q2(a)(iii)

Programming paradigms · 3 marks · official answer ready

(iii) The set methods SetLeft(), SetRight()and SetData()each take a parameter and then store this in the relevant attribute. Write program code for the three set methods. Save you…

2024 May-June · Paper 42 · Q2(b)(i)

Programming paradigms · 4 marks · official answer ready

(i) Write program code to declare the class TreeClass and its constructor. Do not declare the other methods. Use the appropriate constructor for your programming language. If you …