-
Notifications
You must be signed in to change notification settings - Fork 0
/
quiz 2.txt
61 lines (61 loc) · 1.34 KB
/
quiz 2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{1:'a',2:'b',3:'b',4:'c',5:'a',6:'b',7:'c',8:'b',9:'d',10:'c',11:'b',12:'b'}
1. Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample) ?
a) 5
b) 4
c) None
d) Error
2. 1. Which of the following is a Python tuple?
a [1, 2, 3]
b (1, 2, 3)
c {1, 2, 3}
d {}
3. Which is the correct operator for power(x,y) ?
a X^y
b X**y
c X^^y
d None of the mentioned
4. What will be the output of 'abcd'[2:] ?
a a
b ab
c cd
d dc
5. Suppose s is assigned as follows: s='Phagwara', All the following expressions produce the same result except one. Which one?
a s[::-5]
b s[::-1][::-5]
c s[::-1][-1]+s[len(s)-1]
d s[0]+s[-1]
6. Select the correct statement : print(math.ceil(random.random()))
a Output is 0
b Output is -1
c Output is 1
d only math library needs to be imported.
7. Which of the following is an invalid statement?
a a, b, c = 1000, 2000, 3000
b a = b = c = 1,000,000
c a b c = 1000 2000 3000
d abc = 1,000,000
8. Which of the following function flushes the files implicitly ?
a flush()
b close()
c open()
d fflush()
9. Suppose list1 is [3, 5, 25, 1, 3], what is min(list1) ?
a 3
b 5
c 25
d 1
10. Which arithmetic operators cannot be used with strings ?
a +
b *
c –
d All of the mentioned
11. Which one of these is floor division ?
a /
b //
c %
d None of the mentioned
12. What is the answer to this expression, 22 % 3 is?
a 7
b 1
c 0
d 5