Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

1.

Set is a
 Ordered collection
 Have unique value
 Can’t be modified
 Both (a) and (b)
2. To create an empty set
 {}
 Set ()
 []
 ()
3. Print (‘Good \\ Morning ')
 Good \\ morning
 Good \ Morning
 GoodMorning
 None of the above
4. Eval (“2**8”)
 256
 Error
 16
 None of the above
5. S=”good morning”
S=[-2:2]
 ‘Ninrom doo’
 ''
 Error
 None of the above
6. Read - only list is
 Tuple
 List
 Dictionary
 Set
7. Nums=set ([0,1,2,3,4,5])
Nums.remove(6)
Print (Nums)
 {0,1,2,3,4}
 Key error
 [0,1,2,3,4]
 None of the above
8. A=set ()
A.add([“a”,”b”,”c”,”d”])
 Error
 {“a”,”b”,”c”,”d”}
 [a,b,c,d]
 None of the above
9. S=”queen”
Print (s[ : :0]
 Value error
 ‘queen’
 Ueen
 None of the above
10. Str=”hello”
Val=100
Print (str+val)
 Hello100
 Type error
 Hello 100
 None of the above
11. Which of the following is a correct variable
 -abc
 A3bc
 8abc
 Ab$c
12. 9.0//2.0
 4
 4.0
 Both (a)and (b)
 None of the above
13. _ _python
 Private variable
 Magic variable
 Protected variable
 None of the above
14. A=true
Print (A)
 true
 Error
 1
 None of the above
15. B=1.2+0b111j
Print (b)
 Invalid
 1.3
 1.2
 None of the above
16. A=True
B=False
Print (A*B)
 1
 0
 Value error
 None of the above
17. Which of the following declarations is incorrect
 _x = 2
 __x = 3
 __xyz__ = 5
 None of these
18. Print(0xA + 0xB + 0xC)
What will be the output of this statement?
 33
 63
 0xA + 0xB + 0xC
 None of the above
19. X = ‘pqrs’
For i in range(len(x)):
X[i].upper()
Print (x)
Which of the following is the correct output of this program?
 PQRS
 Pqrs
 Qrs
 None of the above
20. Which of the following Python statements will result in the output: 6?
A = ([[1, 2, 3],[4, 5, 6], [7, 8, 9]])
A) A[2][1]
B) A[1][2]
C) A[3][2]
D) A[2][3]
21. What will be the output of the following Python program?

While I < 5:

Print(i)

I += 1
If I == 3:
Break
Else:
Print(0)
A) error
B) 0 1 2 0
C) 0 1 2
D) none of the mentioned
22. x=45
y=repr(x)+”a”
Print (y)
 Integer can’t be added with string
 45a
 42
 None of the above
23. Which of the following is not true about dictionary
 It is an unorder collection of data
 Key and value both are mutuable
 Each key must have unique value
 Enclosed within {}
24. What will be the output of the following code snippet?
Print(2**3 + (5 + 6)**(1 + 1))
 129
 8
 121
 None of the above
25. What will be the output of the following code snippet?
A = [1, 2, 3]
A = tuple(a)
A[0] = 2
Print(a)
 [2, 2, 3]
 (2, 2, 3)
 (1, 2, 3)
 Error
26. Which of the following concepts is not a part of Python?
 Pointers
 Loops
 Dynamic Typing
 All of the above.
27. What will be the output of the following code snippet?
A=3
B=1
Print(a, b)
a, b = b, a
Print(a, b)
 31 13

 31 31

 13 13
 13 31

28. What will be the output of the following code snippet?


S = {1, 2, 3, 3, 2, 4, 5, 5}
Print(s)
 {1, 2, 3, 3, 2, 4, 5, 5}
 {1, 2, 3, 4, 5}
 None
 {1, 5}
29. What will be the output of the following code snippet?
A = “4, 5”
Nums = a.split(‘,’)
x, y = nums
Int_prod = int(x) * int(y)
Print(int_prod)
 20
 45
 54
 4,5
30. Which of the following are valid escape sequences in Python
 \n
 \t
 \\
 All of the above
31. Why does the name of local variables start with an underscore discouraged?
 To identify the variable
 It confuses the interpreter
 It indicates a private variable of a class
 None of these
32. The output of this Python code would be:
S=’{0}, {1}, and {2}’
s.format(‘hi’, ‘great’, ‘day’)
 ‘hi, great, and day’
 ‘hi great and day’
 ‘hi, great, day’
 Error
33. For tuples and list which is correct?
 List and tuples both are mutable.
 List is mutable whereas tuples are immutable.
 List and tuples both are iimmutable
 List is immutable whereas tuples are mutable.
34. Which among them will produce {‘a’,‘b’, ‘c’}?
 Tuple(‘’abc’’)
 List(‘’abc’’)
 Set(‘’abac’’)
 None of the above.
35. What are the values of the following Python expressions?
2**(3**2)
(2**3)**2
2**3**2
 512, 64, 512
 512, 512, 512
 64, 512, 64
 64, 64, 64
36. What will be the output of the following Python function?Min(max(False,-3,-4), 2,7)
a) -4
b) -3
c) 2
d) False
37. What will be the output of the following Python code snippet?
For I in [1, 2, 3, 4][::-1]:
Print (i)
 4321
 Error
 1234
 none of the mentioned
38. What will be the output of the following Python program?
Z=set(‘abc’)
Z.add(‘san’)
Z.update(set([‘p’, ‘q’]))
 {‘a’, ‘c’, ‘c’, ‘p’, ‘q’, ‘s’, ‘a’, ‘n’}
 {‘abc’, ‘p’, ‘q’, ‘san’}
 {‘a’, ‘b’, ‘c’, ‘p’, ‘q’, ‘san’}
 {‘a’, ‘b’, ‘c’, [‘p’, ‘q’], ‘san}
39. What will be the output of the following Python code?
Print(“abc. DEF”.capitalize())
 Abc. Def
 abc. Def
 Abc. Def
 ABC. DEF
40. What will be the output of the following Python code?
list1 = [1, 3]
list2 = list1
list1[0] = 4
print(list2)
 [1, 4]
 [1, 3, 4]
 [4, 3]
 [1, 3]

You might also like