wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

J277 Programming - Data Types

Total questions: 11

Worksheet time: 10mins

Name
Class
Date
1.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
2.

How do we get user input from the keyboard?

a)

input = (What is your name?)

b)

input = What is your name?

c)

output = ("What is your name?")

d)

input("What is your name? ")

3.

Which data type is the most suited to store a telephone number in a variable?

a)

string

b)

integer

c)

float

d)

boolean

4.

Which data type would you use for the quantity of stock in a shop?

a)

integer

b)

float

c)

string

d)

boolean

5.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
6.

What does the print command do?

a)

Outputs a hard copy of a program to a printer

b)

Outputs a message on screen

c)

Print a hard copy of a flow chart to a printer

d)

Prints out the the commands line by line on the screen

7.

On which line do you see an error?

a)

1

b)

2

c)

3

d)

4

e)

5

8.

This program does not work due to a data type error on line 3. What should line 3 look like?

a)

total = str(num1) * str(num2)

b)

total = int(num1) * int(num2)

c)

total = char(num1) * char(num2)

9.

What syntax would allow a programmer to cast a variable as a decimal number (also known as a real number)?

a)

dec()

b)

int()

c)

float()

d)

real()

10.

How many variables are used in this program?

a)

1

b)

2

c)

3

d)

4

11.

What data type would be used for a persons bank card number? Explain why you chose your answer?

4 lines