TST
TST
TST
a) @ b) % c) ) d) #
2. Which operator is used to check whether two variables are same or not?
a) – b) == c) ! d) =
a) mywork c) myWORK
b) MY Work d) My Work.
4. Given the numeric variable Num1, which lines of code properly prints the value?
a) Print(“%d”) c) Print(Num1)
b) Print(“%d”,Num1) d) Print(“%d Num1”)
5. Suppose s is assigned as follows: s=’foobar’.All of the following expressions produce the same result except
one. Which one?
a) boolean c) int
b) string d) float
a) 0 b) 1 c) False d) True
a) 85.0,125.0 c) 85.0,85.0
b) (85.0,125.0) d) (125.0,85.0)
a) keywords c) operators
b) Expressions. d) Literals.
e) // f) ? g) < h) and
a) print(list1[0]) c) print(list1[:-2])
b) print(list1[:2]) d) all of the mentioned
21. Suppose
a) Error list1 is [2, 33, 222, 14,c)
25],
25What is list1 [-1]?
b) None d) 2
22. What will be the output of the following Python code?
>>>my_tuple = (1, 2, 3, 4)
>>>my_tuple.append( (5, 6, 7) )
>>>print len(my_tuple)
a) 1 c) 5
b) 2 d) Error
23. What will be the output of the following Python code?
>>>t1 = (1, 2, 4, 3)
>>>t2 = (1, 2, 3, 4)
>>>t1 < t2
a) True c) Error
b) False d) None
24. What will be the output of the following Python code?
>>>t = (1, 2, 4, 3, 8, 9)
>>>[t[i] for i in range(0, len(t), 2)]
a) [2, 3, 9] c) [1, 4, 8]
b) [1, 2, 4, 3, 8, 9] d) (1, 4, 8)
25. What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
"john" in d
a) True c) None
b) False d) Error
26. What will be the output of the following Python code snippet?
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}
d1 == d2
a) True c) None
b) False d) Error
27. Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use?
a) d.size() c) size(d)
b) len(d) d) d.len()
30. What is the order of precedence in python?