Python L6

Python L6

6th - 8th Grade

10 Qs

quiz-placeholder

Similar activities

Python with DataScience

Python with DataScience

7th Grade - University

10 Qs

Javascript mine

Javascript mine

7th Grade

15 Qs

Artificial Intelligence Quiz

Artificial Intelligence Quiz

6th Grade

12 Qs

Working with Text : Summary

Working with Text : Summary

6th Grade

10 Qs

Ms Excel - Grade 8

Ms Excel - Grade 8

8th Grade

10 Qs

Coding Quiz

Coding Quiz

6th - 10th Grade

15 Qs

C Variables and Constants

C Variables and Constants

7th Grade

10 Qs

Excel

Excel

7th Grade

15 Qs

Python L6

Python L6

Assessment

Quiz

Computers

6th - 8th Grade

Practice Problem

Medium

Created by

Alaa Ahmad

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

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

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?