98- What is the output of print(3 == 3.0)?
Anonymous Quiz
49%
a) False
41%
b) True
5%
c) SyntaxError
5%
d) None
👍1👎1
99- Which operator is used for string concatenation in Python?
Anonymous Quiz
60%
a) +
18%
b) &
10%
c) -
12%
d) |
100- A class in Python can inherit from multiple classes at once.
Anonymous Quiz
80%
a) True
20%
b) False
ID:101
class Animal:
def sound(self):
return "Animal makes sound"
class Dog(Animal):
def sound(self):
return "Dog barks"
dog = Dog()
print(dog.sound())
ID:101 - What does the following Python code output?
Anonymous Quiz
14%
A) Animal makes sound
75%
B) Dog barks
6%
C) sound method is not defined in Dog
5%
D) None of the above
ID:102
class A:
def method(self):
return 'A method'
class B(A):
def method(self):
return 'B method'
obj = A()
print(obj.method())
ID:102 - What will the following Python code output?
Anonymous Quiz
55%
A) A method
29%
B) B method
13%
C) method is not defined
3%
D) None of the above
ID:103
class X:
def __init__(self, name):
self.name = name
def __eq__(self, other):
return self.name == other.name
x1 = X("Alice")
x2 = X("Alice")
print(x1 == x2)
ID:103 - What is the output of the following code?
Anonymous Quiz
77%
A) True
9%
B) False
11%
C) Error: __eq__ method is not valid
3%
D) None of the above
ID:104
x = 10
def func():
global x
x = 20
func()
print(x)
ID:104 - What will be the output of the following?
Anonymous Quiz
16%
A) 10
80%
B) 20
2%
C) Error
3%
D) None of the above
ID:105
class A:
def display(self):
print("Class A")
class B(A):
def display(self):
print("Class B")
class C(B):
pass
obj = C()
obj.display()
ID:105 - What will be the output of the following Python code?
Anonymous Quiz
12%
A) Class A
68%
B) Class B
17%
C) Error: display is not defined in class C
3%
D) None of the above
ID:106
x = [1, 2, 3]
x.append(4)
print(x)
ID:106 - What is the output of the following code?
Anonymous Quiz
88%
a) [1, 2, 3, 4]
6%
b) [1, 2, 3]
5%
c) [4, 1, 2, 3]
2%
d) [1, 2, 3, [4]]
ID:108
x = [1, 2, [3, 4]]
print(len(x[2]))
ID:110
class CountryInfo:
def print_language(self):
print('English')
class Lebanon(CountryInfo):
def print_language(self):
print('Arabic')
lb = Lebanon()
lb.print_language()
ID:110 - What will the following code print?
Anonymous Quiz
11%
a) English
82%
b) Arabic
2%
c) Error
5%
d) Nothing