Name: __________________________________ class : ___________
Classwork (7) Unit: Strings – lesson7 – (Grade 11)
• Multiple Choice:
1. What is the output of the following code?
var1 = 1
var2 = 2
var3 = "3"
print(var1 + var2 + var3)
A 6
B 33
C 123
D Error. Mixing operators between numbers and strings are not supported
2. What is the output of the following code?
Z = 40
D = 50
Z, D = D, Z
Print (Z, D)
A 40,50
B 50,40
C (40,50)
D (50, 40)
3. What is the output of the following code?
Z = 40
D = 50
Print (Z, D)
A 40,50
B 50,40
C (40,50)
D (50, 40)
4. What is the output of the following code?
print( "50" + "50" + "50" )
print( 50 + 50 + 50 )
150
A
50 50 50
50 50 50
B
150
150
C
150
50 50 50
D
50 50 50
5. What is the output of the following code?
var = "James" * 2 * 3
print(var)
A James James James James James James
B James James James James James
C James James James James
D Error: invalid syntax
6. Guess the correct output of the following String operations?
str1 = 'Welcome'
print(str1 * 2)
A WelcomeWelcome
B 2Welcome
C str1
D The Program executed with errors
7. What will be the output of the following program?
x = "hello"
print ([Link]())
A hello
B Hello
C HELLO
D The Program executed with errors
8. What will be the output of the following program?
x = “ATIS”
print(len(x))
A 3
B 4
C 5
D The Program executed with errors
Prepared by: Ms. Zizi Mohamed Said (Computer Science)
Name: __________________________________ class : ___________
Classwork (8) Unit 4: Strings – lesson 7 – (Grade 11)
• Multiple Choice:
1. What is a string in Python?
A A type of number used for calculations.
B A collection of characters enclosed in single or double quotes.
C A function that performs mathematical operations.
D A variable that stores only integers.
2. Which operator is used to concatenate two strings in Python?
A *
B +
C /
D -
3. What will the following code output?
print("Hello " + "World")
A Hello World
B HelloWorld
C Hello+World
D Error
4. How can you repeat a string multiple times in Python?
A By using the addition operator (+).
B By using the multiplication operator (*).
C By using the division operator (/).
D By using the subtraction operator (-).
5. What is the output of the following code?
print("ATIS" * 3)
A ATIS3
B 3ATIS
C ATISATISATIS
D Error
6. What does the upper() function do to a string?
A Converts all characters to uppercase letters.
B Converts all characters to lowercase letters.
C Reverses the string.
D Finds the length of the string.
7. What is the purpose of the len() function in Python?
A To count the total number of characters in a string.
B To calculate the sum of two numbers.
C To convert a string to lowercase.
D To repeat a string multiple times.
8. If the code is :
print(len("Hello Python"))
what will the output be?
A 10
B 11
C 12
D Error
9. How can you create a string in Python?
A Using single or double quotation marks
B Using curly brackets { }
C Using square brackets [ ]
D Using angle brackets < >
[Link] is the result of the following operation?
print("Hello" + " " + "World")
A HelloWorld
B Hello World
C Hello+World
D Error
[Link] will be the output of the following code?
print("Hi" * 3)
A HiHiHi
B Hi 3 times
C Error
D Hi * 3
[Link] function is used to count the number of characters in a string?
A count()
B size()
C length()
D len()
[Link] will be the output of the following code?
print(len("Python 3"))
A 6
B 7
C 8
D 9
Prepared by: Ms. Zizi Mohamed Said (Computer Science)
Name: __________________________________ class : ___________
Classwork (9) Unit 4: Numbers – lesson 8 – (Grade 11)
• Multiple Choice:
1. Which of the following functions is used to convert a string to an integer in Python?
A float()
B int()
C string()
D type()
2. What happens when you use int() on a decimal number like "25.3"?
A It rounds to the nearest integer
B It converts to 25.3 as a float
C It converts to 25 and ignores the decimal part
D It produces an error
3. What is the output of the following code?
x = "10"
print(float(x))
A 10
B "10.0"
C 10.0
D Error
4. Which function is used to determine the data type of a variable in Python?
A type()
B convert()
C dataType()
D getType()
5. What is the output of the following code?
num1 = "5"
num2 = "10"
print(num1 + num2)
A 15
B "510"
C Error
D 50
6. What happens when x = 2, is executed?
A x remains an integer (int).
B x becomes a list.
C x becomes a tuple with one element.
D Python throws an error.
7. What is the output of print(type(x)) after executing x = 2, ?
A <class 'int'>
B <class 'tuple'>
C <class 'list'>
D <class 'float'>
8. What is the output of print(type(x)) after executing x = 2, ?
A <class 'int'>
B <class 'tuple'>
C <class 'list'>
D <class 'float'>
Prepared by: Ms. Zizi Mohamed Said (Computer Science)
Name: __________________________________ class : ___________
Classwork (10) Unit 4: Lists, Tuples, and Dictionaries – lesson 10 – (Grade 11)
Multiple Choice:
Python Lists
1. Which of the following is a characteristic of Python lists?
A Immutable
B Fixed size
C Dynamic and mutable
D Only holds integers
2. Which function is used to add an element to a Python list?
A insert()
B append()
C extend()
D add()
3. What happens when you use the remove() method on a list?
A Clears the entire list
B Removes an element at a specific index
C Removes an element based on value
D Removes the last element
4. Which of the following operators can be used to check if an element is not present in a
list?
A not exist
B not in
C !=
D absent()
Python Tuples
5. Which of the following best describes a tuple in Python? num1 = "5"
A Dynamic and mutable
B Static and mutable
C Immutable
D Can only store integers
6. What type of brackets are used to define tuples in Python?
A Square brackets [ ]
B Curly braces { }
C Parentheses ( )
D Angle brackets < >
7. Which of the following is an advantage of using tuples over lists?
A More memory efficient
B Easier to modify
C Allows dynamic resizing
D Supports duplicate keys
Python Dictionaries
8. What is the correct way to define a dictionary in Python?
A dict = ['key1', 'value1', 'key2', 'value2']
B dict = {'key1': 'value1', 'key2': 'value2'}
C dict = ('key1', 'value1', 'key2', 'value2')
D dict = ['key1': 'value1', 'key2': 'value2']
9. Which function is used to delete a specific element from a dictionary by its key?
A remove()
B pop()
C del()
D clear()
[Link] of the following best describes a dictionary in Python?
A A collection of ordered elements
B A collection of key-value pairs
C A collection of immutable values
D A collection of lists and tuples
Prepared by: Ms. Zizi Mohamed Said (Computer Science)
Name: __________________________________ class : ___________
Classwork (11) Unit 4: Conditional Statements in Python – (Grade 11)
• Multiple Choice:
1. How many choices are possible when using a single if-else statement?
A 1
B 2
C 3
D 4
2. If else statement, ___________________ :
A Outputs a message on the screen
B Is a decision
C Gets data from the user
D A loop controlled by a decision
3. Which Python statement will check to see if a is greater than b?
A if a > b:
B if (a > b)
C if [a > b]
D if {a > b}
4. How do we make sure that IF statements are indented correctly?
A Use the Enter Key
B Use the Shift Key
C Use the Tab key
D Use the Space key
5. What will this code output?
A Fizz
B Buzz
C True
D False
6. How do we make sure that IF statements are indented correctly?
A Use the Enter Key
B Use the Shift Key
C Use the Tab key
D Use the Space key
7. What is the output of the following code?
letter = "t"
if letter in 'Python':
print("Yes")
else:
print("No")
A Yes
B No
C ‘Python’
D “t”
8. What is the output of the following code?
letter = "t"
if letter not in 'Java':
print("Yes")
else:
print("No")
A Yes
B No
C ‘Python’
D “t”
Exercises
1. If - Assign 10 to x, If x is bigger than 0, print "x is a positive number".
The answer:
x = 10
input if x > 0:
print("x is a positive number")
output ("x is a positive number")
2. If-else - Assign -50 to y, If y is bigger than 0, print "y is a positive number". Else, print "y is
a negative number".
The answer:
y = -50
if y > 0:
input print("y is a positive number")
else:
print("y is a negative number")
output ("y is a negative number")
Name: __________________________________ class : ___________
Classwork (12) Unit 4: Conditional Statements in Python – (Grade 11)
Question 1: Complete the given Python codes to get the required outputs as the
following:
1-input sub = (“Arabic”)
print (type(………sub ………….))
output …< class ‘str’> ………………………………………………………………………….………………….….
2-input hobby = (“reading” ,)
print (type(…………hobby ……….))
output ……< class ‘tuple’> …………………………………………………………………………………………….….
3-input
code= [ “PYTHON”, “HTML” ] * 2
print (…………code …………..)
print (len(…………code ………..))
output
……[ “PYTHON”, “HTML” , “PYTHON”, “HTML” ] …………………….…….
……………… 2 …………………………………………………………………….……………………….…….
4-input D = …… [True , False , 23.562 , “school” , 2026] …..……………………….…….
print (……… D …………)
output [True , False , 23.562 , “school” , 2026]
5-input
points_1 = [54, 78, 50, 20]
points_2 = [54, 87, 30]
print (points_1 > …………… points_2 ………….)
output ……………… false …………………………………………………………………………..………………….………..
6-input Z= 40.5
print (…………Z ……………..)
output
…………40.5 ……………………………………………………………….……………………….…….
7-input Z= 40.5
print (type (……………Z …………..))
output
……………< class ‘float’ > ……………………………………………………….……………………….…….
8-input Z= 40
print (type (……………Z …………..))
output
……………< class ‘int ‘ > …………………………………………………………….……………………….…….
9-input Z= 40.5 ,
print (type (…………Z ……………..))
output
……< class ‘tuple’> …………………………………………………………………………………………….….
10-input Z= “40.5” ,
print (type (……………Z …………..))
output
……< class ‘tuple’> …………………………………………………………………………………………….….
11-input Z= “40.5”
print (type (…………Z …………..))
output
…< class ‘str’> ………………………………………………………………………….………………….….
Name: __________________________________ class : ___________
Classwork (13) Unit 4: Tuples – Lists – Dictionaries- lesson 10 (Grade 11)
Question 1: Complete the given Python codes to get the required outputs as the
following:
1-input record = (…………1, ‘Adisa’, ‘Software Engineer’……….)
print (…………record ………….)
print (record[2])
output ( 1, ‘Adisa’, ‘Software Engineer’)
……… Software Engineer…………….……
2-input fruit = (“orange”)
print (type(………fruit ………….))
output ……………<class 'str'> …………….….
3-input fruit = (“banana” ,)
print (type(………fruit ……….))
output ………………<class 'tuple'> …………………………………….….
4-input fruit = “apple” ,
print (type(…………fruit ……….))
output ………………<class 'tuple'> …………………………………….….
5-input fruit = [“strawberry”]
print (type(…………fruit ……….))
output ………… <class 'list'>………………….….
6-input r = (5)
print (type(…………r ……………….))
output ………… <class 'int'>……………….….
7-input s = (7 ,)
print (type(…………s …………….))
output ………………<class 'tuple'> …………………………………….….
8-input d = {“no” : 23}
print (type(…………d …………….))
output ………………<class 'dict'> …………………………………….….
9-input X = [“sun”, “moon”, earth” ,”sky”, “mars”]
Y = [“mars”, “earth”, moon” ,”sun”, “sky”]
print (X = = Y)
print (X ! = Y)
print (X is Y)
output …………………………………… False……………………………………….……….
……………………………………True……………………………………………………
…………………………………… False……………………………………………………
10-input C = …… [ 34.67 , "HOUSE" , 2 , 8 , "market" , True , 6.85126 , False ]……….
print (C)
output [ 34.67 , “HOUSE” , 2 , 8 , “market” , True , 6.85126 , False ]
11-input tennis= [ “ping”, “pong” ] * 4
print (…………tennis ……………..)
print (len(…………tennis ……………..))
output
………… ['ping', 'pong', 'ping', 'pong', 'ping', 'pong', 'ping', 'pong']……
………………………………8………………………………………….….…….
12-input S = [“Arabic”, “Islam”, “English”, “Math”, “Science”, “ICT”]
print ( S [ 2 : 5 ])
print ( S [ -6 : 4 ])
print (S [ 2 : 5 ] = = S [ -6 : 4 ])
print (S [ : 3 ] , S [ 0 : 3 ])
output
………… ['English', 'Math', 'Science', 'ICT'] …………
………… ['Arabic', 'Islam', 'English', 'Math'] …………
………… False…………
………… ['Arabic', 'Islam', 'English'] ['Arabic', 'Islam', 'English'] …………
13-input flowers = [“Rose”, “Lily”, “Sunflower”, “Orchid”, “Aster”]
print (flowers [ …3…. : …4….. ])
print (flowers [ -5 : …2….. ])
print (flowers […1…. : 4 ])
output [“Orchid”]
[“Rose”, “Lily”]
[ “Lily”, “Sunflower”, “Orchid”]
14-input Planets_1 = [“Mercury”, “Venus”, “Earth”, “Mars”]
Planets_2 = [“Jupiter”, “Saturn”, “Uranus”, “Neptune”]
print (…………Planets_1 ………… ! = Planets_2)
output
…………… True …………………..
15-input days = [“Sunday”, “Monday”, Tuesday”]
favorite_day = “Friday”
found = favorite_day not in …………… days …………………….
print (found)
output ……………… True ………………………..
16-input Points_1 = [74, 67, 40, 15]
Points _2 = [74, 76, 20]
print (Points _1 < ………………………………………………….)
output ………………………………………………..
17-input months = [“March”, “April”, June”]
favorite_month = “July”
found = favorite_month in ……………… months ………………….
print (found)
output …………………… False ………………..
18-input flowers_1 = [“Lily”, “Rose”, “Tulip”, “Sunflower”]
flowers_2 = [“Lotus”, “Orchid”, “Lavender”, “Aster”]
print (flowers_1 = = ………… flowers_2 …………)
output
……………… False …………………..
19-input continents = [“Asia”, “Africa”, “Europe”, “Australia”, “Antarctica”]
continents.……..remove…… (“Europe”)
print (…… continents……)
output [Asia”, “Africa”, “Australia”, “Antarctica”]
20-input continents = [“Asia”, “Africa”, “Europe”, “Australia”, “Antarctica”]
continents.……..remove…… (“Europe”)
print (…… continents……)
output [Asia”, “Africa”, “Australia”, “Antarctica”]
21-input Oceans= [“Pacific”, “Atlantic”, “Indian”, “Arctic”]
Oceans.……..clear( )……
print (…………Oceans ………..)
output [ ]
- Create a dictionary 'data' with two key-value pairs, containing the following data:
Id Name Position Depart Salary
4 Saleh Engineer Civil 1000
then Print the original dictionary 'data'.
15-input
…………data={‘Id’:4, ‘Name’: ‘Saleh’, ‘Position’: ‘Engineer’, ‘Depart’: ‘Civil’,
‘Salary’: 1000} …………
……… print(data) ……………………………………………………………….……………………….…….
output
{‘Id’:4, ‘Name’: ‘Saleh’, ‘Position’: ‘Engineer’, ‘Depart’: ‘Civil’, ‘Salary’:
1000}
16-input DATA = {“No” : 313 , “Client” : “Adel”, “Company” : “IBM”}
………… DATA . ……..clear( )…… …………..………………..
print (……………DATA ……………)
output
{ }
Name: __________________________________ class : ___________
Classwork (14) Unit 4: Lists, Tuples, and Dictionaries - lesson 10 - (Grade 11)
• Multiple Choice:
1. What is the output of the following code?
fruits=["apple", "orange", "banana", "chery"]
print(len(fruits))
A 22
B 30
C 4
D 6
2. What is the output of the following code?
odd_numbers = [1, 3, 5]
even_numbers = [2, 4, 6]
numbers = odd_numbers + even_numbers
print (numbers)
A [1, 3, 5] +[ 2, 4, 6]
B [1, 3, 5, 2, 4, 6]
C ([1, 3, 5], [2, 4, 6])
D “1, 3, 5, 2, 4, 6”
3. What is the output of the following code?
odd_numbers = [1, 3, 5]
even_numbers = [2, 4, 6]
numbers = odd_numbers , even_numbers
print (numbers)
A [1, 3, 5] +[ 2, 4, 6]
B [1, 3, 5, 2, 4, 6]
C ([1, 3, 5], [2, 4, 6])
D “1, 3, 5, 2, 4, 6”
4. What is the output of the following code?
Z = 40
D = 50
Z, D = D, Z
Print (Z, D)
A 40,50
B 50,40
C (40,50)
D (50, 40)
5. What is the output of the following code?
Z = 40
D = 50
Print (Z, D)
A 40,50
B 50,40
C (40,50)
D (50, 40)
6. What is the output of the following code?
fruits=["apple", "orange", "banana", "chery"]
print(fruits [2])
A apple
B orange
C banana
D chery
7. What is the output of the following code?
fruits=["apple", "orange", "banana", "chery"]
print(fruits [3-])
A apple
B orange
C banana
D chery
8. What is the output of the following code?
colors =["red", "blue", "green"]
[Link]("yellow")
print (colors)
A [red, blue, yellow]
B ['red', 'blue', 'yellow']
C [red, blue, green, yellow]
D ['red', 'blue', 'green', 'yellow']
9. What is the output of the following code?
scores = [0] * 5
print(scores)
A [0, 0, 0, 0, 0]
B [0, 5]
C [5, 5, 5, 5, 5]
D The program executed with error
[Link] is the output of the following code?
actions = ["ping" , "pong"] * 3
print(actions)
A ['ping', 'pong'] , ['ping', 'pong'] , ['ping', 'pong']
B ('ping', 'pong', 'ping', 'pong', 'ping', 'pong)
C ['ping', 'pong', 'ping', 'pong', 'ping', 'pong']
D The program executed with error
[Link] is the output of the following code?
actions = ["ping" , "pong"] * 3
print(len(actions))
A 2
B 3
C 6
D The program executed with error