0% found this document useful (0 votes)
224 views3 pages

Y10 03 CT18 Assessment

Uploaded by

ayten.sherif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
224 views3 pages

Y10 03 CT18 Assessment

Uploaded by

ayten.sherif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

TOPIC 1: COMPUTATIONAL THINKING

Assessment

ASSESSMENT FOR Y10-03-CT18

Name ____________________________________________ Date __________________

Question 1
Define the term ‘array’. (2)
data structure that stores a collection of elements, typically of the same data type

Question 2
Python does not have built-in arrays. Give the name of the data structure that Python uses to
implement arrays? (1)
list

Question 3
Give the line(s) of code needed to create (declare/initialise) a list of integers named
myNumbers, from 5 to 10. (2)

myNumbers = list(range(5,11))
print (myNumbers)

Question 4
Load file ‘Q04_Student’ into your programming environment.
 Add a ‘for in list’ loop to print each item in ‘fruit’ on a separate line.
 Save your file as ‘Q04_Finished’. (2)

fruits = ["Grape", "Orange", "Lime", "Lemon", "Pineapple"]


for i in fruits:
print(i)

Question 5
Load file ‘Q05_Student’ into your programming environment.
 Add a ‘for in range’ loop to print each item in ‘fruit’ on a separate line, in reverse
order.

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only. This material is not copyright free.
1
TOPIC 1: COMPUTATIONAL THINKING

Assessment

 Save your file as ‘Q05_Finished’. (4)

fruits = ["Apple", "Banana", "Clementine"]

for i in range(len(fruits)-1,-1,-1):
print(fruits[i])

Question 6
Subprograms may or may not return results. Give two other features of subprograms. (2)
1. Subprograms can accept parameters or arguments, allowing them to receive
input data from the caller.

2. Subprograms can group together related code into a single unit or entity
providing an easy and quick way to organize a program.

Question 7
State the type of subprogram that always returns a result. (1)
Function

Question 8
Load file‘Q08_Student’ into your programming environment. (6)
Amend the code to:
 include a subprogram to simulate the roll of a die
 include a call to the subprogram in the main program
 display the result to the user in the main program.
Save your completed code as ‘Q08_Finished’.

def dice_roll():
rolled_number = random.randint(1,6)
return rolled_number
dice_roll()

rolled_dice = dice_roll()

print ("You rolled a", rolled_dice)

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only. This material is not copyright free.
2
TOPIC 1: COMPUTATIONAL THINKING

Assessment

Question 9
Load ‘Q09_Student’ into your development environment.
Amend the code so that it meets these requirements:
 includes a subprogram named ‘displaySky’
 the subprogram takes two lists as its input parameters
 the subprogram should display a star name, followed by a single space, and
the star’s distance from Earth
 each star should be displayed on a separate line
 the main program should only have two lines of code
 the program should display ‘Goodnight’ when finished.
Save your completed code as ‘Q09_Finished’. (10)

def displaySky(starNames,starDistance):
for name, distance in zip(starNames,starDistance):
print(name,distance)

starNames = ["Rigel", "Canopus", "Sirius", "Betelgeuse", "Vega"]


starDistance = [860.0, 74.0, 8.6, 1500.0, 25.0]

displaySky(starNames,starDistance)
print("Goodnight")

Total marks: 30

© Pearson Education Ltd 2020. Copying permitted for purchasing institution only. This material is not copyright free.
3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy