OOPS in Python

OOPS in Python

12th Grade

10 Qs

quiz-placeholder

Similar activities

Quiz Konsep Pemodelan Berorientasi objek

Quiz Konsep Pemodelan Berorientasi objek

12th Grade - University

10 Qs

Unit 23 - Pop Quiz

Unit 23 - Pop Quiz

12th Grade

10 Qs

PYTHON PROGRAMMING

PYTHON PROGRAMMING

11th - 12th Grade

15 Qs

Unit Terms 2.3 -2.10

Unit Terms 2.3 -2.10

12th Grade

10 Qs

Intro to Software

Intro to Software

12th Grade

15 Qs

Object Oriented Programming

Object Oriented Programming

11th - 12th Grade

8 Qs

IT English Essentials: Unit 13 - Quiz 1

IT English Essentials: Unit 13 - Quiz 1

12th Grade

10 Qs

Introduction to Java

Introduction to Java

8th - 12th Grade

10 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?