0% found this document useful (0 votes)
17 views7 pages

MIDTERM Test - CS - 9IGCSE

This document is a mid-term test for IGCSE students covering programming concepts, including multiple choice questions on variables, subroutines, and Python programming. It also includes sections for definitions of key terms, pseudocode algorithms, and practical programming tasks related to teacher records. The test is structured into multiple sections with a total of 55 points available.

Uploaded by

hau pham
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)
17 views7 pages

MIDTERM Test - CS - 9IGCSE

This document is a mid-term test for IGCSE students covering programming concepts, including multiple choice questions on variables, subroutines, and Python programming. It also includes sections for definitions of key terms, pseudocode algorithms, and practical programming tasks related to teacher records. The test is structured into multiple sections with a total of 55 points available.

Uploaded by

hau pham
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/ 7

9 IGCSE

SEMESTER 2 MID TERM TEST

Time: 60 minutes

Date: Class:

Name: Score:
Section A: [Multiple Choice]

Circle the correct answer

Q.1: What term is used to describe data passed into/out of a program?


a. Local variable c. Loop
b. Global variable d. Parameter

Q.2: What is a subroutine in computer programming?


a. A sequence of program instructions that perform a c. A unit of code that can be reused
specific task. in programs.
b. A way to structure and organize programming code. d. All of the above.

Q.3: What are the types of subroutines in python?


a. Procedures and functions c. Loops, conditions and functions
b. Parameters, arguments and procedures d. Classes and procedures

Q.4: What is an advantage of using a local variable


a. The function can be used with different variables for c. It's easier for the user to call
the same purpose. back to it outside the function.
b. The code is harder to disrupt. d. local variables are useless.

Q.5: Define a global variable


a. A variable declared right at the end of the main c. A variable declared at the
program. beginning of the main program.
b. A variable declared in the main program d. A variable defined in a function

Q.6: Which of the following best describes the order in


which these lines are processed in Python.

a. 4, 1, 2 c. 4, 2, 1
b. 1, 2, 3, 4 d. 3, 1, 2

Q.7: How do you correctly call this function.

a. print (x=square ()) c. x=square ()


b. def (1) d. x=square (5)

Q.8: How many times will Boo print?

a. None c. 4
b. 5 d. 1
Q.9: What are the parameters within this procedure?

a. first name and second name c. first and surname


b. first and second name d. myname, first and second name

Q.10: What would the output be from this program?

a. Error c. Hello
b. Hello, World d. World

Total points for section: ____ [15]


Section B: [Concepts, Key terms and Definitions]

Q.1: Define the following key terms and give examples if necessary: [5]

a. Record

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

b. Constructor

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

c. Procedure

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

d. Function

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

e. Parameter

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________
Q.2: Figure below shows an algorithm, written using pseudocode, that uses a RECORD data structure for
storing information about a film.

Each record stores four pieces of information about a film:

• Film title
• Certificate (e.g 12A, PG)
• Year the film was made
• If the film is currently being shown at a cinema

There are records for three films and these films are stored alphabetically in an array called filmCollection.

The Pseudocode outputs the title of the newest of the three films.

Part of the algorithm has been replaced by the label L1.

a. Write a pseudocode statement that updates the antMan record to show that the film is
currently being shown at the cinema. [2]

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

b. Write the constructor in Python that initializes the fields of the above record [3]

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________

______________________________________________________________________________
Q.3: The size of a sound file is calculated using the following formula:

size (in bits) = sampling rate * sample resolution * seconds

To calculate the size in BYTES, the number is divided by 8.

The algorithm below, should output the size of a sound file in BYTES that has been sampled 100
times per second, with a sample resolution of 16 bits and a recording length of 60 seconds.

A subroutine called getSize has been developed as part of the algorithm.

a. Complete the algorithm, by filling in the gaps using the items below. You will not need
to use all the items. [6]

b. A local variable called size has been used in getSize. Explain what is meant by a local
variable. [1]

_________________________________________________________________________

_________________________________________________________________________

State Two advantages of using subroutines in structured programming. [2]

_________________________________________________________________________

_________________________________________________________________________

_________________________________________________________________________

d. Name the difference between a procedure and a function. [1]

_________________________________________________________________________

_________________________________________________________________________

Total points for section: ____ [20]


Section C: [Python Programming]

- Write and test your solution on Python IDLE or online compiler.


- Upon completion, copy the solutions and paste them in one Microsoft Word file and upload them on
the link provided.

Q.1: Sentia School keeps records of all teachers in a database file. Each record stores three fields, the
teacher’s name, number of years working at Sentia School, and salary.
a. Write a python program that allows the HR to create multiple records of teacher’s
information. [10]

b. Write a subroutine Highest_Salary that returns the teacher(s) earning the highest salary. [2]

c. If a teacher has worked at Sentia School for more than 10 years and is earning less than
$1000, HR will increase their salary by 5%. Write a subroutine called Raise that implements the
above information. [5]

d. Write a subroutine Average_Salary that returns the average salary of teachers at Sentia
School. [3]

Total points for section: ____ [20]

You might also like