set2
set2
3. Find Output:
s1='%s : %s & %s'
s1%('Delhi','Gurgaon','Noida')
4. Find Output:
print('there are %d %ss' %(3,'boy'))
5. Find Output:
bin(10-2) + bin(12^4)
a) '0b10000b1000'
b) 0b10000b1000
c) Error
d) None
a) error
b) {1,2,3,4}
c) set()
d) None
8. Find Output:
t1 = (3,'abc',[1,2,3])
t2 = t1 * 2
print(t2)
a) 3,'abc',[1,2,3]
b) 3,'abc',[1,2,3], 3,'abc',[1,2,3]
c) (3, 'abc', [1, 2, 3], 3, 'abc', [1, 2, 3])
d) None
9. Find Output:
x = [1,2,'A',(3,4),[5],{6,7},{'y':8}]
print(len(x))
a) 6
b) 7
c) 8
d) None
a) 10
b) 20
c) 40
d) None
a) False False
b) False True
c) True False
d) True True
a) 'BennettUniversityBennettUniversity'
b) 'BennettUniversityBennett'
c) BennettUniversityBennett
d) None
a) 'Bennett University'
b) 'Bennett university'
c) 'BENNETT UNIVERSITY'
d) None
mylist = [1, 2, 3, 4]
addItem(mylist)
print(len(mylist))
a) [1, 2, 3, 4, 1]
5
b) [1, 2, 3, 4]
4
c) [2, 3, 4, 5]
4
d) None
a) False
b) True
c) error
d) None
a) AB CD ['ab', 'cd']
b) Ab Cd ['ab', 'cd']
c) ab cd ['ab', 'cd']
d) None
a) 5 6 7 8 9 10
b) 5 6 7 8
c) 5 6
d) error
a) 1
b) 1 3 5 7 …
c) 1 2 3 4 …
d) none of the mentioned
a) No output
b) a
c) i
d) None
a) i i i i i i
b) a a a a a a
c) a a a a a
d) none of the mentioned
Answer Key
1 – d, [Explanation: ValueError : could not convert string to float : When a numeric string
contains a + or other delimiters/special- characters, it can’t be converted to float]
2–a
3 – b [Explanation: 'Delhi : Gurgaon & Noida']
4–d
5 – a [1st part : bin(10-2) => 8 => 1000 i.e., 0b1000 And 2nd part : bin(12^4) => (1100 xor 01
00) => 1000 i.e., 0b1000 Therefore, ‘0b1000’ + ‘0b1000’ => ‘0b10000b1000’]
6–b
7- a [Explanation: TypeError: unsupported operand type(s) for +: 'set' and 'set']
8–c
9–b
10 – c
11 – c
12 – b
13- b
14 – b
15 – a
16 – c
17 - a
18 – b
19 – a [Hints : in y the output of upper() will be stored but not in x]
20 - b [Hints : 0O11 is equivalent to 3]
21 – d [ Explanation: the loop will not be activated]
22 – c [Explanation: True can’t be used as identifier]
23 – a
24 – b [Explanation: in every pass of the loop the string length is decreasing]