wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Types- Python

Total questions: 25

Worksheet time: 15mins

Name
Class
Date
1.

The process by which a computer carries out the instructions of a stored program is...

a)

Execution

b)

Running

c)

Compiling

d)

Interpreting

2.

A type of error that occurs when a rule of the programming language code is broken is...

a)

Logic error

b)

Syntax error

c)

Run-time error

3.

Which of these are primitive data types in Python?

a)

string

b)

integer

c)

char

d)

float

4.

Which data type would be used in Python to store the value of pi to 2 decimal places?

a)

Integer

b)

float

c)

string

5.

A named location used to store data in computer memory is a ...

a)

Parameter

b)

Function

c)

Variable

6.

Variables are storing data values.

a)

True

b)

False

7.

A variable is created the moment you first assign a value to it.

a)

False

b)

True

8.

Choose three properties of a variable

a)

Has a name

b)

Holds a value

c)

Has a data type

d)

Has a length

9.

Choose all the rules that are correct for naming variables

a)

Must not begin with a number

b)

Can only contain (A-Z, a-z) and 0-9 characters, and _

c)

Can use _ to join words separated words

d)

Must be in lower case

10.

In what way is a constant different from a variable?

a)

It can store more than one value

b)

It does not change its value during program execution

c)

Its name should be written in UPPER CASE so it can be easily identified as a constant

11.

The process of giving a value to a variable is ...

a)

Allocation

b)

Assignment

12.

.... are examples of valid variable names.

a)

1st_name

b)

Last_name

c)

first Name

d)

f1_name

e)

firstName

13.

Which symbol is used for entering comments in Python ?

a)

/

b)

#

c)

??

d)

" "

14.

What will be the output of this python code:


name="Kate"

print ("My name is", name)

a)

My name isKate

b)

My name is Kate

c)

My name is name

15.

What will be the output of this python code:


name="Kate"

print ("My name is", "name")

a)

My name isKate

b)

My name is Kate

c)

My name is name

16.

What will be the output of this python code:


name="John"

print ("My name is"+"name")

a)

My name is John

b)

My name isname

c)

My name is Kate

17.

What will be the output of this python code?


name="John

print ("My name is", name)

a)

my name is John

b)

my name isJohn

c)

Error

18.

What will be the output of this python code?


number1="3"

number2="50"

print (number1 + number2)

a)

53

b)

350

c)

Error

19.

What will be the output of this python code?


number1= 5

number2=100

print (number1 + number2)

a)

1005

b)

105

c)

error

20.

What will be the output of this python code?


number1= 8

number2="10"

print (number1 + number2)

a)

error

b)

108

c)

18

21.

What will be the output of this python code?


number1= 55

number2="200"

print (number1, number2)

a)

55 200

b)

20055

c)

55200

d)

255

22.

What will be the output of the following python code?


number1= 3

number2="100"

print (number1 * number2)

a)

error

b)

100100100

c)

300

23.

In Python, the variable type that stores a sequence of characters is...

a)

string

b)

integer

c)

float

24.

In Python, the variable type that stores a whole number is...

a)

float

b)

integer

c)

string

25.

In Python, the variable type that stores a decimal number is...

a)

integer

b)

string

c)

float