Search Header Logo

Python Input Basics Quiz

Authored by Ben Saddington

Fun

8th Grade

Used 2+ times

Python Input Basics Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What function is used in Python to take input from the user?

`print()`

`input()`

`read()`

`scan()`

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct way to prompt the user for their name in Python?

`name = input("Enter your name: ")`

`name = input("Enter your name")`

`name = input()`

`name = input("Enter your name: ", "Name")`

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What data type does the `input()` function return by default?

Integer

Float

String

Boolean

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you convert a user input to an integer in Python?

`int(input())`

`str(input())`

`float(input())`

`bool(input())`

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if you try to convert a non-numeric input to an integer using `int(input())`?

It will return 0

It will return an empty string

It will raise a `ValueError`

It will return `None`

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a method to handle errors in Python?

`try-except`

`if-else`

`for-while`

`switch-case`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the `except` block in Python?

To execute code when no errors occur

To execute code when an error occurs

To define a function

To import a module

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?