Chapter 9 review

Chapter 9 review

9th - 12th Grade

•

25 Qs

quiz-placeholder

Similar activities

Chapter 10: Object Oriented Programming

Chapter 10: Object Oriented Programming

Creating and using classes in Python

Creating and using classes in Python

Python classes and objects test

Python classes and objects test

Python Classess OOP

Python Classess OOP

Object-Oriented Programming (OOP) in Python 3 Quiz

Object-Oriented Programming (OOP) in Python 3 Quiz

Python OOP Terminology

Python OOP Terminology

Python Class Quiz

Python Class Quiz

Python Classes Quiz

Python Classes Quiz

Chapter 9 review

Chapter 9 review

Assessment

Quiz

•

Science

•

9th - 12th Grade

•

Practice Problem

•

Medium

Created by

Adrian Ortiga

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...

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is my dog in the given code snippet?

my_dog = Dog('blacky', 2)

A method that initializes the dog object.

A variable representing the name of the dog.

An instance of the Dog class.

An attribute storing the dog's age.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access classes when importing an entire module?

Use the syntax module_name.class_name

Use the syntax class_name.module_name

You cannot import and entire module.

Use the syntax module_name -> class_name

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a method in Python?

A built-in Python keyword used to define classes.

A data type that stores a collection of values.

A function that's part of a class.

A statement used to control the flow of execution in a program.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you only use one underscore before and after the method init()?

The method won't be called automatically when you use your class.

Nothing, everything will work OK.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when you create multiple instances of a class in Python with the same arguments?

Only the last instance created will retain the attribute values.

Each instance will have its own unique memory address and separate attribute values.

The program will throw an error indicating duplicate instances.

Each instance will have the same memory address but separate attribute values.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What attributes are included in the Dog class?

class Dog:

def init(self, name, age):

self.name = name

self.age = age

def sit(self):

print(f'{self.name} is now sitting.')

def roll_over(self):

print(f'{self.name} rolled over!')

name and age

only name

only age

the class dog has no attributes

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access the attributes of an instance in Python?

By using the getattr() function (getattr(instance, 'attribute'))

By using square bracket notation (instance['attribute'])

By calling a method with the attribute name as an argument (instance.get_attribute('attribute'))

By using dot notation (instance.attribute)

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

Already have an account?