Python L6

Python L6

6th - 8th Grade

10 Qs

quiz-placeholder

Similar activities

CSS 3

CSS 3

7th Grade

14 Qs

JRDL - Adv HTML & CSS

JRDL - Adv HTML & CSS

6th Grade - Professional Development

12 Qs

PowerPoint Techniques

PowerPoint Techniques

6th - 8th Grade

14 Qs

CSS Text Notes

CSS Text Notes

7th Grade

15 Qs

Objected Oriented Programming

Objected Oriented Programming

7th Grade

10 Qs

Advanced Python Lesson 3

Advanced Python Lesson 3

4th - 12th Grade

9 Qs

HTML Table Tag and Attributes

HTML Table Tag and Attributes

8th Grade

14 Qs

FMT web developing session 4 HTML5 + CSS3

FMT web developing session 4 HTML5 + CSS3

KG - Professional Development

15 Qs

Python L6

Python L6

Assessment

Quiz

Computers

6th - 8th Grade

Medium

Created by

Alaa Ahmad

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the __init__ method in a class?

To initialize object attributes.

To print object details.

To compare objects.

To delete objects.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to inherit a class in Python?

extends

inherits

super

No keyword; the class name is specified in parentheses.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class Dog:

def __init__ (self, name):

self.name = name

d = Dog("Buddy")
What does self.name = name do?

Creates a global variable

Assigns the argument name to the instance attribute self.name

Deletes the name variable

Raises an error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class Cat:

def sound(self):

return "Meow"

c = Cat()

print(c.sound())

Meow

sound()

None

Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class Book:

def init(self, title):

self.title = title

b = Book()

What happens when this code runs?

Creates a book with title = None

Raises TypeError (missing title argument)

Automatically sets title = "Untitled"

Skips init

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class Car:

def start():

return "Engine on"

c = Car()

print(c.start())
What happens?

Raises TypeError (missing 1 positional argument: self)

Engine on

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a class attribute?

An attribute unique to each instance

An attribute shared by all instances of a class

A private attribute that cannot be accessed

A temporary variable in a method

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?