Font size
WorksheetsDay3 - Python STT
Total questions: 10
Worksheet time: 5mins
Which is the correct operator for power(xy)?
X^y
X**y
X^^y
None of the mentioned
Which one of these is floor division?
/
//
%
None of the mentioned
Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value using the expression d[“susan”]?
Since “susan” is not a value in the set, Python raises a KeyError exception
It is executed fine and no exception is raised, and it returns None
Since “susan” is not a key in the set, Python raises a KeyError exception
Since “susan” is not a key in the set, Python raises a syntax error
Which of the following statements create a dictionary?
d = {}
d = {“john”:40, “peter”:45}
d = {40:”john”, 45:”peter”}
All of the mentioned
The output of the code above is
Key Error
4
Math
Assume the key is the student's id and the value is the grade. Which of the following code will get the grade of student id 102?
grades[102]
grades.get(102)
grades[2]
grades[3]
grades.key(102)
What is the output of the code above
3.9
4
Syntax error
x = 5
print(x > 3 and x < 10)
True
False
x = 5
print(not(x > 3 and x < 10))
True
False
What is the answer of this expression, 22 % 3 is?
7
1
0
5
