NEW
Font size
WorksheetsDATATYPES - INPUT/OUTPUT - OPERATORS
Total questions: 24
Worksheet time: 12mins
Which data type can store numbers, letters and symbols?
String
Float
Integer
Boolean
What will the output be from the following code?
print(Hello world!)
Hello World!
Syntax Error
Hello World
print(Hello World!)
What is the answer to print (16//5)?
1
3
21
165
What is the purpose of comment lines in code?
To compliment your work so you feel better about it.
To explain the code that follows it.
To make the code compile.
To make your code longer so you get more points.
Identify python membership operators.
in, not in
is , is not
in, in not
not is, is
Identify valid identifiers (variable or variables)
a@123
_n
1a
n 9
Which is the correct operator for power(x,y)?
X^y
X**y
X^^y
pow(x,y)
Which of the following is not a keyword?
eval
assert
for
elif
All keywords in Python are in _________
lower case
UPPER CASE
Capitalized
None of the mentioned
What data type is the object below?
L = [1, 23, 'hello', 1]
list
dictionary
array
tuple
Select the option that print the following
hello-how-are-you
print(‘hello’, ‘how’, ‘are’, ‘you’)
print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
print(‘hello-‘ + ‘how-are-you’)
print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
What does 3 ^ 4 evaluate to?
81
12
0.75
7
Which one of the following datatype is not supported in python
string
number
slice
list
If a='cpp', b='buzz' then what is the output of:
c = a-b
print(c)
cpp-buzz
cppbuzz
TypeError: unsupported operand
None of the above
Which of the following symbols are used for single line comments in Python?
//
"
/* */
#
Which of the following operators is used to get accurate result (i.e fraction part also) in case of division ?
//
%
/
None of the Above
What is the correct file extension for Python files?
.pyt
.py
.pt
.pyth
Which operator can be used to compare two values?
==
=
><
<>
==
=
<>
><
A location in memory used to store data that can be changed.
Constant
Variable
Value
Iteration
In python the ' INTEGER data type' can be defined as...?
holds alphanumeric data as text
holds numbers with a decimal point
holds whole numbers
holds either ‘true’ or ‘false’
In python the ' STRING data type' can be defined as...?
holds alphanumeric text
hold whole numbers
holds numbers with a decimal point
holds either a true or false value
In python the ' FLOAT data type' can be defined as...?
holds alphanumerical data
holds whole numbers
holds a decimal point in a number
hold either true or false
Which of the following codes is correct?
("Good Morning. Who are you? " )= name
print("Hi there " + name+ " , nice to meet you")
name = input ("Good Morning. Who are you?" )
print ("Hi there " + name+ " , nice to meet you")
name = input ("Good Morning. Who are you?" )
print ("Hi there " name " , nice to meet you")
("Good Morning. Who are you? " )= name
print ("Hi there " name" , nice to meet you")
Which of the following converts the variable"mynumber" to an integer?
str(mynumber)
float(mynumber)
num(mynumber)
int(mynumber)
