adplus-dvertising

Welcome to the Classes,Objects and OOPS concepts MCQs Page

Dive deep into the fascinating world of Classes,Objects and OOPS concepts with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Classes,Objects and OOPS concepts, a crucial aspect of Python. In this section, you will encounter a diverse range of MCQs that cover various aspects of Classes,Objects and OOPS concepts, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Python.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Classes,Objects and OOPS concepts. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Python.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Classes,Objects and OOPS concepts. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Classes,Objects and OOPS concepts MCQs | Page 8 of 13

Explore more Topics under Python

Q71.
What is the output of the code shown below?
def getMonth(m):
    if m<1 or m>12:
        raise ValueError("Invalid")
    print(m)
getMonth(6)
Discuss
Answer: (c).6
Q72.
What is the output of the code shown below if the input entered is 6?
valid = False
while not valid:
    try:
        n=int(input("Enter a number"))
        while n%2==0:
            print("Bye")
        valid = True
    except ValueError:
        print("Invalid")
Discuss
Answer: (d).Bye (printed infinite number of times)
Q73.
Identify the type of error in the codes shown below.
Print(β€œGood Morning”)
print(β€œGood night)
Discuss
Answer: (b).Semantic, Syntax
Q74.
Which of the following is not a standard exception in Python?
Discuss
Answer: (c).AssignmentError
Q75.
Syntax errors are also known as parsing errors. Is this statement true or false?
Discuss
Answer: (a).True
Discuss
Answer: (a).The standard exceptions are automatically imported into Python programs
Discuss
Answer: (c).The __eq(other) method is defined in the object class
Q78.
What is the output of the following code?
class test:
    def __init__(self):
        self.variable = 'Old'
        self.Change(self.variable)
    def Change(self, var):
        var = 'New'
obj=test()
print(obj.variable)
Discuss
Answer: (c).β€˜Old’ is printed
Discuss
Answer: (d).Creating an instance of class
Q80.
What is the output of the following code?
class fruits:
    def __init__(self, price):
        self.price = price
obj=fruits(50)
 
obj.quantity=10
obj.bags=2
 
print(obj.quantity+len(obj.__dict__))
Discuss
Answer: (c).13

Suggested Topics

Are you eager to expand your knowledge beyond Python? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!