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 7 of 13

Explore more Topics under Python

Q61.
What is the output of the following code?
def foo():
    try:
        print(1)
    finally:
        print(2)
foo()
Discuss
Answer: (a).1 2
Q62.
What is the output of the following?
try:
    if '1' != 1:
        raise "someError"
    else:
        print("someError has not occurred")
except "someError":
    print ("someError has occurred")
Discuss
Answer: (c).invalid code
Q63.
What happens when โ€˜1โ€™ == 1 is executed?
Discuss
Answer: (b).we get a False
Q64.
The code shown below will result in an error if the input value is entered as -5. State whether this statement is true or false.
assert False, 'Spanish'
Discuss
Answer: (a).True
Q65.
What happens if the file is not found in the code shown below?
a=False
while not a:
    try:
        f_n = input("Enter file name")
        i_f = open(f_n, 'r')
    except:
        print("Input file not found")
Discuss
Answer: (a).No error
Q66.
What is the output of the code shown below?
lst = [1, 2, 3]
lst[3]
Discuss
Answer: (c).IndexError
Q67.
What is the output of the code shown below?
t[5]
Discuss
Answer: (b).NameError
Q68.
What is the output of the following code, if the time module has already been imported?
4 + '3'
Discuss
Answer: (d).TypeError
Q69.
The output of the code shown below is:
int('65.43')
Discuss
Answer: (b).ValueError
Q70.
Compare the two codes shown below and state the output if the input entered in each case is -6?
CODE 1
import math
num=int(input("Enter a number of whose factorial you want to find"))
print(math.factorial(num))
 
CODE 2
num=int(input("Enter a number of whose factorial you want to find"))
print(math.factorial(num))
Discuss
Answer: (a).ValueError, NameError

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!