Python Advanced

Python Advanced

University

100 Qs

quiz-placeholder

Similar activities

A+ CORE 2 FINAL REVIEW QUIZ

A+ CORE 2 FINAL REVIEW QUIZ

University

100 Qs

Quizz1

Quizz1

University

95 Qs

QUIZZ JAM TAMBAHAN 2 - TEORI KEJURUAN TKJ

QUIZZ JAM TAMBAHAN 2 - TEORI KEJURUAN TKJ

KG - Professional Development

100 Qs

UJIAN AKHIR SEMESTER PEMROGRAMAN DASAR

UJIAN AKHIR SEMESTER PEMROGRAMAN DASAR

University

100 Qs

STS 101 - MIDTERM EXAM

STS 101 - MIDTERM EXAM

University

100 Qs

SEO Quiz

SEO Quiz

University

100 Qs

First Model Test MCQ  - HCI

First Model Test MCQ - HCI

University

100 Qs

COMPUTER TECHNOLOGY

COMPUTER TECHNOLOGY

University

100 Qs

Python Advanced

Python Advanced

Assessment

Quiz

Computers

University

Hard

Created by

Mayank Saxena

Used 2+ times

FREE Resource

100 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword starts a class definition in Python?
def
class
struct
module

Answer explanation

Classes are defined using the 'class' keyword.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is automatically invoked when a new instance is created?
__new__
__call__
__init__
__start__

Answer explanation

__init__ is the constructor called after an instance is created.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does the 'self' parameter in instance methods refer to?
Current class
Instance object
Parent class
Global namespace

Answer explanation

'self' refers to the instance on which the method is called.

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of these is an example of encapsulation?
Using global variables
Hiding attributes using name-mangling
Multiple inheritance
Using map/filter

Answer explanation

Encapsulation hides implementation details; name mangling (prefix __) limits external access.

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

How do you indicate a 'private' attribute by convention in Python?
prefix with __
suffix with _priv
prefix with _
use private keyword

Answer explanation

By convention a single underscore prefix (e.g., _attr) indicates 'protected' or internal use.

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What is name mangling in Python?
Encrypting names
Compiler optimization
Interpreter renaming __attr to _ClassName__attr
Renaming modules

Answer explanation

Name mangling rewrites __attr as _ClassName__attr to reduce accidental access.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which decorator defines a class method that receives the class instead of instance?
@staticmethod
@classmethod
@property
@abstractmethod

Answer explanation

@classmethod receives the class (cls) as the first argument.

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?