Python L6

Python L6

6th - 8th Grade

10 Qs

quiz-placeholder

Similar activities

Technology Basics

Technology Basics

6th - 8th Grade

10 Qs

Introduction to spreadsheet

Introduction to spreadsheet

6th Grade

10 Qs

Ethical Issues of I.T.

Ethical Issues of I.T.

7th - 8th Grade

11 Qs

JAVA IDENTIFIERS

JAVA IDENTIFIERS

6th - 8th Grade

14 Qs

U26 Q7 - CIDR

U26 Q7 - CIDR

KG - University

12 Qs

Quiz #2 ETEC 486 | Spr. 16

Quiz #2 ETEC 486 | Spr. 16

KG - University

10 Qs

The computer system

The computer system

7th - 8th Grade

10 Qs

App questions

App questions

2nd - 6th Grade

11 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?