Search Header Logo

python - ML1

Authored by Niranjani V

Computers

Professional Development

Used 1+ times

python - ML1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the "input()" function in Python?

To print output on the console

To receive user input from the console

To convert strings to integers

To define new variables

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to prompt the user for input and store it in a variable called "name"?

a) input("Enter your name: ")

b) input("name")

c) name = input(0)

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

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the "print()" function do in Python?

a) It receives user input from the console.

b) It converts strings to integers.

c) It displays output on the console.

d) It defines new variables.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is used to assign a value to a variable in Python?

a) store

b) var

c) val

d) =

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code snippet?

message = "Hello, World!"

print(message[7:])

a) "World!"

b) "Hello"

c) "Hello, "

d) "World"

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the type of the variable "num" after executing the following code?

num = input("Enter a number: ")

a) integer

b) string

c) float

d) boolean

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code snippet?

x = 10

y = "5"

print(x + int(y))

a) 15

b) "105"

c) "15"

d) Error

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?