python Class Questions & Answers

Question 16: What will be the output of the following code?

import collections

c=collections.Counter([1,2,2,3,3,4,4,4,4,5])
print(c.most_common(1))

Question 1: Is the following class valid?

class Employee:
    empid=0
    name=""
    def __init__(id,name):
	    empid=id    
        name=name

Question 2: A class may contain

Question 3: What is TRUE about the class attributes?

Question 4: What is 'self' in Python?

ADVERTISEMENT

Question 4: What is the name of the constructor method in the Python class?

Question 5: Which of the following statement is correct?