Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python - 01

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

What does the following code print?


greeting = "Hello"

print(greeting)

(a)  

2.

What does the following code print?


greeting = "Hello"

print("greeting")

(a)  

3.

Which one is a correct way of creating a string variable?

a)

name = John

b)

name = "John"

c)

name = ("John")

d)

name = print("John")

4.

Which one is a correct way of creating an integer variable?

a)

number = "3.14"

b)

number = 3.14

c)

number = 314

d)

number = ("314")

5.

Which one is not a variable type in Python?

a)

Int

b)

Float

c)

Number

d)

Str

e)

Boolen

6.

What happens when you run this code?


first = "John"

print(first, "\n", last)

a)

It prints first and last name

b)

It only prints first name

c)

It only prints the first name then It gives an error message

d)

It doesn't print anything. It gives an error message

7.

Which Python function helps collecting data from users?

(a)  

8.

Which one of the code is a correct way of collecting users' name?

a)

print("What is your name?")

b)

name = print("What is your name?")

c)

input(name)

d)

input("What is your name?")

e)

name=input("What is your name?")

9.

Which one is a parameter in the following code?


name = input("what is your name?")

a)

input

b)

name

c)

=

d)

"what is your name"

e)

There is no parameter in this code

10.

Which one is a parameter in this code?


name = input("name?")

Print("The data you entered is" , "\n", name )

a)

"\n"

b)

name

c)

"The data your entered is"

d)

All of them