Font size
WorksheetsJ277 Programming - Data Types
Total questions: 11
Worksheet time: 10mins
How do we get user input from the keyboard?
input = (What is your name?)
input = What is your name?
output = ("What is your name?")
input("What is your name? ")
Which data type is the most suited to store a telephone number in a variable?
string
integer
float
boolean
Which data type would you use for the quantity of stock in a shop?
integer
float
string
boolean
What does the print command do?
Outputs a hard copy of a program to a printer
Outputs a message on screen
Print a hard copy of a flow chart to a printer
Prints out the the commands line by line on the screen
On which line do you see an error?
1
2
3
4
5
This program does not work due to a data type error on line 3. What should line 3 look like?
total = str(num1) * str(num2)
total = int(num1) * int(num2)
total = char(num1) * char(num2)
What syntax would allow a programmer to cast a variable as a decimal number (also known as a real number)?
dec()
int()
float()
real()
How many variables are used in this program?
1
2
3
4
What data type would be used for a persons bank card number? Explain why you chose your answer?
