Search Header Logo

Python Programming Quiz

Authored by TĂ¢m Dương

English

University

Used 2+ times

Python Programming Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

78 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In Python, a function within a class definition is called a?

an operation

a method

a callable

a class function

a factory

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

For the following code, which of the following statements is true? def PrintHello(): print("Hello") x = PrintHello()

Both PrintHello() and x refer to the same object

PrintHello() and x refer to different objects

Syntax error! You cannot assign function to a variable in Python

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Find the output of the given Python program. a = 10 if a <= 15: print("Hi") else: print("Know Program!")

Hi

Hello

Hi Hello

Hi Know Program

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following reserved keyword is used to end a function, return generator?

break

switch

Return

yield

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the following statement list([x for x in range(3, 6)])

[3, 4, 5]

3, def

[100, 101, 102]

It causes an exception

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which data structure is being put to use in the code given below? # Code starts org = 'QuizOrbit' count = {} for i in org: if i in count: count[i]+=1 else: count[i]=1 print(count) # Code Ends

String

List

Tuple

Dictionary

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these collections defines a LIST?

{"name": "apple", "color": "green"}

["apple", "banana", "cherry"]

{"apple", "banana", "cherry"}

("apple", "banana", "cherry")

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?