SlideShare a Scribd company logo
1 of 20
Download to read offline
This document consists of 18 printed pages and 2 blank pages.
DC (KS/CB) 163592/4
© UCLES 2019 [Turn over
Cambridge Assessment International Education
Cambridge International Advanced Subsidiary and Advanced Level
*
5
1
5
4
8
4
3
3
4
7
*
COMPUTER SCIENCE 9608/43
Paper 4 Further Problem-solving and Programming Skills May/June 2019
2 hours
Candidates answer on the Question Paper.
No Additional Materials are required.
No calculators allowed.
READ THESE INSTRUCTIONS FIRST
Write your centre number, candidate number and name in the spaces at the top of this page.
Write in dark blue or black pen.
You may use an HB pencil for any diagrams, graphs or rough working.
Do not use staples, paper clips, glue or correction fluid.
DO NOT WRITE IN ANY BARCODES.
Answer all questions.
No marks will be awarded for using brand names of software packages or hardware.
At the end of the examination, fasten all your work securely together.
The number of marks is given in brackets [ ] at the end of each question or part question.
The maximum number of marks is 75.
2
9608/43/M/J/19
© UCLES 2019
1 (a) A stack contains the values 'red', 'blue', 'green' and 'yellow'.
yellow
green
blue
red
(i) Show the contents of the stack in part(a) after the following operations.
POP()
PUSH('purple')
PUSH('orange')
[1]
Top of stack
3
9608/43/M/J/19
© UCLES 2019 [Turn over
(ii) Show the contents of the stack from part(a)(i) after these further operations.
POP()
POP()
PUSH('brown')
POP()
PUSH('black')
[1]
(b) A queue is an alternative Abstract Data Type (ADT).
Describe a queue.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
4
9608/43/M/J/19
© UCLES 2019
2 A computer games club wants to run a competition. The club needs a system to store the scores
achieved in the competition.
A selection of score data is as follows:
99, 125, 121, 97, 109, 95, 135, 149
(a) A linked list of nodes will be used to store the data. Each node consists of the data, a left
pointer and a right pointer. The linked list will be organised as a binary tree.
(i) Complete the binary tree to show how the score data above will be organised.
RootPointer
RightPointer
99
LeftPointer
97 125
121
∅
The symbol ∅ represents a null pointer.
[5]
5
9608/43/M/J/19
© UCLES 2019 [Turn over
(ii) The following diagram shows a 2D array that stores the nodes of the binary tree’s linked
list.
Add the correct pointer values to complete the diagram, using your answer from
part (a)(i).
RootPointer
0
FreePointer
Index LeftPointer Data RightPointer
0 99
1 125
2 121
3 97
4 109
5 95
6 135
7 149
8
[6]
6
9608/43/M/J/19
© UCLES 2019
(b) The club also considers storing the data in the order in which it receives the scores as a
linked list in a 1D array of records.
The following pseudocode algorithm searches for an element in the linked list.
Complete the six missing sections in the algorithm.
FUNCTION FindElement(Item : INTEGER) RETURNS …………………………………………
…………………………………………… ← RootPointer
WHILE CurrentPointer …………………………………………… NullPointer
IF List[CurrentPointer].Data <> ……………………………………………
THEN
CurrentPointer ← List[……………………………………………].Pointer
ELSE
RETURN CurrentPointer
ENDIF
ENDWHILE
CurrentPointer ← NullPointer
………………………………………… CurrentPointer
ENDFUNCTION
[6]
7
9608/43/M/J/19
© UCLES 2019 [Turn over
(c) The games club is looking at two programming paradigms: imperative and object-oriented
programming paradigms.
Describe what is meant by the imperative programming paradigm and the object-oriented
programming paradigm.
(i) Imperative ..........................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [3]
(ii) Object-oriented ..................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [3]
8
9608/43/M/J/19
© UCLES 2019
(d) Players complete one game to place them into a category for the competition. The games club
wants to implement a program to place players into the correct category. The programmer
has decided to use object-oriented programming (OOP).
The highest score that can be achieved in the game is 150. Any score less than 50 will not
qualify for the competition. Players will be placed in a category based on their score.
The following diagram shows the design for the class Player. This includes the properties
and methods.
Player
Score : INTEGER // initialised to 0
Category : STRING // "Beginner", "Intermediate",
// "Advanced" or "Not Qualified", initialised
// to "Not Qualified"
PlayerID : STRING // initialised with the parameter InputPlayerID
Create() // method to create and initialise an object using
// language-appropriate constructor
SetScore() // checks that the Score parameter has a valid value
// if so, assigns it to Score
SetCategory() // sets Category based on player’s Score
SetPlayerID() // allows a player to change their PlayerID
// validates the new PlayerID
GetScore() // returns Score
GetCategory() // returns Category
GetPlayerID() // returns PlayerID
9
9608/43/M/J/19
© UCLES 2019 [Turn over
(i) The constructor receives the parameter InputPlayerID to create the PlayerID.
Other properties are initialised as instructed in the class diagram.
Write program code for the Create() constructor method.
Programming language .....................................................................................................
Program code
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [5]
10
9608/43/M/J/19
© UCLES 2019
(ii) Write program code for the following three get methods.
Programming language .....................................................................................................
GetScore()
Program code
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
GetCategory()
Program code
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
GetPlayerID()
Program code
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
[4]
11
9608/43/M/J/19
© UCLES 2019 [Turn over
(iii) The method SetPlayerID()asks the user to input the new player ID and reads in this
value.
It checks that the length of the PlayerID is less than or equal to 15 characters and
greater than or equal to 4 characters. If the input is valid, it sets this as the PlayerID,
otherwise it loops until the player inputs a valid PlayerID.
Use suitable input and output messages.
Write program code for SetPlayerID().
Programming language .....................................................................................................
Program code
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [4]
12
9608/43/M/J/19
© UCLES 2019
(iv) The method SetScore()checks that its INTEGER parameter ScoreInput is valid. If
it is valid, it is then set as Score. A valid ScoreInput is greater than or equal to 0 and
less than or equal to 150.
If the ScoreInput is valid, the method sets Score and returns TRUE.
If the ScoreInput is not valid, the method does not set Score, displays an error
message, and it returns FALSE.
Write program code for SetScore(ScoreInput : INTEGER).
Programming language .....................................................................................................
Program code
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [5]
13
9608/43/M/J/19
© UCLES 2019 [Turn over
(v) Write program code for the method SetCategory(). Use the properties and methods
in the original class definition.
Players will be placed in one of the following categories.
Category Criteria
Advanced Score is greater than 120
Intermediate Score is greater than 80 and less than or equal to 120
Beginner Score is greater than or equal to 50 and less than or equal to 80
Not Qualified Score is less than 50
Programming language .....................................................................................................
Program code
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [4]
14
9608/43/M/J/19
© UCLES 2019
(vi) Joanne has played the first game to place her in a category for the competition.
The procedure CreatePlayer()performs the following tasks.
• allows the player ID and score to be input with suitable prompts
• creates an instance of Player with the identifier JoannePlayer
• sets the score for the object
• sets the category for the object
• outputs the category for the object
Write program code for the CreatePlayer()procedure.
Programming language .....................................................................................................
Program code
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
..................................................................................................................................... [8]
15
9608/43/M/J/19
© UCLES 2019 [Turn over
(e) The programmer wants to test that the correct category is set for a player’s score.
As stated in part (d)(v), players will be placed in one of the following categories.
Category Criteria
Advanced Score is greater than 120
Intermediate Score is greater than 80 and less than or equal to 120
Beginner Score is greater than or equal to 50 and less than or equal to 80
Not Qualified Score is less than 50
Complete the table to provide test data for each category.
Category Type of test data Example test data
Beginner
Normal
Abnormal
Boundary
Intermediate
Normal
Abnormal
Boundary
Advanced
Normal
Abnormal
Boundary
[3]
16
9608/43/M/J/19
© UCLES 2019
(f) In part (b), the club stored scores in a 1D array. This allows the club to sort the scores.
The following is a sorting algorithm in pseudocode.
NumberOfScores ← 5
FOR Item ← 1 TO NumberOfScores – 1
InsertScore ← ArrayData[Item]
Index ← Item – 1
WHILE (ArrayData[Index] > InsertScore) AND (Index >= 0)
ArrayData[Index + 1] ← ArrayData[Index]
Index ← Index – 1
ENDWHILE
ArrayData[Index + 1] ← InsertScore
ENDFOR
(i) Give the name of this algorithm.
..................................................................................................................................... [1]
(ii) State the name of one other sorting algorithm.
..................................................................................................................................... [1]
17
9608/43/M/J/19
© UCLES 2019 [Turn over
(iii) Complete a dry run of the algorithm using the following trace table.
Item NumberOfScores InsertScore Index
ArrayData
0 1 2 3 4
99 125 121 109 115
[7]
18
9608/43/M/J/19
© UCLES 2019
3 Some algorithms can be written using recursion.
(a) State two features of recursion.
Feature 1 ...................................................................................................................................
Feature 2 ...................................................................................................................................
[2]
(b) Explain what a compiler has to do to implement recursion.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
............................................................................................................................................. [3]
19
9608/43/M/J/19
© UCLES 2019
BLANK PAGE
20
9608/43/M/J/19
© UCLES 2019
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of
Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge.
BLANK PAGE

More Related Content

Similar to 9608_s19_4_3_qp.pdf

Igcse maths paper 2
Igcse maths paper 2Igcse maths paper 2
Igcse maths paper 2AATIF AZIZ
 
8ACC122 Midterm Exam – Problems (7 points each)Student .docx
8ACC122   Midterm Exam – Problems    (7 points each)Student .docx8ACC122   Midterm Exam – Problems    (7 points each)Student .docx
8ACC122 Midterm Exam – Problems (7 points each)Student .docxevonnehoggarth79783
 
Question 1 – Exercise 8.3Why is it not possible in Example 8.1 o.docx
Question 1 – Exercise 8.3Why is it not possible in Example 8.1 o.docxQuestion 1 – Exercise 8.3Why is it not possible in Example 8.1 o.docx
Question 1 – Exercise 8.3Why is it not possible in Example 8.1 o.docxIRESH3
 
Rodney Matejek Portfolio
Rodney Matejek PortfolioRodney Matejek Portfolio
Rodney Matejek Portfoliormatejek
 
Assessment Problem that must be included in all Acct 211 classes.docx
Assessment Problem that must be included in all Acct 211 classes.docxAssessment Problem that must be included in all Acct 211 classes.docx
Assessment Problem that must be included in all Acct 211 classes.docxfredharris32
 
0580 w13 qp_42
0580 w13 qp_420580 w13 qp_42
0580 w13 qp_42King Ali
 
0580_w13_qp_42
0580_w13_qp_420580_w13_qp_42
0580_w13_qp_42King Ali
 
148 eJCcel Chapter 4 PROBLEM 4-21 Multiple.docx
148 eJCcel   Chapter 4 PROBLEM 4-21 Multiple.docx148 eJCcel   Chapter 4 PROBLEM 4-21 Multiple.docx
148 eJCcel Chapter 4 PROBLEM 4-21 Multiple.docxhyacinthshackley2629
 
0580_s14_qp_21
0580_s14_qp_210580_s14_qp_21
0580_s14_qp_21King Ali
 
Page 1 of 7 Fin516 201830 Assessment 2 Value 30.docx
Page 1 of 7  Fin516 201830 Assessment 2  Value 30.docxPage 1 of 7  Fin516 201830 Assessment 2  Value 30.docx
Page 1 of 7 Fin516 201830 Assessment 2 Value 30.docxkarlhennesey
 
0620 w16 qp_43
0620 w16 qp_430620 w16 qp_43
0620 w16 qp_43Omniya Jay
 
Exp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docx
Exp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docxExp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docx
Exp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docxgreg1eden90113
 

Similar to 9608_s19_4_3_qp.pdf (18)

Igcse maths paper 2
Igcse maths paper 2Igcse maths paper 2
Igcse maths paper 2
 
8ACC122 Midterm Exam – Problems (7 points each)Student .docx
8ACC122   Midterm Exam – Problems    (7 points each)Student .docx8ACC122   Midterm Exam – Problems    (7 points each)Student .docx
8ACC122 Midterm Exam – Problems (7 points each)Student .docx
 
Question 1 – Exercise 8.3Why is it not possible in Example 8.1 o.docx
Question 1 – Exercise 8.3Why is it not possible in Example 8.1 o.docxQuestion 1 – Exercise 8.3Why is it not possible in Example 8.1 o.docx
Question 1 – Exercise 8.3Why is it not possible in Example 8.1 o.docx
 
Semester 5 Experts in Teams Project - Opus
Semester 5 Experts in Teams Project - OpusSemester 5 Experts in Teams Project - Opus
Semester 5 Experts in Teams Project - Opus
 
Rodney Matejek Portfolio
Rodney Matejek PortfolioRodney Matejek Portfolio
Rodney Matejek Portfolio
 
Fi user manual
Fi user manualFi user manual
Fi user manual
 
Assessment Problem that must be included in all Acct 211 classes.docx
Assessment Problem that must be included in all Acct 211 classes.docxAssessment Problem that must be included in all Acct 211 classes.docx
Assessment Problem that must be included in all Acct 211 classes.docx
 
0580 w13 qp_42
0580 w13 qp_420580 w13 qp_42
0580 w13 qp_42
 
0580_w13_qp_42
0580_w13_qp_420580_w13_qp_42
0580_w13_qp_42
 
148 eJCcel Chapter 4 PROBLEM 4-21 Multiple.docx
148 eJCcel   Chapter 4 PROBLEM 4-21 Multiple.docx148 eJCcel   Chapter 4 PROBLEM 4-21 Multiple.docx
148 eJCcel Chapter 4 PROBLEM 4-21 Multiple.docx
 
Electronics industry brief
Electronics industry briefElectronics industry brief
Electronics industry brief
 
0580_s14_qp_21
0580_s14_qp_210580_s14_qp_21
0580_s14_qp_21
 
Page 1 of 7 Fin516 201830 Assessment 2 Value 30.docx
Page 1 of 7  Fin516 201830 Assessment 2  Value 30.docxPage 1 of 7  Fin516 201830 Assessment 2  Value 30.docx
Page 1 of 7 Fin516 201830 Assessment 2 Value 30.docx
 
0620 w16 qp_43
0620 w16 qp_430620 w16 qp_43
0620 w16 qp_43
 
Cost Accounting
Cost AccountingCost Accounting
Cost Accounting
 
0450 m15 qp_12
0450 m15 qp_120450 m15 qp_12
0450 m15 qp_12
 
Acc 491
Acc 491Acc 491
Acc 491
 
Exp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docx
Exp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docxExp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docx
Exp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docx
 

More from EmadaddiAlazzani

More from EmadaddiAlazzani (6)

AAPM-2005-TG18.pdf
AAPM-2005-TG18.pdfAAPM-2005-TG18.pdf
AAPM-2005-TG18.pdf
 
54230.pptx
54230.pptx54230.pptx
54230.pptx
 
Antoinette Smith-Tolken.pptx
Antoinette Smith-Tolken.pptxAntoinette Smith-Tolken.pptx
Antoinette Smith-Tolken.pptx
 
327152324.pdf
327152324.pdf327152324.pdf
327152324.pdf
 
1207csc_lec2.pptx
1207csc_lec2.pptx1207csc_lec2.pptx
1207csc_lec2.pptx
 
1207csc_lec2 (1).pptx
1207csc_lec2 (1).pptx1207csc_lec2 (1).pptx
1207csc_lec2 (1).pptx
 

Recently uploaded

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 

Recently uploaded (20)

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 

9608_s19_4_3_qp.pdf

  • 1. This document consists of 18 printed pages and 2 blank pages. DC (KS/CB) 163592/4 © UCLES 2019 [Turn over Cambridge Assessment International Education Cambridge International Advanced Subsidiary and Advanced Level * 5 1 5 4 8 4 3 3 4 7 * COMPUTER SCIENCE 9608/43 Paper 4 Further Problem-solving and Programming Skills May/June 2019 2 hours Candidates answer on the Question Paper. No Additional Materials are required. No calculators allowed. READ THESE INSTRUCTIONS FIRST Write your centre number, candidate number and name in the spaces at the top of this page. Write in dark blue or black pen. You may use an HB pencil for any diagrams, graphs or rough working. Do not use staples, paper clips, glue or correction fluid. DO NOT WRITE IN ANY BARCODES. Answer all questions. No marks will be awarded for using brand names of software packages or hardware. At the end of the examination, fasten all your work securely together. The number of marks is given in brackets [ ] at the end of each question or part question. The maximum number of marks is 75.
  • 2. 2 9608/43/M/J/19 © UCLES 2019 1 (a) A stack contains the values 'red', 'blue', 'green' and 'yellow'. yellow green blue red (i) Show the contents of the stack in part(a) after the following operations. POP() PUSH('purple') PUSH('orange') [1] Top of stack
  • 3. 3 9608/43/M/J/19 © UCLES 2019 [Turn over (ii) Show the contents of the stack from part(a)(i) after these further operations. POP() POP() PUSH('brown') POP() PUSH('black') [1] (b) A queue is an alternative Abstract Data Type (ADT). Describe a queue. ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ............................................................................................................................................. [3]
  • 4. 4 9608/43/M/J/19 © UCLES 2019 2 A computer games club wants to run a competition. The club needs a system to store the scores achieved in the competition. A selection of score data is as follows: 99, 125, 121, 97, 109, 95, 135, 149 (a) A linked list of nodes will be used to store the data. Each node consists of the data, a left pointer and a right pointer. The linked list will be organised as a binary tree. (i) Complete the binary tree to show how the score data above will be organised. RootPointer RightPointer 99 LeftPointer 97 125 121 ∅ The symbol ∅ represents a null pointer. [5]
  • 5. 5 9608/43/M/J/19 © UCLES 2019 [Turn over (ii) The following diagram shows a 2D array that stores the nodes of the binary tree’s linked list. Add the correct pointer values to complete the diagram, using your answer from part (a)(i). RootPointer 0 FreePointer Index LeftPointer Data RightPointer 0 99 1 125 2 121 3 97 4 109 5 95 6 135 7 149 8 [6]
  • 6. 6 9608/43/M/J/19 © UCLES 2019 (b) The club also considers storing the data in the order in which it receives the scores as a linked list in a 1D array of records. The following pseudocode algorithm searches for an element in the linked list. Complete the six missing sections in the algorithm. FUNCTION FindElement(Item : INTEGER) RETURNS ………………………………………… …………………………………………… ← RootPointer WHILE CurrentPointer …………………………………………… NullPointer IF List[CurrentPointer].Data <> …………………………………………… THEN CurrentPointer ← List[……………………………………………].Pointer ELSE RETURN CurrentPointer ENDIF ENDWHILE CurrentPointer ← NullPointer ………………………………………… CurrentPointer ENDFUNCTION [6]
  • 7. 7 9608/43/M/J/19 © UCLES 2019 [Turn over (c) The games club is looking at two programming paradigms: imperative and object-oriented programming paradigms. Describe what is meant by the imperative programming paradigm and the object-oriented programming paradigm. (i) Imperative .......................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [3] (ii) Object-oriented .................................................................................................................. ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [3]
  • 8. 8 9608/43/M/J/19 © UCLES 2019 (d) Players complete one game to place them into a category for the competition. The games club wants to implement a program to place players into the correct category. The programmer has decided to use object-oriented programming (OOP). The highest score that can be achieved in the game is 150. Any score less than 50 will not qualify for the competition. Players will be placed in a category based on their score. The following diagram shows the design for the class Player. This includes the properties and methods. Player Score : INTEGER // initialised to 0 Category : STRING // "Beginner", "Intermediate", // "Advanced" or "Not Qualified", initialised // to "Not Qualified" PlayerID : STRING // initialised with the parameter InputPlayerID Create() // method to create and initialise an object using // language-appropriate constructor SetScore() // checks that the Score parameter has a valid value // if so, assigns it to Score SetCategory() // sets Category based on player’s Score SetPlayerID() // allows a player to change their PlayerID // validates the new PlayerID GetScore() // returns Score GetCategory() // returns Category GetPlayerID() // returns PlayerID
  • 9. 9 9608/43/M/J/19 © UCLES 2019 [Turn over (i) The constructor receives the parameter InputPlayerID to create the PlayerID. Other properties are initialised as instructed in the class diagram. Write program code for the Create() constructor method. Programming language ..................................................................................................... Program code ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [5]
  • 10. 10 9608/43/M/J/19 © UCLES 2019 (ii) Write program code for the following three get methods. Programming language ..................................................................................................... GetScore() Program code ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... GetCategory() Program code ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... GetPlayerID() Program code ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... [4]
  • 11. 11 9608/43/M/J/19 © UCLES 2019 [Turn over (iii) The method SetPlayerID()asks the user to input the new player ID and reads in this value. It checks that the length of the PlayerID is less than or equal to 15 characters and greater than or equal to 4 characters. If the input is valid, it sets this as the PlayerID, otherwise it loops until the player inputs a valid PlayerID. Use suitable input and output messages. Write program code for SetPlayerID(). Programming language ..................................................................................................... Program code ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [4]
  • 12. 12 9608/43/M/J/19 © UCLES 2019 (iv) The method SetScore()checks that its INTEGER parameter ScoreInput is valid. If it is valid, it is then set as Score. A valid ScoreInput is greater than or equal to 0 and less than or equal to 150. If the ScoreInput is valid, the method sets Score and returns TRUE. If the ScoreInput is not valid, the method does not set Score, displays an error message, and it returns FALSE. Write program code for SetScore(ScoreInput : INTEGER). Programming language ..................................................................................................... Program code ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [5]
  • 13. 13 9608/43/M/J/19 © UCLES 2019 [Turn over (v) Write program code for the method SetCategory(). Use the properties and methods in the original class definition. Players will be placed in one of the following categories. Category Criteria Advanced Score is greater than 120 Intermediate Score is greater than 80 and less than or equal to 120 Beginner Score is greater than or equal to 50 and less than or equal to 80 Not Qualified Score is less than 50 Programming language ..................................................................................................... Program code ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [4]
  • 14. 14 9608/43/M/J/19 © UCLES 2019 (vi) Joanne has played the first game to place her in a category for the competition. The procedure CreatePlayer()performs the following tasks. • allows the player ID and score to be input with suitable prompts • creates an instance of Player with the identifier JoannePlayer • sets the score for the object • sets the category for the object • outputs the category for the object Write program code for the CreatePlayer()procedure. Programming language ..................................................................................................... Program code ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ........................................................................................................................................... ..................................................................................................................................... [8]
  • 15. 15 9608/43/M/J/19 © UCLES 2019 [Turn over (e) The programmer wants to test that the correct category is set for a player’s score. As stated in part (d)(v), players will be placed in one of the following categories. Category Criteria Advanced Score is greater than 120 Intermediate Score is greater than 80 and less than or equal to 120 Beginner Score is greater than or equal to 50 and less than or equal to 80 Not Qualified Score is less than 50 Complete the table to provide test data for each category. Category Type of test data Example test data Beginner Normal Abnormal Boundary Intermediate Normal Abnormal Boundary Advanced Normal Abnormal Boundary [3]
  • 16. 16 9608/43/M/J/19 © UCLES 2019 (f) In part (b), the club stored scores in a 1D array. This allows the club to sort the scores. The following is a sorting algorithm in pseudocode. NumberOfScores ← 5 FOR Item ← 1 TO NumberOfScores – 1 InsertScore ← ArrayData[Item] Index ← Item – 1 WHILE (ArrayData[Index] > InsertScore) AND (Index >= 0) ArrayData[Index + 1] ← ArrayData[Index] Index ← Index – 1 ENDWHILE ArrayData[Index + 1] ← InsertScore ENDFOR (i) Give the name of this algorithm. ..................................................................................................................................... [1] (ii) State the name of one other sorting algorithm. ..................................................................................................................................... [1]
  • 17. 17 9608/43/M/J/19 © UCLES 2019 [Turn over (iii) Complete a dry run of the algorithm using the following trace table. Item NumberOfScores InsertScore Index ArrayData 0 1 2 3 4 99 125 121 109 115 [7]
  • 18. 18 9608/43/M/J/19 © UCLES 2019 3 Some algorithms can be written using recursion. (a) State two features of recursion. Feature 1 ................................................................................................................................... Feature 2 ................................................................................................................................... [2] (b) Explain what a compiler has to do to implement recursion. ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... ............................................................................................................................................. [3]
  • 20. 20 9608/43/M/J/19 © UCLES 2019 Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity. To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cambridgeinternational.org after the live examination series. Cambridge Assessment International Education is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of the University of Cambridge Local Examinations Syndicate (UCLES), which itself is a department of the University of Cambridge. BLANK PAGE