Further programming
152 questions. Open a question to solve it and check the official answer.
Programming paradigms · 2 marks · official answer ready
(i) Write program code to declare the class LinkedList and its constructor. Do not declare the other methods. Use your programming language appropriate constructor. If you are wri…
Programming paradigms · 4 marks · official answer ready
(ii) The method InsertNode(): • takes an integer as a parameter • creates a new node with the parameter as the integer data • uses the new node’s method SetNextNode() to store the…
Programming paradigms · 3 marks · official answer ready
(i) The main program creates a new LinkedList object and uses the appropriate method to insert five nodes with the following integer data values in the order given: 10 20 30 40 50…
Programming paradigms · 2 marks
4 56 67 44 43 32 31 345 45 6 54 1 Save your program as Question2_J25. Copy and paste the program code into part 2(a) in the evidence document. [1] (f) (ii) Test your program. Take…
Programming paradigms · 5 marks · official answer ready
(b) Complete the class diagram for Pet, to include: • an attribute and data type for the name of the pet • an attribute and data type for the name of the owner • a method to creat…
Programming paradigms · 3 marks · official answer ready
(a) Outline the structure of a class. .............................................................................................................................................…
Programming paradigms · 3 marks · official answer ready
(b) Give three differences between an object and a class. 1 .......................................................................................................................…
Programming paradigms · 5 marks · official answer ready
(b) Complete the class diagram for Pet, to include: • an attribute and data type for the name of the pet • an attribute and data type for the name of the owner • a method to creat…
File processing and exception handling · 6 marks · official answer ready
(a) The text file Data.txt stores string data items. Each data item is on a new line in the text file. The function ReadData(): • has a local array of strings that can store 45 it…
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…
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…
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…
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
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…
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…
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…
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…
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 …
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…
Programming paradigms · 4 marks · official answer ready
(i) Write program code to declare the class EventItem and its constructor. Do not declare the other methods. Use your programming language’s appropriate constructor. All attribute…
