100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Otro

Computation thinking Homework Thinking ahead 2 answers

Puntuación
-
Vendido
-
Páginas
2
Subido en
01-12-2021
Escrito en
2021/2022

OCR A LEVEL COMPUTER SCIENCE Computational thinking Homework Thinking ahead 2 answers.

Institución
Grado








Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Libro relacionado

Escuela, estudio y materia

Nivel de Estudio
Editores
Tema
Curso

Información del documento

Subido en
1 de diciembre de 2021
Número de páginas
2
Escrito en
2021/2022
Tipo
Otro
Personaje
Desconocido

Temas

Vista previa del contenido

Homework 2 Thinking ahead
Unit 10 Computational thinking

Homework 2 Thinking ahead Answers
1. (a) Using the headings given, specify the inputs, outputs and precondition for the following
problem:

Given a list of integers, return a list containing every number divisible by 7. [4]

Name: sevens

Inputs: A list of integers listInt = (i1, i2, i3,… in)

Outputs: A list of integers list7 = (i1, i2, i3,… im)

Precondition: length of listInt >0

(b) Write a pseudocode algorithm for this function, and a main program which calls the
function and outputs the resulting list. [4]

function sevens(listInt):
n = len(listInt)
list7 = []
for i = 1 to n-1
if listInt[i] mod 7 == 0
list7.append (listInt[i])
endif
next i
return list7
endfunction

listInt = [7,33,35,42,49,50,57]
print("List of elements divisible by 7:", sevens(listInt))

(c) Give two different lists that you could use to test two aspects of this program, and the
expected output. [4]

list1 = [2, 6, 46, 90, 0] Expected output: list7 =[0]

list2 = [2, 6, 46, 90] Expected output: []

list2 = [7, 33, 35, 42, 49, 50, 57] Expected output: list7 = [7, 35,42,49]


2. (a) Explain what is meant by caching, and give an example of when it might be used. [3]
Caching is the temporary storage of programs and data which have recently been
used. This is frequently used to store web pages / instructions/data which the user
/program may need again within a short time.
(b) Explain one benefit and one drawback of caching. [2]
Improves performance/saves bandwidth if the same pages do not have to be reloaded
several times.
Drawback: May retrieve a “stale” copy of a web page if the page has been updated
bysince it was cached.
$9.21
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
STUVIA1233455

Conoce al vendedor

Seller avatar
STUVIA1233455 Aston University, Birmingham
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
0
Miembro desde
4 año
Número de seguidores
0
Documentos
3
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

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