BCA SemModelMCQs PP 2024
BCA SemModelMCQs PP 2024
12. What will be the output of the following Python code snippet? [True/False] Ans: False
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45}r=d1 == d2
print(r)
13. What does the following Python code snippet do? string =
"Hello, World!" print(string.upper())
def test(self):
print( name )
Ans: Answer: b
Explanation: Since the above code is being run not as a result of an import from another module, the
variable will have value “ main ”.
Ans:
1
2
4
22. What will be the output of the following Python code? Ans: [‘ab’, ‘cd’]
x = ['ab', 'cd'] for i in x:
i.upper() print(x)
b) if(1,2): print("Hello")
c) if(1,2):
print("Hello") d) if(1,2):
print("Hello")
Ans: d) if(1,2):
print("Hello")
24. The clause can occur with an if as well as with loops. Ans: else
29. if a=[1,2,3] Ans: Yes, both will generate same list i.e. [1,2,3,1,2,3,1,2,3]
Is a*3 is equivalent to a+a+a?
30.Suppose t = (1, 2, 4, 3), What will t contains after t[3] = 45? Ans:
It will generate error as Tuple is immutable.
31.In the dictionary key and pair which part holds the unique elements only? Ans: Key
1. Key
2. Pair
32.What will be the output of the following Python code? Ans: “Hello World” is displayed
class test:
def init (self,a=""Hello World""):
self.a=a
def display(self):
print(self.a) obj=test()
obj.display()
33.Which of the following statements is most accurate for the declaration x = Circle()?
A. x contains an int value.
B. x contains an object of the Circle type.
C. x contains a reference to a Circle object.
D. You can assign an int value to x.
39.What will be the correct output of the following Python code? Ans: a) 1 2 3 4 5 6
i=1
while True:
if i%0O7 == 0:
break print(i) i += 1
a) 1 2 3 4 5 6
b) 1 2 3 4 5 6 7
c) error
d) none of the mentioned
x=5
def modify():global x
x = 10
modify()print(x)
Ans: 10
Explanation: The function modifymodifies the global variable x, changing its value to 10.
45.Choose the correct function to get the character from ASCII number
46. Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]? Ans: [2, 33, 222, 14]
47.What will be the output of the following Python code? Ans: c) [1, 4, 8]
1. >>>t = (1, 2, 4, 3, 8, 9)
2. >>>[t[i] for i in range(0, len(t), 2)]
a) [2, 3, 9]
b) [1, 2, 4, 3, 8, 9]
c) [1, 4, 8]
d) (1, 4, 8)
49.Which of the following can be used to invoke the init method in B from A, where A is a
subclass of B?
A. super(). init () Ans: A. super(). init ()
B. super(). init (self)