Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Software Dev Python Test Revision

The document is a Python revision booklet containing multiple choice questions, fill in the blanks, and short answer questions designed for Year 10 Software Development Extension students. It covers various Python concepts such as variable names, data structures, loops, functions, and methods. The booklet aims to help students prepare for their tests by providing practice questions and coding tasks.

Uploaded by

tylerdoesthing69
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Software Dev Python Test Revision

The document is a Python revision booklet containing multiple choice questions, fill in the blanks, and short answer questions designed for Year 10 Software Development Extension students. It covers various Python concepts such as variable names, data structures, loops, functions, and methods. The booklet aims to help students prepare for their tests by providing practice questions and coding tasks.

Uploaded by

tylerdoesthing69
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Python Revision Booklet

Part 1: Multiple Choice Questions (15 Questions)

1. What is the output of the following code?

x=3

y=4

print(x * y)

a) 7
b) 12
c) 34
d) 43

2. Which of the following is an invalid variable name in Python? a)


my_variable
b) 2nd_variable
c) variable_2
d) _variable

3. How do you create a tuple in Python? a) myTuple = [1, 2, 3]


b) myTuple = {1, 2, 3}
c) myTuple = (1, 2, 3)
d) myTuple = <1, 2, 3>

4. Which of the following is used to execute a block of code repeatedly


in Python? a) for
b) if
c) else
d) elif

5. What will the following code print?

for i in range(4):

print(i + 1)

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

Year 10 Software Development Extension – Test Revision (v1 – Aug 2024)


1
6. How do you call a function named myFunction in Python? a) call
myFunction()
b) myFunction()
c) function myFunction()
d) call function myFunction()

7. What is the output of the following code?

x = 20

if x == 10:

print("Ten")

elif x > 15:

print("Greater than Fifteen")

else:

print("Other")

a) Ten
b) Greater than Fifteen
c) Other
d) None

8. Which of the following is an immutable data structure in Python? a)


List
b) Tuple
c) Dictionary
d) Set

9. How do you remove the last element from a list in Python? a)


myList.pop()
b) myList.remove()
c) myList.delete()
d) myList.end()

10. What is the output of the following code?

myList = ["a", "b", "c"]

myList.append("d")

print(myList)

a) ["a", "b", "c", "d"]


b) ["a", "b", "c"]

Year 10 Software Development Extension – Test Revision (v1 – Aug 2024)


2
c) ["d", "a", "b", "c"]
d) ["a", "b", "d", "c"]

11. Which loop is used to iterate over a sequence such as a list?


a) while
b) for
c) repeat
d) loop

12. How do you access the last element of a list myList? a)


myList[-1]
b) myList[0]
c) myList[1]
d) myList[last]

13. What is the output of the following code?

def greet(name):

return "Hello " + name

print(greet("Alice"))

a) Alice
b) Hello Alice
c) Hello
d) Error

14. Which of the following is the correct way to check if x is equal


to 5 in Python? a) if x == 5:
b) if x = 5:
c) if (x == 5)
d) if (x = 5):

15. How do you write a multi-line comment in Python? a) // This is


a comment
b) # This is a comment
c) /* This is a comment */
d) """ This is a comment """

Year 10 Software Development Extension – Test Revision (v1 – Aug 2024)


3
Part 2: Fill in the Blanks (5 Questions)

1. The __________ function in Python is used to display output to the


screen.

2. A __________ is a collection of key-value pairs in Python.

3. The __________ keyword is used to check multiple conditions in an if


statement.

4. A __________ is used to store multiple elements in a single variable in


Python.

5. The __________ method is used to find the number of elements in a


list.

Part 3: Short Answer Questions (10 Questions)

1. Write a Python code snippet to create a dictionary called student


with keys "name", "age", and "grade" and their respective values
"John", 16, and "A".

2. Explain the difference between a while loop and a for loop. Provide
an example of each.

Year 10 Software Development Extension – Test Revision (v1 – Aug 2024)


4
3. Write a Python function called square that takes a number as an
argument and returns its square.

4. What will the following code output? Explain your answer.

num = 9

if num % 3 == 0:

print("Divisible by 3")

else:

print("Not divisible by 3")

Year 10 Software Development Extension – Test Revision (v1 – Aug 2024)


5
5. Write a Python code snippet to create a list of numbers from 1 to 5
and then print each number using a loop.

6. What does the following code do? Explain each step.

myString = "Python"

for char in myString:

print(char)

Year 10 Software Development Extension – Test Revision (v1 – Aug 2024)


6
7. Describe what a function is in Python and why it is useful. Provide an
example of a simple function.

8. Write a Python code snippet to check if the key "name" exists in a


dictionary called person.

Year 10 Software Development Extension – Test Revision (v1 – Aug 2024)


7
9. How can you convert a string to an integer in Python? Provide an
example.

10. Explain the difference between the append() and insert()


methods in Python. Provide an example of each.

Year 10 Software Development Extension – Test Revision (v1 – Aug 2024)


8

You might also like