Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

Pearson Edexcel Level 1/Level 2 GCSE

Puntuación
-
Vendido
-
Páginas
36
Grado
A+
Subido en
25-10-2024
Escrito en
2024/2025

Exam of 36 pages for the course Pearson Edexcel Level 1/Level 2 GCSE at Pearson Edexcel Level 1/Level 2 GCSE

Institución
Grado

Vista previa del contenido

Pearson Edexcel Level 1/Level 2
GCSE (9–1)
Tuesday 21 May 2024
Afternoon (Time: 2 1CP2/ Paper
referen
Computer Science
hours)
ce
🞍 🞍


02
PAPER 2: Application of Computational
Thinking
You must have:
a computer workstation with appropriate programming language code editing
software and tools, including an IDE that you are familiar with which shows line
numbers
a ‘STUDENT CODING’ folder containing code and data files
printed and electronic copies of the Program Language Subset (PLS)
document (enclosed).


Instructions

••Save the new or amended code in the ‘COMPLETED CODING’ folder using the
Answer all questions on your

name given in the
• Do not overwrite the original code and data files provided to you.
• You must not use the internet at any time during the
Information

• The total mark for this paper is 75.
•–The marks for each question are shown in
use this as a guide as to how much time to spend on each question.
• The ‘STUDENT CODING’ folder in your user area includes all the code and
data files you need.

Advice
• Read each question carefully before you start to answer it.
• Save your work
• Check your answers and work if you have time at the end.




Turn over


P75441RA
©2024 Pearson Education

, Answer ALL
questions.
Suggested time: 10 minutes
1 A program is written to provide information about the rainbow.

Colours and wavelengths are stored in arrays. For example, the colour Violet
is produced when the wavelength is from 380 to 424

The user enters an index and the colour at that array location is displayed.
The user enters a wavelength and the colour for that wavelength is displayed.


Open file Q01.py


Amend the code to:

• fix the syntax error on original line 5
waveTable = [380, 425, 450, 492, 577, 597", 622]
• fix the NameError on original line 6
found = false
• fix the syntax error on original line 8
wavelength = 0123
• fix the syntax error on original line 15
index = int (input ("Enter an index: ")
• fix the NameError on original line 21
color = rainbow[index]
• fix the ValueError on original line 22
print (int (colour))
• fix the logic error on original line 26
if ((wavelength < 380) and (wavelength > 622)):
• fix the logic error on original line 29
index = 1
• fix the logic error on original line 35
elif (waveTable[index] <= wavelength):
• fix the logic error on original line 37
print (rainbow[index - 2])


Do not change the functionality of the given lines of
code. Do not add any additional functionality.
Save your amended code as Q01FINISHED.py


(Total for Question 1 = 10 marks)


2 P7544

,Suggested time: 15 minutes
2 A program encrypts a message using a Caesar cipher.

The letters of the alphabet are shifted a set number of places. A positive
shift moves the letters to the right. A negative shift moves them to the left.

Blanks, symbols and numbers are not encrypted.

When the end of the alphabet is reached with a positive shift, shifting
continues at the start of the alphabet. When the start of the alphabet is
reached with a negative shift, shifting continues at the end of the alphabet.
For example, a shift of −2 encodes the plaintext letter P to the ciphertext
letter N. A shift of +4 encodes the plaintext letter X to the ciphertext letter
B.

When working correctly, the program produces the encrypted ciphertext for
these plaintext messages and shift inputs.

Plaintext Shif Ciphertext
t
The Rainbow 4 Xli Vemrfsa

Alphabet −5 Vgkcvwzo
Soup Njpk
123 ^&* Bye 9 123 ^&* Khn


Open file Q02.py


Amend the code to make the program work and produce the
correct output. You will need to:

• choose between alternative lines of code. Make a choice by removing the
# at the beginning of the line you choose to execute

• run the program with the data from the table and check it
meets the requirements.


Do not change the functionality of the given lines of
code. Do not add any additional functionality.
Save your amended code as Q02FINISHED.py


(Total for Question 2 = 10 marks)




P7544 3

, Suggested time: 20 minutes
3 A program is required to calculate the total cost of items purchased. Items
are sold by count or by weight.

The user enters the number 1 if the purchase is by count or the number 5 if
the purchase is by weight of items. The user then enters either the count or
the weight in kilograms.

The program checks for invalid input. If the input is valid, the program calculates
and displays the total cost.

Currency formatting with two decimal places and a symbol is not
required. The table shows test results.

Purchas Count Weight
Output
e of in
categor items kilogram
y s
1 3 Total cost is 3.69

1 0 Invalid number of
items
5 4.5 Total cost is 15.525

5 −6.6 Invalid weight

3 Invalid purchase
type

Open file Q03.py

Amend the code to:

• create an integer variable named purchaseType and set it to 0
• complete a line with the correct logical operator and the correct constant

• complete a line with the correct constant

• complete a line to accept a real value for the weight in kilograms

• complete a line to calculate the total cost based on weight

• complete a line to check for a 0 or negative count of items

• complete a line with the correct relational operator

• add a line to display an informative message and the total cost.

Do not add any additional functionality.
Save your amended code as Q03FINISHED.py


4 P7544

Escuela, estudio y materia

Grado

Información del documento

Subido en
25 de octubre de 2024
Número de páginas
36
Escrito en
2024/2025
Tipo
Examen
Contiene
Solo preguntas

Temas

$17.79
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
margaretmbugua453 Cambridge College
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
35
Miembro desde
1 año
Número de seguidores
27
Documentos
235
Última venta
1 año hace

4.3

7 reseñas

5
5
4
1
3
0
2
0
1
1

Documentos populares

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes