Module 5 Worksheet 1
[Link] 1. Which typecode is used to represent signed integer of 1 Byte?
a) b
b) i
c) B
d) I
Answer:
[Link] 2. Tuple Objects are mutable?
a) True
b) False
Answer:
[Link] 3. What is the result of y=x*3 where x=[2,3]?
a) [2,3,3]
b) [6,9]
c) [2,3,2,3,2,3]
d) [2,3][2,3][2,3]
Answer:
[Link] 4. Square brackets in an assignment statement will create which type of data structure?
( s=[] )
a) List
b) queue
c) set
d) dictionary
Answer:
[Link] 5. To insert an the string "strawberries" in the first position of a list we use
a) [Link]("strawberries, 1")
b) [Link]("strawberries",0)
c) [Link](1, "strawberries")
d) [Link](0, "strawberries")
Answer:
[Link] 6. Select the all correct way to remove the key marks from a dictionary
a) [Link]("marks")
b) [Link]("marks")
c) del student["marks"]
d) [Link]("marks")
Answer:
[Link] 7. In Python, Dictionaries are immutable
a) True
b) False
Answer:
[Link] 8. Items are accessed by their position in a dictionary and All the keys in a dictionary must
be of the same type.
a) True
b) False
Answer:
[Link] 9. The "pass" statement in Python is used for?
a) Terminating a loop
b) Skipping the current iteration of a loop
c) Creating an empty function or class
d) Exiting the program
Answer:
[Link] 10. What is the purpose of the base conversion algorithm?
a) Sorting
b) Changing the data type of a variable
c) Converting a number from one numeral system to another
d) Calculating the power of a number
Answer:
Fill in the blanks
Q. No1. Dictionaries use _________ and keys are separated with _________
Answer:
[Link].2. Comparing a dictionary to Python to a dictionary for words, ____________ is each word we look
up_______ is definition of the word
Answer:
[Link].3. ______________ can be strings, integers and lists
Answer:
[Link].4. The keyword used for conditional statements with multiple branches in Python is _______.
Answer:
[Link].5. The _______ algorithm is used for reversing a list in Python.
Answer:
Match the following
PART A PART B ANSWER
(1) Factorial Computation (A) Changing the numeral system of a number
(2) Iteration (B) Early termination of a loop
(3) Base Conversion (C) Computing the product of consecutive integers
(4) if-elif-else (D) Conditional statements with multiple branches
(5) Reverse (E) Inverting the order of elements in a sequence
Answer