Question 1 of 25
Hints left: 3
Q1
What is a class in the context of object-oriented programming?
Q2
What is the purpose of using abstraction in object-oriented programming?
Q3
Which principle of OOP promotes the reusability of code and allows a class to inherit properties and methods from another class?
Q4
What does built-in function help do in context of classes?
Q5
What is a class variable in object-oriented programming?
Q6
What does built-in function type do in context of classes?
Q7
What is an object in the context of object-oriented programming?
Q8
What is the use of duck typing?
Q9
Which of the following best describes inheritance?
Q10
What is the purpose of the constructor (__init__ method) in a class in Python?
Q11
Which of the following statements isn't true?
Q12
What is the benefit of using inheritance in object-oriented programming?
Q13
What is the purpose of abstraction in object-oriented programming?
Q14
What does encapsulation refer to in object-oriented programming?
Q15
Which of the following statements is wrong about inheritance?
Q16
What will be the output of the following Python code? class Demo: def __init__(self): self.x = 1 def change(self): self.x = 10 class Demo_derived(Demo): def change(self): self.x=self.x+1 return self.x def main(): obj = Demo_derived() print(obj.change()) main()
Q17
What does single-level inheritance mean?
Q18
What will be the output of the following Python code? class A: def __str__(self): return '1' class B(A): def __init__(self): super().__init__() class C(B): def __init__(self): super().__init__() def main(): obj1 = B() obj2 = A() obj3 = C() print(obj1, obj2,obj3) main()
Q19
Which of the following best describes polymorphism?
Q20
What is the difference between a class and an object in object-oriented programming?
Q21
Which principle of OOP emphasizes the bundling of data and methods that operate on the data into a single unit?
Q22
Which of the following is not a type of inheritance?
Q23
What is the biggest reason for the use of polymorphism?
Q24
What is polymorphism in object-oriented programming?
Q25
What will be the output of the following Python code? >>> class A: pass >>> class B(A): pass >>> obj=B() >>> isinstance(obj,A)