Font size
WorksheetsData Types- Python
Total questions: 25
Worksheet time: 15mins
The process by which a computer carries out the instructions of a stored program is...
Execution
Running
Compiling
Interpreting
A type of error that occurs when a rule of the programming language code is broken is...
Logic error
Syntax error
Run-time error
Which of these are primitive data types in Python?
string
integer
char
float
Which data type would be used in Python to store the value of pi to 2 decimal places?
Integer
float
string
A named location used to store data in computer memory is a ...
Parameter
Function
Variable
Variables are storing data values.
True
False
A variable is created the moment you first assign a value to it.
False
True
Choose three properties of a variable
Has a name
Holds a value
Has a data type
Has a length
Choose all the rules that are correct for naming variables
Must not begin with a number
Can only contain (A-Z, a-z) and 0-9 characters, and _
Can use _ to join words separated words
Must be in lower case
In what way is a constant different from a variable?
It can store more than one value
It does not change its value during program execution
Its name should be written in UPPER CASE so it can be easily identified as a constant
The process of giving a value to a variable is ...
Allocation
Assignment
.... are examples of valid variable names.
1st_name
Last_name
first Name
f1_name
firstName
Which symbol is used for entering comments in Python ?
/
#
??
" "
What will be the output of this python code:
name="Kate"
print ("My name is", name)
My name isKate
My name is Kate
My name is name
What will be the output of this python code:
name="Kate"
print ("My name is", "name")
My name isKate
My name is Kate
My name is name
What will be the output of this python code:
name="John"
print ("My name is"+"name")
My name is John
My name isname
My name is Kate
What will be the output of this python code?
name="John
print ("My name is", name)
my name is John
my name isJohn
Error
What will be the output of this python code?
number1="3"
number2="50"
print (number1 + number2)
53
350
Error
What will be the output of this python code?
number1= 5
number2=100
print (number1 + number2)
1005
105
error
What will be the output of this python code?
number1= 8
number2="10"
print (number1 + number2)
error
108
18
What will be the output of this python code?
number1= 55
number2="200"
print (number1, number2)
55 200
20055
55200
255
What will be the output of the following python code?
number1= 3
number2="100"
print (number1 * number2)
error
100100100
300
In Python, the variable type that stores a sequence of characters is...
string
integer
float
In Python, the variable type that stores a whole number is...
float
integer
string
In Python, the variable type that stores a decimal number is...
integer
string
float
