Search Header Logo

Programming Basics Quiz

Authored by Mr Massett

Fun

Professional Development

Programming Basics Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to take a string input from the user and store it in a variable called name?

name = input("Enter your name: ")

input(name = "Enter your name: ")

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

input("name")

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will this code output? name = "Alice" print(name)

Alice

name

print(name)

Error

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a correct way to assign a value to a variable?

age = 11

11 = age

color = "blue"

city = "London"

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following code do? print("Hello, world!")

Prints Hello, world!

Stores "Hello, world!" in a variable

Prints Hello, world! without the exclamation mark

Causes an error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to print a user's name stored in the variable user_name?

print(user_name)

print("user_name")

print["user_name"]

echo user_name

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will this code output? greeting = "Hi" print(greeting + " there!")

Hi there!

greeting there!

Hi

there!

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is stored in the variable word after this code runs? word = input("Enter a word: ")

The text "Enter a word: "

Whatever the user types

Nothing, it’s empty

A number

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?