Computer Science 9608 · 20

20.1 Programming paradigms

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

Reset
2017 May-June · Paper 41 · Q4(c)(v)

Programming paradigms · 5 marks · official answer ready

(v) The OutputListToConsole method is to output all the data stored in the linked list. HeadPointer points to the first list node. Write program code for this method. Programming …

2017 May-June · Paper 41 · Q4(c)(vi)

Programming paradigms · 6 marks · official answer ready

(vi) The structured English for the AddToList(NewString) method is as follows: Make a copy of the value of free list pointer, name it NewNodePointer Store new data item in free no…

2017 May-June · Paper 42 · Q3(a)

Programming paradigms · 3 marks · official answer ready

(a) The programmer designed the pseudocode for the main program as follows: DECLARE Island : IslandClass.Constructor() // instantiate object CALL DisplayGrid() // output island sq…

2017 May-June · Paper 42 · Q3(b)

Programming paradigms · 5 marks · official answer ready

(b) Write program code to declare the IslandClass and write the constructor method. The value to represent sand should be declared as a constant. Programming language used .......…

2017 May-June · Paper 42 · Q3(c)(i)

Programming paradigms · 2 marks · official answer ready

(i) Write program code for the GetSquare(Row, Column) getter method. ..............................................................................................................…

2017 May-June · Paper 42 · Q3(c)(ii)

Programming paradigms · 4 marks · official answer ready

(ii) Write program code for the DisplayGrid procedure. ............................................................................................................................…

2017 May-June · Paper 42 · Q3(d)

Programming paradigms · 5 marks · official answer ready

(d) Write program code for the HideTreasure method. Your method should check that the random location generated does not already contain treasure. The value to represent treasure …

2017 May-June · Paper 42 · Q3(e)(i)

Programming paradigms · 3 marks · official answer ready

(i) The DigHole method takes two integers as parameters. These parameters form a valid grid location. The location is marked with 'X' or 'O' as appropriate. Write program code for…

2017 May-June · Paper 42 · Q3(e)(ii)

Programming paradigms · 5 marks · official answer ready

(ii) The StartDig procedure: • prompts the player for a location to dig • validates the user input • calls the DigHole method from part (e)(i). Write program code for the StartDig…

2017 May-June · Paper 42 · Q3(f)(i)

Programming paradigms · 1 mark · official answer ready

(i) The squares in the IslandClass grid could have been declared as objects of a Square class. State the term used to describe the relationship between IslandClass and Square. ...…

2017 May-June · Paper 42 · Q3(f)(ii)

Programming paradigms · 2 marks · official answer ready

(ii) Draw the appropriate diagram to represent this relationship. Do not list the attributes and methods of the classes. [2] 18 19 20 reasonable effort has been made by the publis…

2017 May-June · Paper 43 · Q4(a)(i)

Programming paradigms · 1 mark · official answer ready

(i) State the term used to describe the relationship between these classes. .......................................................................................................…

2017 May-June · Paper 43 · Q4(a)(ii)

Programming paradigms · 2 marks · official answer ready

(ii) Draw the appropriate diagram to represent this relationship. Do not list the attributes and methods of the classes. [2] 9

2017 May-June · Paper 43 · Q4(b)

Programming paradigms · 5 marks · official answer ready

(b) The design for the Node class consists of: • attributes Data : STRING Pointer : INTEGER • methods CreateNode(Data, Pointer) SetData(Data) SetPointer(Pointer) GetData() RETURNS…

2017 May-June · Paper 43 · Q4(c)(i)

Programming paradigms · 1 mark · official answer ready

(i) Explain the meaning of the term null pointer. .................................................................................................................................…

2017 May-June · Paper 43 · Q4(c)(ii)

Programming paradigms · 2 marks · official answer ready

(ii) Give an appropriate value to represent the null pointer for this design. Justify your answer. ................................................................................…

2017 May-June · Paper 43 · Q4(c)(iii)

Programming paradigms · 7 marks · official answer ready

(iii) Write program code for the LinkedList class declaration and the constructor. Programming language used ......................................................................…

2017 May-June · Paper 43 · Q4(c)(iv)

Programming paradigms · 1 mark · official answer ready

(iv) Write program code to instantiate a linked list object with the contacts identifier. Programming language used ...............................................................…

2017 May-June · Paper 43 · Q4(c)(v)

Programming paradigms · 5 marks · official answer ready

(v) The OutputListToConsole method is to output all the data stored in the linked list. HeadPointer points to the first list node. Write program code for this method. Programming …

2017 May-June · Paper 43 · Q4(c)(vi)

Programming paradigms · 6 marks · official answer ready

(vi) The structured English for the AddToList(NewString) method is as follows: Make a copy of the value of free list pointer, name it NewNodePointer Store new data item in free no…