WorksheetsPython Quiz (part 1)
Total questions: 20
Worksheet time: 10mins
Name
Class
Date
1.
Which of the following is a correct variable assignment in Python?
a)
int number = 5
b)
5 = number
c)
number = 5
d)
number == 5
2.
What data type is the following value: 3.14?
a)
int
b)
str
c)
list
d)
float
3.
Which of the following is NOT a valid variable name in Python?
a)
my_var
b)
_variable
c)
2ndVar
d)
var-name
4.
What will be the data type of the variable result after the following operation?
result = 10 / 3
a)
int
b)
str
c)
float
d)
list
5.
How do you define a string variable in Python?
a)
name = 'Alice'
b)
name = Alice
c)
name : 'Alice'
d)
name == 'Alice'
6.
What is the correct way to initialize a list in Python?
a)
list = {}
b)
list = []
c)
list = ''
d)
list = ()
7.
Which function is used to determine the data type of a variable?
a)
datatype()
b)
typeof()
c)
print()
d)
type()
8.
What data type is used to store a sequence of characters?
a)
int
b)
float
c)
str
d)
list
9.
Which function is used to display output in Python?
a)
input()
b)
print()
c)
write()
d)
console.log()
10.
What is the correct way to get user input as a string in Python?
a)
get()
b)
scan()
c)
read()
d)
input()
11.
How do you print a variable value along with text?
a)
print(variable, text)
b)
print('text', variable)
c)
print(f'Text {variable}')
d)
All of the above
12.
How do you print without adding a new line at the end in Python?
a)
print(variable, end='')
b)
print(variable, line_end='')
c)
print(variable, newline='')
d)
print(variable, stop='')
13.
Which operator is used to perform exponentiation in Python?
a)
*
b)
**
c)
/
d)
//
14.
Which operator is used to add two numbers?
a)
+
b)
-
c)
*
d)
/
15.
How do you find the remainder of a division operation in Python?
a)
//
b)
/
c)
**
d)
%
16.
Which of the following operators is used for integer division?
a)
**
b)
/
c)
//
d)
%
17.
How do you increment a variable by 1 in Python?
a)
var = var + 1
b)
var += 1
c)
Both
d)
None
18.
What does the == operator do in Python?
a)
Assignment
b)
Comparison
c)
Addition
d)
Concatenation
19.
How do you concatenate two strings in Python?
a)
+
b)
-
c)
*
d)
/
20.
Which operator is used to check if two variables are not equal?
a)
==
b)
>
c)
<
d)
!=
100 %
