OOPS in Python

OOPS in Python

12th Grade

10 Qs

quiz-placeholder

Similar activities

9618 15.1 RISC/CISC and Assembly

9618 15.1 RISC/CISC and Assembly

12th Grade

11 Qs

A Level OOP

A Level OOP

12th Grade - University

8 Qs

AP CSP Vocab Quiz BI 1, 2

AP CSP Vocab Quiz BI 1, 2

9th - 12th Grade

11 Qs

QUIZ-I-OBJECT ORIENTED PROGRAMMING WITH C++

QUIZ-I-OBJECT ORIENTED PROGRAMMING WITH C++

10th Grade - University

10 Qs

Java Inheritance

Java Inheritance

11th Grade - University

10 Qs

NOCTI Computer Programming

NOCTI Computer Programming

12th Grade

13 Qs

Robotics quiz 2

Robotics quiz 2

1st - 12th Grade

12 Qs

Lesson #3 - Inheritance

Lesson #3 - Inheritance

12th Grade

8 Qs

OOPS in Python

OOPS in Python

Assessment

Quiz

Computers

12th Grade

Medium

Created by

Harmeet Kaur

Used 2+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

1. Which of the following best describes encapsulation?
Hiding implementation details and exposing only necessary parts through a public interface
Dividing a program into multiple functions
Using loops to repeat code
Writing code in multiple files for modularity

Answer explanation

Encapsulation hides internal state and provides controlled access via methods.

2.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

Media Image

2. What will be printed by the following code?

5
10
None
Error

Answer explanation

B calls A.__init__ (value=5) then adds 5, so display prints 10.

3.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

3. In OOP, 'is-a' relationship is implemented through:
Aggregation
Composition
Inheritance
Encapsulation

Answer explanation

Inheritance models the 'is-a' relationship between classes.

4.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

Media Image

4. What is the output?

5 1
5 0
Error
1 5

Answer explanation

Default parameter n=1; x1 has 5, x2 has 1; __str__ returns those.

5.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

5. Which is TRUE about method overriding?
Child method same name, different number of parameters
Child method must have same name and parameters as parent
Overridden methods must return None
Overriding works only for static methods

Answer explanation

Overriding requires same signature to redefine parent behavior.

6.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

Media Image

6. What will the following code output?

Base
Derived
Error
None

Answer explanation

Derived.__init__ replaces Base.__init__; data is set to 'Derived'.

7.

MULTIPLE CHOICE QUESTION

1 min • 2 pts

7. Which of these is NOT an advantage of OOP?
Code reuse through inheritance
Better organization through encapsulation
Reduced execution time for all programs
Polymorphism enabling flexibility

Answer explanation

OOP improves design and reuse; it does not guarantee faster runtime.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?