[go: up one dir, main page]

0% found this document useful (0 votes)
10 views6 pages

IGCSE ICT TERM 1 Test

Uploaded by

Hardik
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)
10 views6 pages

IGCSE ICT TERM 1 Test

Uploaded by

Hardik
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/ 6

Python Programming Exam

Section A: Multiple Choice Questions (MCQs) (10 x 2 = 20 Marks)

1. Which of the following is a mutable data type in Python?


a) String
b) Tuple
c) List
d) Integer

2. What will be the output of the following code?

a) 1
b) 2
c) 3
d) 0

3. What is the correct syntax to create a variable in Python?


a) int x = 5
b) x = 5
c) var x = 5
d) x == 5

4. How do you generate a random integer between 1 and 10 using the


`random` module?
a) random.randint(1, 10)
b) random.random(1, 10)
c) random.rand(1, 10)
d) random.int(1, 10)
5. Which of the following statements is used to terminate a loop in
Python?
a) terminate
b) exit
c) break
d) pass

6. How many times will the following loop run?

a) 1
b) 2
c) 3
d) 4

7. In Python, which keyword is used to import a module?


a) include
b) import
c) require
d) module

8. Which of the following lists is correct for the output of the given
code?

a) [1, 2, 3]
b) [1, 2, 3, 4]
c) [1, 2, 4]
d) [1, 2, 3, 4, 5]
9. What will be the output of the following code?

a) Yes
b) No
c) Error
d) None

10. Which of the following is a correct way to use the `continue`


statement inside a loop?
a) The loop will stop when `continue` is executed
b) It will skip the current iteration and move to the next
c) It will exit the loop
d) It will skip all remaining iterations

Section B: True or False (4 x 2 = 8 Marks)


1. The “break” statement is used to skip an iteration of a loop.
2. Lists in Python can store different data types.
3. Python uses indentation to define blocks of code.
4. The “random” module in Python can be used to generate floating-
point numbers.
Section C: Fill in the Missing Code (4 x 2 = 8 Marks)

1. Fill in the missing code to allow the user to input 5 numbers, store
them in a list, and then print each number multiplied by 2:

2. Complete the code to calculate and print the sum of all even
numbers in a list:
3. Fill in the code to allow the user to input 3 names, store them in a
list, and check if a particular name exists in the list:

4. Complete the following code to find the largest number in the list
using a loop:
Section D: Theory Questions (3 x 3 = 9 Marks)

1. Explain the difference between a for loop and a while loop in Python.
When would you choose one over the other? Provide examples for both
types of loops.

2. Describe how if, else, and elif statements are used in Python for
decision-making. How does the control flow work when multiple
conditions are involved? Illustrate with an example.

3. What are lists in Python, and what are some of the common
operations that can be performed on them (e.g., appending, insert,
remove, pop, index)?

Section E: Code Problems (2 x 5 = 10 Marks)

1. Problem 1: Write a Python program that generates a random number


between 1 and 50, then asks the user to guess the number. The
program should keep running until the user guesses the correct
number. If the user’s guess is too low or too high, the program should
indicate it.

2. Problem 2: Write a Python program that takes a list of numbers as


input and outputs two new lists: one containing the even numbers and
one containing the odd numbers from the original list. Use a `for` loop
to achieve this.

You might also like