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
ID:111
class Salary:
value = 0
def print_salary(self):
print('Salary:', self.value)
salary = Salary()
salary.value = 1500
salary.print_salary()
ID:111 - What is the output of the following code?
Anonymous Quiz
8%
a) Salary: 0
72%
b) Salary: 1500
0%
c) Salary: None
20%
d) Error
ID:112
class A:
x = 10
obj = A()
obj.x = 20
print(A.x)
👍3
ID:112 - What will the following code output?
Anonymous Quiz
61%
a) 20
30%
b) 10
3%
c) None
6%
d) Error
class A:
x = 10
obj = A()
obj.y = 20
print(obj.y)
class A:
def __init__():
x = 10
obj = A()
obj.y = 20
print(obj.y)
ID:113
i = 1
while True:
if i % 2 == 0:
break
print (i)
i += 2