WorksheetsPython Module 1
Total questions: 25
Worksheet time: 12mins
What is the output of the following program:
y = 8
z = lambda x : x * y
print z(6)
48
14
64
None of the above
Which of the following is the use of id() function in python?
Id returns the identity of the object
Every object doesn’t have a unique id
All of the mentioned
None of the mentioned
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?
[3, 4, 5, 20, 5, 25, 1, 3]
[1, 3, 3, 4, 5, 5, 20, 25]
[3, 5, 20, 5, 25, 1, 3]
[1, 3, 4, 5, 20, 5, 25]
How can we add two strings together?
s.join(s2)
s.add(s2)
s = s + s2
s ++ s2
print("Hello world!\nHello world!")
Hello world!
print("Hello" + str(2) + "world!")
What does the following code do? myAge = int (myAge)
Converts the var (variable) myAge to a string
Converts the var (variable) myAge to a integer
Converts the var (variable) myAge from a integer to a string
Converts the var (variable) myAge to if statement
people = ["John", "Rob", "Bob"]
print (people[1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[-1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[4])
what would this result be?
Python strings can only contain letters
True
False
A Variable Value in Python can not be updated
True
False
What function determines the data type?
Print()
Type
Type()
print("3*4+5")
print(9/3)
