Further programming
152 questions. Open a question to solve it and check the official answer.
File processing and exception handling · 4 marks · official answer ready
(ii) Amend the main program to read the contents of Data.txt into DataArray Save your program. Copy and paste the program code into part 1(a)(ii) in the evidence document. [4]
Programming paradigms · 3 marks · official answer ready
11 (a) Define these Object-Oriented Programming (OOP) terms: Instance .............................................................................................................…
Programming paradigms · 4 marks · official answer ready
(a) Write program code to declare the class Character and its constructor. Do not write program code for the other methods. Use your programming language appropriate constructor. …
Programming paradigms · 3 marks · official answer ready
(b) Write program code for the three get methods for the class Character. Save your program. Copy and paste the program code into part 2(b) in the evidence document. [3] 6
Programming paradigms · 2 marks · official answer ready
(c) Write program code for the method ChangePosition(). Save your program. Copy and paste the program code into part 2(c) in the evidence document. [2]
Programming paradigms · 7 marks · official answer ready
(d) The main program has a 1D array of characters. Each character is stored as an object of type Character. The game has a maximum of 10 characters. The character names, x coordin…
Programming paradigms · 5 marks · official answer ready
(e) The main program needs to read in a character’s name from the user, search for the character in the array and store the index of its position. It repeats until the user enters…
Programming paradigms · 7 marks · official answer ready
(f) The user will enter a letter to identify the direction the chosen character from part 2(e) should move. • If ‘A’ is input, the character moves left (x coordinate minus 1). • I…
Programming paradigms · 2 marks · official answer ready
(i) When a change to a character’s position has been made, the program needs to output the character’s name and the new x and y coordinates of the character, in the format: Qui ha…
Programming paradigms · 1 mark · official answer ready
(ii) Test your program by inputting the following four items of data in the order given: THOMAS qui X A Take a screenshot of the output. Copy and paste the screenshot into part 2(…
Programming paradigms · 5 marks · official answer ready
(i) Write program code to declare the class Card, its attributes and constructor. Do not write program code for the get methods. Use your programming language appropriate construc…
Programming paradigms · 3 marks · official answer ready
(ii) Write program code for the class methods GetNumber() and GetColour(). Save your program. Copy and paste the program code into part 2(a)(ii) in the evidence document. [3] 5
Programming paradigms · 2 marks · official answer ready
(iii) The program is tested with the following cards: Number Colour 1 red 2 red 3 red 4 red 5 red 1 blue 2 blue 3 blue 4 blue 5 blue 1 yellow 2 yellow 3 yellow 4 yellow 5 yellow W…
Programming paradigms · 6 marks · official answer ready
(i) Write program code to declare the class Hand, its attributes and constructor. Do not write the get methods. Use your programming language appropriate constructor. All attribut…
Programming paradigms · 2 marks · official answer ready
(ii) The get method GetCard() takes an index as a parameter and returns the card stored at that index in the array. Write program code for the method GetCard(). Save your program.…
Programming paradigms · 2 marks · official answer ready
(iii) Two players are declared with 5 cards each. Player 1 has the cards: 1 red, 2 red, 3 red, 4 red, 1 yellow. Player 2 has the cards: 2 yellow, 3 yellow, 4 yellow, 5 yellow, 1 b…
Programming paradigms · 6 marks · official answer ready
(i) Write program code for the function CalculateValue(). Assume that there are only 5 cards in the player’s hand in this function. Save your program. Copy and paste the program c…
Programming paradigms · 4 marks · official answer ready
(ii) Amend the main program by writing program code to use the function CalculateValue() for each of the two players. The player with the highest score wins. Output an appropriate…
Programming paradigms · 1 mark · official answer ready
(iii) Test your program. Take a screenshot to show the output. Copy and paste the screenshot into part 2(c)(iii) in the evidence document. [1] 8
Programming paradigms · 4 marks · official answer ready
2 Draw one line from each programming paradigm to its most appropriate description. Programming paradigm Description Programs using the instruction set of a processor Declarative …
