wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

AI for Youth – Machine and Minds

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

print("Hello" + " World")

a)

Hello World

b)

HelloWorld

c)

Hello+World

d)

Error

2.

What is the correct way to take input from a user in Python?

a)

input = "Enter your name"

b)

name = input("Enter your name: ")

c)

name = input["Enter your name"]

d)

input(name) = "Enter your name"

3.

What will be the output of the code?

a)

Yes

b)

No

c)

Error

d)

None

4.

Which of the following is immutable (cannot be changed) in Python?

a)

List

b)

Tuple

c)

Dictionary

d)

Set

5.

How do you access the value of key 'age' in the dictionary?

a)

student[age]

b)

student.get("age")

c)

student("age")

d)

student.get(age)

6.

What will be the output of the following list operation?

a)

[1, 2, 3]

b)

[1, 2, 3, 4]

c)

[1, 2, 3, 4, None]

d)

[1, 2, 3, (4)]

7.

What is the correct way to check if a key exists in a dictionary?

a)

'key' in dict

b)

dict.has_key('key')

c)

dict.exist('key')

d)

dict.find('key')

8.

What does len([1, 2, 3, 4]) return?

a)

3

b)

4

c)

[1, 2, 3, 4]

d)

Error

9.

How do you create an empty list in Python?

a)

{}

b)

set()

c)

[]

d)

()

10.

What will be the output of the following code?

a)

(1, 5, 3)

b)

(1, 2, 3, 5)

c)

Error

d)

[1, 5, 3]