Search Header Logo

Python Quiz

Authored by REENA. S

Computers

5th Grade

Used 7+ times

Python Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the importance of the init method in a class?

 It initializes all the classes in code

It imports all the modules required for the program

It initializes the attributes of a class when an object is created

None of the above

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the code ? 

Mylist = [1,2,3,5,3,4,6,9]

Mylist[-6:6]

[]

 [3, 5, 3, 4]

 [4, 3, 5, 3]

Index Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the method that is bound to class but not the instance?

Static method

Class method

Main Method

None of the above

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a generator in Python?

The function that generates random numbers of specified count

 The function that generates an error when a warning occurs

 The function that gives a statement as output rather than a retur

The function that returns a generic object

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is used to print the doc string of a function?

myFun.doc()

 doc(myFun)

doc(myFun)

myFun.__doc__

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. What is the output of the below code?

            a1,b1,c1=1,2,3,4,5

               print(b1)

2

4

1,2,3,4,5

ValueError

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

  1. What is the output of the below code?

List=list(range(-5,5,2))

len(List)

2

5

10

7

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?