Quiz on Class in Python
Q.1. In Python, a class is ___________ for a concrete object.
Q.2. How to create a constructor in python?
Q.3. If a properties of two classes are derived into one then it is called
Q.4. Which keyword is used to declare a class?
Q.5. What will be the output of the following code snippet?
class Employee:
def __init__(self, id):
self.id = id
e = Employee(123)
print(e.id)
Q.6. what is numpy in below line
import numpy as np
Q.7. What method is used to invoke a parent constructor from child class?
Q.8.If properties of class is derived into two or more classes then is it called
Q.9. What is setattr() used for?
Q.10. What is dist in below line?
from math import dist
Q.11. What will the list contain in following program?
class Test:
def __init__(self,n):
pass
l=[]
for i in range(5):
l.append(Test(i))
print(l)
Q.12. What will be the output of the following code snippet:
class Test:
def __init__(self,n):
self.n = n
def area(self):
print(self.n*self.n)
t = Test(5)
t.area()
Q.13. How can we check whether an object is an instance of a class?
Q.14. If a class C inherits from two other classes A and B (in order - A, B) and a super method is used
to invoke constructor of parent then the constructor invoked is of
Q.15. The functions defined inside the class are called
Instructions:-
- This Quiz is based on Dictionary in Python
- Each correct answer will carry 2 points
- Once an option is selected you cannot select any other, So choose wisely
- Do not refresh the page as it will reset the quiz
- Once the time is up the quiz will automatically get submitted with no of Question responded
- Your total score alongwith your name will be shown after submission of the Quiz
- Wish you ALL THE BEST 👍👍
START
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP