OOPS in Python

OOPS in Python

12th Grade

10 Qs

quiz-placeholder

Similar activities

C quiz

C quiz

11th Grade - University

10 Qs

Introduction AppSheet

Introduction AppSheet

12th Grade

10 Qs

ITGS - IT Systems (Hardware)

ITGS - IT Systems (Hardware)

10th - 12th Grade

14 Qs

ICT and Retail Industry

ICT and Retail Industry

8th - 12th Grade

13 Qs

Preguntas sobre Excel 2016

Preguntas sobre Excel 2016

6th Grade - University

15 Qs

Problem Solving : Design Solution

Problem Solving : Design Solution

12th Grade

15 Qs

Latihan Ujian TKJ - Bagian A1

Latihan Ujian TKJ - Bagian A1

7th Grade - University

10 Qs

Python with DataScience

Python with DataScience

7th Grade - University

10 Qs

OOPS in Python

OOPS in Python

Assessment

Quiz

Computers

12th Grade

Practice Problem

Medium

Created by

Harmeet Kaur

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?