CIE Computer Science Paper 2 Pseudocode

Watch
_Poseidon_
Badges: 12
Rep:
?
#1
Report Thread starter 2 years ago
#1
I've realized a bunch of people don't really have pseudocodes for computer science, and I think we should all collaborate to form one really easy to memorize pseudocode (or copy some hardworking individual's work).

Please feel free to post your pseudocodes for Paper 2, and label the code accordingly, e.g. Paper 21/22/23 etc...

This is what I have so far for Paper 21

Task 1
estimatenumber ← 0
valid <-- TRUE
DO
PRINT “Please select a processor, p3, p5 or p7”
INPUT processor
IF processor = p3
sum ← 100
valid ← TRUE
processorprice ← 100
ELSE IF processor = p5
sum ← 120
valid ← TRUE
processorprice ← 120
ELSE IF processor = p7
sum ← 200
valid ← TRUE
processorprice ← 200
ELSE
valid <-- FALSE
PRINT “Invalid input, please enter p3, p5 or p7 exactly”
WHILE valid = FALSE
DO
PRINT “Please select a ram, 16GB or 32GB”
INPUT ram
IF ram = 16GB
sum ← sum + 75
valid ← TRUE
ramprice ← 75
ELSE IF ram = 32GB
sum ← sum + 150
valid ← TRUE
ramprice ← 150
ELSE
valid ← FALSE
PRINT “Invalid input, please enter 16GB or 32GB exactly”
WHILE valid = FALSE
DO
PRINT “Please select storage, 1TB or 2TB”
INPUT storage
IF storage = 1TB
sum ← sum + 50
valid ← TRUE
storageprice ← 50
ELSE IF storage = 2TB
sum ← sum + 100
valid ← TRUE
storageprice ← 100
ELSE
valid ← FALSE
PRINT “Invalid input, please enter 1TB or 2TB exactly”
WHILE valid = FALSE
DO
PRINT “Please select a screen, 19 or 23 inches”
INPUT screen
IF screen = 19
sum ← sum + 65
valid ← TRUE
screenprice ← 65
ELSE IF screen = 23
sum ← sum + 120
valid ← TRUE
screenprice ← 120
ELSE
valid ← FALSE
PRINT “Invalid input, please enter 19 or 23 exactly”
WHILE valid = FALSE
DO
PRINT “Please select a case, mini or midi”
INPUT case
IF case = mini
sum ← sum + 40
valid ← TRUE
caseprice ← 40
ELSE IF case = midi
sum ← sum + 70
valid ← TRUE
caseprice ← 70
ELSE
valid ← FALSE
PRINT “Invalid input, please enter mini or midi exactly”
WHILE valid = FALSE
DO
PRINT “Please select the number of USB ports, 2 or 4”
INPUT usb
IF usb = 2
sum ← sum + 10
valid ← TRUE
usbprice ← 10
ELSE IF usb = 4
sum ← sum + 20
valid ← TRUE
usbprice ← 20
ELSE
valid ← FALSE
PRINT “Invalid input, please enter 2 or 4 exactly”
WHILE valid = FALSE

estimatenumber ← estimatenumber +1
PRINT “Estimate number ” + estimatenumber
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Should there be a new university admissions system that ditches predicted grades?

No, I think predicted grades should still be used to make offers (627)
33.67%
Yes, I like the idea of applying to uni after I received my grades (PQA) (784)
42.11%
Yes, I like the idea of receiving offers only after I receive my grades (PQO) (368)
19.76%
I think there is a better option than the ones suggested (let us know in the thread!) (83)
4.46%

Watched Threads

View All
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise