Search Header Logo

PYTHON TEST-5

Authored by gv krishna

Computers

University

Used 1+ times

PYTHON TEST-5
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

18 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

1.Expected output of the following code:

class book_shop:

def init(self, title):

self.title = title

def book(self):

print('The title of the book is', self.title)

b = book_shop('cse')

b.book()

error

The tile of the book is cse

none of the anove

The tile of the book is csc

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

2.Expected output of the following code:

a_dict = {'a': 1, 'b': 2}

a_dict['c'] = 3

print(a_dict)

{'a': 1, 'b': 2, 'c': 3}

error

none of the above

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

3.Expected output of the following code:

a_tuple = (1, 2, 3)

a_tuple[0] = 4

print(a_tuple)

error

(1,2,3,4)

none of the above

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

4.Expected output of the following code:

try:

print(x)

except:

print("An exception occurred")

An exception occurred

error

none of the above

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

5.Expected output of the following code:

try:

print(x)

except NameError:

print("Variable x is not defined")

except:

print("Something else went wrong")

Variable x is not defined

Variable is not defined

error

none of the above

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

6.Expected output of the following code:

try:

print("Hello")

except:

print("Something went wrong")

else:

print("Nothing went wrong")

Hello

Nothing went wrong

error

none of the above

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

7.Expected output of the following code:

tay:

print(x)

except:

print("Something went wrong")

finally:

print("The 'try except' is finished")

Something went wrong

The 'try except' is finished

error

none of the above

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?