Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Intro

Total questions: 15

Worksheet time: 3mins

Name
Class
Date
1.
print("12"*3)
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
2.
What will the output be from the following code?
Print("Hello world!")
a)
NameError
b)
Hello world!
c)
"Hello world"
d)
Print(Hello world!)
3.
What will the output be from the following code?
print(9/3)
a)
3
b)
3.0
c)
9/3
d)
SyntaxError
4.

10//3

a)

3

b)

3.3

c)

0.3

d)

3.0

5.

We start the definition of the function with?

a)

func

b)

def

c)

int

d)

non of the above

6.

In the first line, a and b are called ____

a)

parameters

b)

arguments

c)

values

d)

both parameters and arguments

7.

The output from the previous code is ____

a)

true!

b)

false!

c)

printing( false! ) forever

d)

none of the above

8.

What is the output of program below?


motorcycles = ['honda', 'yamaha', 'suzuki']

motorcycles.sort()

print(motorcycles)

a)

['honda', 'yamaha', 'suzuki']

b)

['yamaha', 'suzuki', 'honda']

c)

['honda', 'suzuki', 'yamaha']

d)

['suzuki', 'yamaha', 'honda']

9.

What is the index of “grape” in the list

[“apple”, “grape”, “orange”, “watermelon”]?

a)

0

b)

1

c)

2

d)

3

10.

Is this the correct code for a list?

register = {"Sam", "Pheobe", Georgia", Richard"}

a)

Yes

b)

No

11.

What is the process of converting one datatype to another called?

a)

Data conversion.

b)

Type Casting.

c)

Type Conversion.

d)

Concatenation.

12.

What function converts the data in a variable into a 'float'?

a)

int()

b)

flt()

c)

bool()

d)

float()

13.

__________ is the built-in function to know the type of a variable or function.

a)

id()

b)

type()

c)

data_type()

d)

none of the above

14.

Identify the first statement that creates a class named Employee.

a)

class Employee():

b)

Class Employee:

c)

class employee:

d)

class Employee:

15.

What does __init__ do?

a)

Constructs the instance

b)

Initialize the instance values

c)

Calls the Super class

d)

Creates a circle