wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Chatbot - MCQs

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is the purpose of the import random statement in the code?

a)

To sort a list randomly

b)

To generate random numbers

c)

To allow the program to choose a random joke

d)

To make the chatbot smarter

2.

What does the chatbot do first when it starts?

a)

Tells a joke

b)

Asks for your favorite color

c)

Asks for your name

d)

Greets the user with "Hello"

3.

Which Python function is used to get input from the user?

a)

input()

b)

get()

c)

print()

d)

read()

4.

How does the chatbot exit the conversation?

a)

When you press Esc

b)

When you type "exit"

c)

When you say "stop"

d)

When you type "bye"

5.

What happens if the user types "how are you"?

a)

The chatbot ignores it

b)

It crashes

c)

It responds with "I am fine."

d)

It ends the chat

6.

Which keyword is used to run code repeatedly?

a)

if

b)

elif

c)

repeat

d)

while

7.

What will the chatbot do if it sees the word "joke"?

a)

Tell a random joke

b)

Ask a riddle

c)

Say "No jokes today"

d)

End the program

8.

Which of the following is not a condition checked in the code?

a)

"how are you"

b)

"your name"

c)

"weather"

d)

"favorite color"

9.

What does .lower() do in this program?

a)

Converts the output to lowercase

b)

Makes the chatbot speak softly

c)

Converts the input to lowercase

d)

Makes the program faster

10.

What is stored in the variable jokes?

a)

A string

b)

A list of jokes

c)

A random number

d)

A user question

11.

How does the chatbot choose which joke to tell?

a)

It picks the first one

b)

It asks the user to choose

c)

It uses random.choice()

d)

It rotates in order

12.

What will the chatbot print if it doesn't understand the question?

a)

"I don't understand."

b)

"Try again later."

c)

"Hmm, I don't have an answer for that. Try asking something else!"

d)

It stays silent

13.

What type of loop is used in this chatbot?

a)

For loop

b)

Do-while loop

c)

While True loop

d)

Repeat until loop

14.

What is the main purpose of this chatbot program?

a)

To perform calculations

b)

To teach math

c)

To have a simple conversation and tell jokes

d)

To predict the weather

15.

What does the break keyword do in this chatbot?

a)

Pauses the program

b)

Ends the chat loop

c)

Clears the screen

d)

Skips to the next joke