0% found this document useful (0 votes)
19 views14 pages

ITPWP - Autumn 2024 - QP (25480)

This document is an examination paper for an Introduction to Programming with Python course, scheduled for Autumn 2024. It consists of multiple-choice questions covering various programming concepts, each worth one mark, with a total of 30 marks available. The exam requires students to answer all questions and manage their time effectively within a one-hour limit.

Uploaded by

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

ITPWP - Autumn 2024 - QP (25480)

This document is an examination paper for an Introduction to Programming with Python course, scheduled for Autumn 2024. It consists of multiple-choice questions covering various programming concepts, each worth one mark, with a total of 30 marks available. The exam requires students to answer all questions and manage their time effectively within a one-hour limit.

Uploaded by

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

Introduction to Programming with Python

Local Examination

Autumn 2024

Examination Paper
Answer ALL questions.

Clearly cross out surplus answers.

Time: 1 hour

The maximum mark for this paper is 30.

Any reference material brought into the examination room must


be handed to the invigilator before the start of the examination.
Multiple Choice Question
Circle ONE (1) correct answer from A, B, C, or D for each question.
Each question is worth 1 mark.

Question 1

Which ONE (1) lists all of the variables in this program?

first = 0
second = 1
print(first + second)

A 0 1 B + =

C first second D print

1 mark

Question 2

Which ONE (1) is true of low-level languages?

A The program is easier for humans to B The program is quicker to write


read

C The program does not need translation D The program is machine independent
using a compiler or interpreter

1 mark

Page 2 of 18
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 3

Which ONE (1) is the Software Development Lifecycle stage where a test plan is first
created?

A Analysis B Design

C Implementation D Evaluation

1 mark

Question 4

Which ONE (1) is an example value of a Boolean data type?

A "False" B True

C "Yes" D 1

1 mark

Question 5

Which ONE (1) is a reason for including comments in a program?

A To test the program B To support maintenance

C To show outputs D To input data

1 mark

Page 3 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 6

Which ONE (1) of the programs will output 40?

A number = "20" B number = int("20")


number2 = "30" number2 = int("30")
print(number * 2) print(number2 - number1)

C number = int("20") D number = int("20")


number2 = int("30") number2 = int("30")
print(number * 2) print(number40)

1 mark

Question 7

Which ONE (1) is an example of nested statements?

A count = 0 B count = 0
count = input() for x in range(20):
while count < 100: count = count + input()
count = count + input() if count > 100:
print("Too many")
count = 100

C count = 0 D count = 0
count = input() print("The count is ",
print("The count is ", input())
count)

1 mark

Page 4 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 8

Which ONE (1) Python program contains a syntax error?

A print(10, 2) B print(10 \ 2)

C print(10 + 2) D print(10 % 2)

1 mark

Question 9

Which ONE (1) is the term for creating an object of a class?

A Inheritance B Encapsulation

C Polymorphism D Instantiation

1 mark

Question 10

Which ONE (1) scenario will not require data to be stored in a file?

A High-score table B Computer game progress

C Transaction records D Calculation from data input

1 mark

Page 5 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 11

Which ONE (1) is the output produced from this program?

myString = "Hello World!"


for x in range(len(myString)):
if x % 2 == 0:
print(myString[x])

A H e l l o W o r l d B e
l

o
l
!

C H D Hello
l
o
W
r
d

1 mark

Question 12

Which ONE (1) Python program performs the correct function of a get method for the
private attribute number?

A def getNumber(self): B def getNumber(self, number):


return self.__number return number

C def getNumber(self.number): D def getNumber(self):


return self.number return number

1 mark

Page 6 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 13

Which ONE (1) is a description of exception handling?

A End a loop at the correct time B Save the program's progress when
there is a run-time error

C Create a list of the correct length for D Catch an invalid operation to prevent a
the data in a file run-time error

1 mark

Question 14

Which ONE (1) shows all of the outputs from this Python program?

def myFunction(first, second):


print(first + second)
print(first - second)
return (first * second)

myFunction(20, 10)

A 30 B 30
10 10
200

C 200 D 20 10

1 mark

Question 15

Which ONE (1) is a definition of a logic error?

A The program runs but crashes B The program runs but does not
unexpectedly produce the expected output

C The program does not follow the rules D The program does not write to the
of the language correct file

1 mark

Page 7 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 16

Which ONE (1) is a definition of a constructor in object oriented programming?

A To validate the existence of the object B To create an instance of the object

C To define the methods for the object D To show how data is inherited between
classes

1 mark

Question 17

'A programmer is creating a simulation for flying a plane. They identify the key features
of the program and decide to simplify the outside world by removing specific data about
the planet and the weather.'

Which ONE (1) term describes the process in this description?

A Abstraction B Encapsulation

C Inheritance D Instantiation

1 mark

Question 18

Which ONE (1) is a feature of a compiler and not an interpreter?

A It produces object code B It identifies syntax errors

C It is a translator D It produces error messages

1 mark

Page 8 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 19

Which ONE (1) is a definition of casting?

A Calculating the difference between two B Converting data from one data type to
values another data type

C Formatting an output message D Validating text on input

1 mark

Question 20

Which ONE (1) Python program will produce the output 105 when the number 10 is
input?

A enteredNumber = int(input("Enter a number "))


print((enteredNumber ^ 2) + 5)

B enteredNumber = int(input("Enter a number "))


print((enteredNumber ** 2) + 5)

C enteredNumber = int(input("Enter a number "))


print((enteredNumber % 2) + 5)

D enteredNumber = int(input("Enter a number "))


print((enteredNumber // 2) + 5)

1 mark

Page 9 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 21

Which ONE (1) Python program initialises a list with the numbers 1 to 10 inclusive?

A mylist = [] B mylist = []
count = 0 count = 0
while count < 10: while count < 10:
mylist.append(count) mylist.append(count+1)
count = count + 1 count = count + 1

C mylist = [] D mylist = []
count = 1 count = 1
while count < 10: while count < 11:
mylist.append(count+1) mylist.append(count+1)
count = count + 1 count = count + 1

1 mark

Question 22

Which ONE (1) Python program is an example of an existence check?

A answer = input("Enter a day of the week ").lower()


while answer == "":
answer = input("Enter a day of the week ").lower()

B answer = input("Enter a day of the week ").lower()


while len(answer) < 6:
answer = input("Enter a day of the week ").lower()

C answer = input("Enter a day of the week ").lower()


listDays = ["monday", "tuesday", "wednesday", "thursday",
"friday", "saturday", "sunday"]
while answer not in listDays:
answer = input("Enter a day of the week ").lower()

D answer = input("Enter a day of the week ").lower()


while answer.isdigit() == True:
answer = input("Enter a day of the week ").lower()

1 mark

Page 10 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 23

This Python program should output where a person can apply for membership to a club.
To become a member, the person must be under 18 years old and have a parent who is
a member, or the person 18 or older and either have an income of over £20000 or have
a parent who is a member.

Which ONE (1) statement will give the correct output?

A age = int(input("Enter your age "))


parent = input("Do you have a parent who is a member? Enter
Yes or No ").lower()
if parent == "yes":
print("Accepted")
elif age >= 18:
income = int(input("Enter income to nearest £ "))
if(income >= 20000):
print("Accepted")
else:
print("Not accepted")
else:
print("Not accepted")

B age = int(input("Enter your age "))


parent = input("Do you have a parent who is a member? Enter
Yes or No ").lower()
if parent == "yes" and age < 18:
print("Accepted")
elif age >= 18:
income = int(input("Enter income to nearest £ "))
if(income > 20000):
print("Accepted")
else:
print("Not accepted")
else:
print("Not accepted")

C age = int(input("Enter your age "))


parent = input("Do you have a parent who is a member? Enter
Yes or No ").lower()
if parent == "yes" and age < 18:
print("Accepted")
else:
income = int(input("Enter income to nearest £ "))
if(income >= 20000):
print("Accepted")
else:
print("Not accepted")
else:
print("Not accepted")
Page 11 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks

D age = int(input("Enter your age "))


parent = input("Do you have a parent who is a member? Enter
Yes or No ").lower()
if parent == "yes":
print("Accepted")
elif age >= 18:
income = int(input("Enter income to nearest £ "))
if(income > 20000):
print("Accepted")
else:
print("Not accepted")
else:
print("Not accepted")

1 mark

Question 24

Which ONE (1) Python program will produce the following output?
My name is "Jane"

A print("My name is "Jane"") B print("My name is \"Jane\"")

C print("My name is Jane") D print("My name is #"Jane#"")

1 mark

Question 25

Which ONE (1) is the Software Development Life Cycle stage where pseudocode and
flowcharts are predominantly used?

A Testing B Design

C Implementation D Analysis

1 mark

Page 12 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 26

Which ONE (1) is an example that will be detected and handled by the Python inbuilt
exception type IndexError?

A An attempt to access data from a B An attempt to access a file that does


variable that is not yet defined not exist

C An attempt to access element 10 in a D An attempt to multiply a string by an


list of 5 items integer

1 mark

Question 27

Which ONE (1) is an example of the use of inheritance in object oriented programming?

A A class parrot can use the methods B A class bag has many objects of type
and attributes from the class bird item

C A class horse has attributes and D A class student has many objects of
methods type class

1 mark

Question 28

Which ONE (1) Python program is an example of a sequence?

A x = 1 B x = 1
y = 2 y = 2
if x > y: while(x < y):
print(x) print(x)
else: x = x + 1
print(y)

C def newTest(data1): D x = 1
if data1 == 0: y = 2
print("Invalid") z = 3
else: print(x + y + z)
print("Valid")

1 mark

Page 13 of 14
Introduction to Programming with Python © NCC Education Limited 2024
Marks
Question 29

Which ONE (1) is the content of the list after this program is run?
listData = [1,2,5,1,2,6,5]
print(listData.pop())
print(listData.pop())

A [5,1,2,6,5] B [1, 2, 5, 1, 2]

C [1,2,5,1,2,6,5] D [2,5,1,2,6]

1 mark

Question 30

Which ONE (1) is an example of an IDE feature that helps a user debug a program?

A Auto-indent B Auto-complete

C Breakpoints D Print statements

1 mark

End of paper

Page 14 of 14
Introduction to Programming with Python © NCC Education Limited 2024

You might also like