Search Header Logo

Python_Quiz_1

Authored by Marvin Chua

Computers

Professional Development

Used 2+ times

Python_Quiz_1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the extension of a Python file?

.pyc

.py

.python

.pf

2.

MULTIPLE SELECT QUESTION

20 sec • 1 pt

What is the correct syntax to output "Bye, World" in Python?

echo("Bye, World")

print("Bye, World")

printf("Bye, World")

print('Bye', 'World', sep=', ')

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Is Python compiled or interpreted?

Compiled

Interpreted

Both

Answer explanation

When you first run a Python script, it is converted to bytecode. This process is called compilation.

Python then executes the bytecode. This process is called interpretation.

Thus, Python is a hybrid language.

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following functions can convert a string to a float in Python?

str()

int()

float()

bool()

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the output of the following code?

print(type(10))

<class 'int'>

type(10)

<class 'str'>

"10"

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following is used to define a function in Python?

func

function

def

define

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the output of the following code?

scores = [97, 98, 99, 100]

print(scores[0:3])

[97, 98]

[97, 98, 99]

[97, 98, 99, 100]

scores[0:3]

Answer explanation

When you use index slicing, such as scores[0:3]

you are getting the elements from index 0 to index 2.

In other words, from 0 (inclusive) to 3 (exclusive)

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?