Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
10 views
Computer Science P2 Unsolved 2023-2024
Computer science p2
Uploaded by
kate.ki.7869
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Computer Science P2 Unsolved 2023-2024 For Later
Download
Save
Save Computer Science P2 Unsolved 2023-2024 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
10 views
Computer Science P2 Unsolved 2023-2024
Computer science p2
Uploaded by
kate.ki.7869
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Computer Science P2 Unsolved 2023-2024 For Later
Carousel Previous
Carousel Next
Save
Save Computer Science P2 Unsolved 2023-2024 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 15
Search
Fullscreen
COMPUTER SCIENCE Paper 2 Fundamental Problom-solving and Programming Skills You will ni : Insert (onclosed) 9618/21 Dac-2023, Duration « 2 hours READ THESE INSTRUCTIONS FIRST Write your name, student id and grade in the spaces at the top of this page. \Wiite 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, Calculators must not be used in this paper. 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 Examiner's Signature: Moderator’s Signature: Invigilator’s Signature: __/ Q.no. | Marks | Obtained a 18 2. 9 2 7 4 2 E 3 6 12. | Mm 8 Total | 75 ee This document consists of 15 printed pages * days ce Meese Oe | Exam Department BeanscannerRefer to the Insort for the list of pseudocode functions and oporators, 41 (a) (I) Algorithms may be expressed using four basic constructs. One construct is soquonce, ‘Complete the following table for two other constructs. Construct Psoudocodo oxample (4) (Ii) Simple algorithms usually consist of input, process and output ‘Complete the table by placing ticks ('/’) in the relevant boxes. Pseudocode statement Input | Process | Output Temp ~ Sensorvalue * Factor WRITEFILE "LogFile.txt", TextLine WRITEFILE "LogFile.txt", MyName & MyTDNumber READFILE "AddressBook. txt", NextLine ‘ “Ting * cel dca AS-C5 9618 Midyeor-2023 P21 bi m Department BanscanerSy (b) Program variables have values as follows: Val - —_ Title "101 tricks with spaghetti” Version "cr | huthor "Eric Peapod” 2 PackSize 4 = WoightBach 62 Paperback TRUE — | (W) Evaluate each expression in the following tablo, Ian expression is invalid, write ERROR, Expression Evaluates to ] MID(Title, 5, 3) & RIGHT (Author, 3) INT(WeightEach * PackSize) PackSize >= 4 AND WeightEach < 6.2 LEFT (Author, ASC(Version) - 65) RIGHT (Title, (LENGTH(Author) - 6)) (ll) Programming languages support different data types. DI Give an appropriate data type for the following variables from part (b). Varlable Data type Title Version PackSize WeightEach Paperback t AS-CS 9618 Midyear-2023 P21 1o] Beanscinne4 2.A programmer wants to write a program to calculate the baggage charge for a passenger's airline fight. ‘Two types of ticket are available for a flight: + economy class (coded E) + standard class (coded S) Each ticket type has a baggage weight allowance as shown below. The airline makes a charge if the weight exceeds the allowance, Baggage allowance Charge rate per additional kg Ticket type se Fi ne (ka) s) fe 16 3.50 's 20 5.75 (a) A program flowchart will document the program. The flowchart will contain the folowing statements: ‘Statement filimber ‘Statement 2 Charge = 0 Y INPUT BaggageWeight 3 Charge - ExcessWeight * chargeRate Is ExcessWeight > 0 ? 5 INPUT TicketType « ExcessWeight — Baggageleight - BaggageAllowance r BaggageAllowance ~ 16 af Chargerate - 3.5 9 OUTPUT Charge 10 ChargeRate ~ 5.75 1 BaggageAllowance ~ 20 12 Is TicketType = 'E' ? Complete the flowchart by putting the appropriate statement number in each flowchart symbol. Statement 5 has been done for you. AS-CS 9618 Midyeor-2023 P21 Beanscanner—w4 AS-CS 9618 Midyeor-2023 P21 Beanscanner6 {b) The program design is to be amended, The value input by the user for the ticket type Is to be validated. Part of the amended flowchart is shown below. No [vos White pseudocode to use a pre-condition loon tor-this Validation 8 AS-C5 9618 Midyear-2023 P21 jéxam Department [} Beanscinne’ 3. Amobile phone provider has developed an account management program. The program includes a procedure, Aaacredit (). The procedure is 4 and Phonetiun ‘The shown. Ned with two parameters, Tp"lpy fant part of the Kdentifier table and the program Nowchart for the procedure ara as Wdontifior Description Topup Tha amount of credit to ba added | Phonettur STRING | The unique customer phona number Dalance [REAL —_ | Tha current amount of crnat | Multiple - REAL. Tho amount of credit bonus hea the phone number as a parameter and eturna tha currant Getnatancet) |runction | 74 pa A rotuens tha currant SetNalance() | PROCEDURE ‘Set Mutip 1.25 Set Multiple to a ‘Sel Toptip to Topp * Multiple | | Secastncetthonain, Banca + Topp) AS-CS 9618 Midyeor-2023 P218 Write pseudocode to implement the procedure AddCredit (). The pseudocode must follow the algorithm represented by the flowchart. Declare any local variables used. . ou)s S AS 2. sesementorth ‘ TDM * Exeter Edad Exam Department CBcamscanner9 4(a)A 1D array, Directory, of type STRING [s used to store a list of schoo! internal telephone ‘numbers, There are 1000 elements in the array. Each element stores a single data item. The format of each data item is as follows:
Nunber is a four-digit numeric string, Nane Is a varlablesength string, For example: "1024Collins Robbie" The following pseudocode is an Initial attempt at defining a procedure Sortcontacts() that will perform a bubble sort on Directory. The array is to be sorted in ascending order of Name. Fill in the gaps to complete the pseudocode. PROCEDURE SortContacts () DECLARE Temp : STRING DECLARE FirstName, SecondName : STRING DECLARE NoSwaps : = DECLARE Boundary, J : INTEGER Boundary + — REPEAT NoSwaps @ TRUE FOR J 170 Boundary ~ FirstName @— .. _——.(Directory(J], LENGTH (Directory(J}) - SecondName € RIGHT (Directory[J + 1], IF FirstName ‘THEN LENGTH(Directory[J + 11) ~ 4) Temp « Directory(J] Directory(J) ¢ Directory ~ Directory[3 + 1] © Temp Noswaps < . . ENDIF ENDFOR Boundary @ Ws UNTIL NoSwaps = TRUE ENDPROCEDURE AS-CS 9618 Midyear-2023 P21 * dapat * Department cs10 (b) The pseudocode contains a mechanism designed to make this an efficient bubble sort. —~ Describe the mechanism and explain why it may be considered to be efficient. AS-CS 9618 Midyear-2023 P21 Exam Department einen | CBcamscannerY aay ’ rte 5 The following Is a function design in pseudocode. Line numbers are given for reference only. o1 02 03 04 os 06 07 08 o9 10 11. 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 AS-C5 9618 Midyear-2023 P21 FUNCTION StringClean(InString : STRING) RETURNS STRING DECLARE NextChar : CHAR DECLARE OutString : STRING DECLARE Counter : INTEGER DECLARE MyString : STRING Outstring + "" FOR Counter « 1 TO LENGTH(InString) NextChar «- MID(InString, Counter, 1) NextChar «- LCASE(NextChar) IF (NextChar >= 'a') AND (NextChar <= 'z') THEN OutString < OutString & NextChar ENDIF ENDFOR RETURN OutString ENDFUNCTION2 Study the function StringClean (). Identify the features of the function in the following table. Feature Answer Aline number containing an example of an assignment statement A line number containing the start of a repetition block A line number containing the end of a repetition block Aline number containing the start of a selection statement |The number ofparametersofthemiDuncion The Boolean operator used The number of local variables The number of function calls from within StringClean() resulting from the call: NewString — StringClean ("Me") The number of a line containing an unnecessary statement ( ? AS-C5 9618 Midyear-2023 P21 ee m Department BeanscanserB 6 (a) An algorithm includes a number of complex calculations. A programmer is writing a program to implement the algorithm and decides to use library routines to provide part ofthe solution State three possible benefits of using library routines in the development ofthe program. @ (b) The following pseudocode is part of a program that stores names and test marks for use in other parts of the program. DECLARE Namel, Name2, Name3 : STRING DECLARE Marki, Mark2, Mark3 : INTEGER INPUT Namel INPU? Markl INPUT Name2 INPUT Mark2 INPUT Name3 INPUT Mark3 (i) The pseudocode needs to be changed to allow for data to be stored for up to 30 students. Explain why it would be good practice to use arrays to store the data, St 3 AS-CS 9618 Midyeor-2023 P21 Stee Pence bein [sam Department Banscanercy (Il) The following pseudocode statement includes array references: OUTPUT "Student ", Name[Count], " scored ", Mark{Count) State the purpose of the varlable Count and giva its data type. Purpose . . Data type. eR (2) (c) The pseudocode statements in the following table may contain errors. State the error in each case or write 'NO ERROR’ if the statement contains no error. Assume that any variables used are of the correct type for the given function. Statement Error IF EMPTY — “" THEN Status — 1S_NuM(-23.4) X — STR_TO_NUM("37") +5 ¥ — STR_TO_NUM("37" + - . as (i eZ AS-C5.9618 Midyeor-2023 P21 ane i Jxam Department 200 Banscaner15 7 A sports club maintains a record of the mail address of each of its members, The details are stored In a text fle, Emai10etaiis. txt. The format of each line of the toxt file Is a8 follows:
+ Menbershipttumber is a four-ch: cler string of numerals, + EmailAddress Is a variable-length string. ‘Membership of the club has increased and a four-character membership number is no longer adequate, A procedure, HakeNewF Le, Is required to perform the following actions: 1, Create a new file, Newemai1detaiis. txt. 2. Read aline from file Emai1Details.txt 3. Extend Menbershiptumber by adding two leading zero digits (for example, "1234" becomes "001234") 4, Write the new line to fle NewEmai1Detaiis.txt 5, Repeat steps 2 to 4 forall lines in the original file. Write pseudocode for the procedure MakeNewFile. AS-C5 9618 Midyeor-2023 P21 [iEsam Department CBeamscanner
You might also like
CS Test 1 - Memo Problem - Solving and Design
PDF
0% (1)
CS Test 1 - Memo Problem - Solving and Design
7 pages
9618 s24 Ms 22 Zak-3
PDF
No ratings yet
9618 s24 Ms 22 Zak-3
24 pages
CSc9618(as)- Mock 2 - Paper 2
PDF
No ratings yet
CSc9618(as)- Mock 2 - Paper 2
11 pages
Cambridge International AS & A Level: Computer Science 9618/22
PDF
100% (1)
Cambridge International AS & A Level: Computer Science 9618/22
94 pages
Cambridge International AS & A Level: Computer Science 9618/22
PDF
No ratings yet
Cambridge International AS & A Level: Computer Science 9618/22
16 pages
2210 - 02 - Status Basic - Program Design 2024
PDF
No ratings yet
2210 - 02 - Status Basic - Program Design 2024
6 pages
Cambridge International Advanced Subsidiary and Advanced Level
PDF
No ratings yet
Cambridge International Advanced Subsidiary and Advanced Level
20 pages
8B_EOS1_Practise 1_Ans
PDF
No ratings yet
8B_EOS1_Practise 1_Ans
2 pages
Practical Papers CS
PDF
No ratings yet
Practical Papers CS
436 pages
Computer A Level Full Noneed To Search
PDF
No ratings yet
Computer A Level Full Noneed To Search
244 pages
9618 s21 QP 21-Merged
PDF
No ratings yet
9618 s21 QP 21-Merged
304 pages
Cambridge International AS & A Level: Computer Science 9608/22
PDF
No ratings yet
Cambridge International AS & A Level: Computer Science 9608/22
20 pages
Cambridge International AS & A Level: Computer Science 9618/22
PDF
No ratings yet
Cambridge International AS & A Level: Computer Science 9618/22
16 pages
Computer Science
PDF
No ratings yet
Computer Science
7 pages
N5 Computing-Science QP 2022
PDF
No ratings yet
N5 Computing-Science QP 2022
36 pages
Assignment 3
PDF
No ratings yet
Assignment 3
8 pages
9618_s24_qp_21
PDF
No ratings yet
9618_s24_qp_21
24 pages
Cambridge International Advanced Subsidiary and Advanced Level
PDF
No ratings yet
Cambridge International Advanced Subsidiary and Advanced Level
16 pages
Question Paper 4
PDF
No ratings yet
Question Paper 4
17 pages
9816 - 02 - Status Basic - Program Design - 2024
PDF
No ratings yet
9816 - 02 - Status Basic - Program Design - 2024
4 pages
Computer Assignment for AS 11
PDF
No ratings yet
Computer Assignment for AS 11
7 pages
Pseudocode topicals
PDF
No ratings yet
Pseudocode topicals
23 pages
Cambridge International AS & A Level: Computer Science 9608/22
PDF
No ratings yet
Cambridge International AS & A Level: Computer Science 9608/22
8 pages
Computer Science A Level Pre-Released Material 2016
PDF
No ratings yet
Computer Science A Level Pre-Released Material 2016
8 pages
DOC-20250228-WA0145.
PDF
No ratings yet
DOC-20250228-WA0145.
16 pages
Pseudocode Caie
PDF
No ratings yet
Pseudocode Caie
6 pages
Ilovepdf Merged (5)
PDF
No ratings yet
Ilovepdf Merged (5)
10 pages
9618_w24_qp_22
PDF
No ratings yet
9618_w24_qp_22
24 pages
9608 - s19 - QP - 21 Paper
PDF
No ratings yet
9608 - s19 - QP - 21 Paper
16 pages
Computer Science Unit 2 Jan19 - Oct 23
PDF
No ratings yet
Computer Science Unit 2 Jan19 - Oct 23
540 pages
Paper 2 Notes
PDF
No ratings yet
Paper 2 Notes
33 pages
Answer - Past Year Paper (AS)
PDF
No ratings yet
Answer - Past Year Paper (AS)
14 pages
9618_s24_qp_23
PDF
No ratings yet
9618_s24_qp_23
24 pages
Introduction to Computer
PDF
No ratings yet
Introduction to Computer
101 pages
Class Xii Computer Science (083) : General Instructions - (I) All Questions Are Compulsory (Ii) Programming Language: C++
PDF
No ratings yet
Class Xii Computer Science (083) : General Instructions - (I) All Questions Are Compulsory (Ii) Programming Language: C++
7 pages
programming-concepts-Kyd9xQWfPcF5SkXh
PDF
No ratings yet
programming-concepts-Kyd9xQWfPcF5SkXh
15 pages
10IGCSE%20-%20Test1
PDF
No ratings yet
10IGCSE%20-%20Test1
4 pages
Paper 2 Final Mock Ms
PDF
No ratings yet
Paper 2 Final Mock Ms
12 pages
programming-concepts-Kyd9xQWfPcF5SkXh
PDF
No ratings yet
programming-concepts-Kyd9xQWfPcF5SkXh
14 pages
9608 AS PreRelease 2020
PDF
No ratings yet
9608 AS PreRelease 2020
8 pages
Cambridge International AS & A Level: Computer Science 9618/02
PDF
No ratings yet
Cambridge International AS & A Level: Computer Science 9618/02
14 pages
9608 s15 Pre 21
PDF
No ratings yet
9608 s15 Pre 21
8 pages
Procedu & funct, library handling, Bubble sort, linear search, PDLC topicals
PDF
No ratings yet
Procedu & funct, library handling, Bubble sort, linear search, PDLC topicals
10 pages
4CP0 02 Que 20211116
PDF
No ratings yet
4CP0 02 Que 20211116
16 pages
programming-concepts-tqst_Kyd9xQWfPcF5SkXh
PDF
No ratings yet
programming-concepts-tqst_Kyd9xQWfPcF5SkXh
15 pages
Pseudocode Notes
PDF
No ratings yet
Pseudocode Notes
13 pages
CC103
PDF
100% (1)
CC103
12 pages
MIDTERM - Comp 2
PDF
No ratings yet
MIDTERM - Comp 2
3 pages
Computer Science Unit 7
PDF
No ratings yet
Computer Science Unit 7
31 pages
PseudoCode Memorisation Solutions
PDF
No ratings yet
PseudoCode Memorisation Solutions
10 pages
567272 November 2020 Question Paper 21 (1)
PDF
No ratings yet
567272 November 2020 Question Paper 21 (1)
20 pages
Computer Science, 9618 Home Assignment (35 Marks)
PDF
No ratings yet
Computer Science, 9618 Home Assignment (35 Marks)
5 pages
Project Report ON Simple Compiler Design
PDF
No ratings yet
Project Report ON Simple Compiler Design
20 pages
Pseudocode Revision Sheet
PDF
No ratings yet
Pseudocode Revision Sheet
19 pages
P2 Pseudocode - Topical and Yearly
PDF
No ratings yet
P2 Pseudocode - Topical and Yearly
733 pages
Thiagarajar College of Engineering, Madurai 625 015. Department of Electronics and Communication Engineering
PDF
No ratings yet
Thiagarajar College of Engineering, Madurai 625 015. Department of Electronics and Communication Engineering
3 pages
Cambridge International AS & A Level: Computer Science 9608/21
PDF
No ratings yet
Cambridge International AS & A Level: Computer Science 9608/21
24 pages
2nd Last File
PDF
No ratings yet
2nd Last File
20 pages