83- The __init__() function is called automatically when a class is destroyed.
Anonymous Quiz
56%
a) True
44%
b) False
84- The pass statement is used to delete the content of a function.
Anonymous Quiz
22%
a) True
78%
b) False
85- How can you start a block of code for a function or loop?
Anonymous Quiz
63%
a) With a colon :
10%
b) With a semicolon ;
8%
c) With curly braces {}
19%
d) With parentheses ()
86- Which function is used to read input from the user in Python?
Anonymous Quiz
75%
a) input()
5%
b) read()
3%
c) scan()
17%
d) get()
87- How do you access the first element of a list my_list?
Anonymous Quiz
5%
a) my_list[1]
87%
b) my_list[0]
3%
c) my_list.first()
5%
d) my_list.get(0)
88- Which function would you use to convert a string to an integer?
Anonymous Quiz
90%
a) int()
2%
b) str()
5%
c) float()
3%
d) list()
89- How do you define a set in Python?
Anonymous Quiz
20%
a) set = [1, 2, 3]
30%
b) set = (1, 2, 3)
42%
c) set = {1, 2, 3}
8%
d) set = 1, 2, 3
90- Which function is used to get the absolute value of a number?
Anonymous Quiz
67%
a) abs()
7%
b) value()
18%
c) absolute()
8%
d) num()
91- What will print(round(3.14159, 2)) output?
Anonymous Quiz
69%
a) 3.14
15%
b) 3.142
7%
c) 3.1
10%
d) 3
92- Which method is used to convert a string to lowercase?
Anonymous Quiz
77%
a) lower()
13%
b) to_lower()
7%
c) downcase()
3%
d) casefold()
93- Which method returns the number of occurrences of a substring in a string?
Anonymous Quiz
61%
a) count()
16%
b) find()
21%
c) index()
2%
d) search()
94- How do you check if a value is in a list?
Anonymous Quiz
70%
a) value in list
10%
b) list.has(value)
3%
c) list.contains(value)
17%
d) value.exists(list)
95- What does x.remove(2) do in a list?
Anonymous Quiz
50%
a) Removes the element with value 2
29%
b) Removes the element at index 2
2%
c) Removes the second element
20%
d) Removes the element at position 2
96- Which method adds multiple elements to a list?
Anonymous Quiz
36%
a) extend()
30%
b) append()
18%
c) insert()
16%
d) add()
97- What will be the result of print("abc" * 2)?
Anonymous Quiz
67%
a) abcabc
3%
b) aabbcc
9%
c) abc2
21%
d) SyntaxError
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())