You are on page 1of 2

14/20

The object of the same class is required to invoke a public method. T

Protected members of a class are accessible from within the class and are also available to its sub-
classes. T

A Class is like an object constructor, or a "blueprint" for creating objects.

All classes have a function called __init__(), which is always executed when the class is being initiated. T

Methods in objects are functions that belong to the object. T

Class definitions cannot be empty. T

Python performs name mangling of private variables. T

Public members of a class are accessible from within the class and are also available to its sub-classes. T

Which of the following is not an exception handling keyword in Python? accept

You can not use the else keyword to define a block of code to be executed if no errors were raised. F (DI
KASAMA DAPAT YUNG "NOT")

Instance attributes and methods defined in the child class will be inherited by the object of the parent
class. F BALIKTAD

Methods of the parent class are available for use in the inherited class. T

Choose to throw an exception if a condition occurs.

20/20

All members in a Python class are public by default. T

A double underscore __ prefixed to a variable makes it privat.It gives a strong suggestion not to touch it
from outside the class. Any attempt to do so will result in an AttributeError. T

Python's convention to make an instance variable protected is to add a prefix __ (double underscore) to
it. F SINGLE UNDER

Instance attributes are defined in the constructor. T

Python prescribes a convention of prefixing the name of the variable/method with single or double
underscore to emulate the behaviour of protected and private access specifiers. T

Use the __init__() function to assign values to object properties, or other operations that are necessary
to do when the object is being created. T

Public members (generally methods declared in a class) are accessible from outside the class.T

The rectangle() method is overridden to implement the formula for the area of the square as the square
of its sides F
Instance attributes and methods defined in the child class will be inherited by the object of the parent
class. F

You can use the else keyword to define a block of code to be executed if no errors were raised. T

To throw (or raise) an exception, use the raise keyword. T

The name of the parent class is put in the parentheses in front of it, indicating the relation between the
two. T

The constructor (the __init__() method) receives four parameters and assigns them to six instance
variables. F FOUR INTANCE LANG

To throw (or raise) an exception, use the delete keyword. F RAISE KEY

Choose to throw an exception if a condition occurs. T

The area() method is overridden to implement the formula for the area of the square as the square of its
sides. T

The constructor (the __init__() method) receives four parameters and assigns them to four instance
variables. T

You might also like