Computer Science For First Examination In 2021 9618 · 20

Further programming

152 questions. Open a question to solve it and check the official answer.

2023 May-June · Paper 43 · Q1(a)(ii)

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]

2022 October-November · Paper 33 · Q11(a)

Programming paradigms · 3 marks · official answer ready

11 (a) Define these Object-Oriented Programming (OOP) terms: Instance .............................................................................................................…

2022 October-November · Paper 42 · Q2(a)

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. …

2022 October-November · Paper 42 · Q2(b)

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

2022 October-November · Paper 42 · Q2(c)

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]

2022 October-November · Paper 42 · Q2(d)

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…

2022 October-November · Paper 42 · Q2(e)

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…

2022 October-November · Paper 42 · Q2(f)

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…

2022 October-November · Paper 42 · Q2(g)(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…

2022 October-November · Paper 42 · Q2(g)(ii)

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(…

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

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…

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

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

2022 October-November · Paper 43 · Q2(a)(iii)

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…

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

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…

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

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.…

2022 October-November · Paper 43 · Q2(b)(iii)

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…

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

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…

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

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…

2022 October-November · Paper 43 · Q2(c)(iii)

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

2021 October-November · Paper 31 · Q2

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 …