wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PE2 Module 3

Total questions: 11

Worksheet time: 4mins

Name
Class
Date
1.
An object is an instance of a:
a)
parameter
b)
method
c)
class
d)
application
2.
How many objects can be made from a class? 
a)
None, you make classes from objects
b)
one
c)
As many as you want
d)
All of the above
3.

Go through the below code and predict the output:

num1=100

num2=0

try:

result=num1/num2

print(result)

except ZeroDivisionError:

print("Zero Division Error Occurred")

a)

100

b)

0

c)

Zero Division Error Occurred

4.
What is the difference between a class and an object?
a)
A class is a blueprint to make an object
b)
An object is a blueprint to make a class
c)
A blueprint is an object to make a class
d)
Blueprint class is an object make a
5.
These have identitystate, and behavior.
a)
class
b)
object
c)
method
d)
void
6.
Which of the following concepts of OOPS means exposing only necessary information to client?
a)
Encapsulation
b)
Abstraction
c)
Data hiding
d)
Data binding
7.

What will be the output of the code given below?


def division(a,b):

try:

return int(a)/b

except TypeError:

print("Type error")

except ValueError:

print("Value error")

finally:

print("Finally")

print("Done")

division('A',10)

a)

Value error

Finally

Done

b)

Type error

Finally

Done

c)

Type error

Finally

d)

Value error

Finally

8.
As a blueprint is a design for a house, a class is a design for a(n):
a)
object
b)
variable
c)
constant
d)
statement
9.

What is the output of the following python code?

balance=1000

amount="300Rs"


def take_card():

print("Take the card out of ATM")

try:

if balance>=int(amount):

print("Withdraw")

else:

print("Invalid amount")

except TypeError:

print("Type Error Occurred")

except ValueError:

print("Value Error Occurred")

except:

print("Some error Occurred")

finally:

take_card()

a)

Value Error Occurred

Take the card out of ATM

b)

Type Error Occurred

Take the card out of ATM

c)

Some Error occured

d)

Invalid amount

10.
The process by which objects of one class acquire the properties of objects of another class is known as
a)
Polymorphism
b)
Inheritance
c)
Data Hiding
d)
None of the above.
11.
The wrapping up of data and functions into a single unit is called
a)
overloading
b)
class
c)
object
d)
encapsulation