NEW
Font size
WorksheetsExploring Python Basics Quiz
Total questions: 20
Worksheet time: 10mins
What is the data type of the value `42` in Python?
String
Integer
Float
Boolean
Which of the following is a valid Python list?
`[1, 2, 3]`
`(1, 2, 3)`
`{1, 2, 3}`
`1, 2, 3`
What will be the output of the following code? ```python if 5 > 3: print("Hello") ```
Nothing
Error
Hello
5 > 3
Which of the following is a mutable data type in Python?
Tuple
String
List
Integer
What is the index of the first element in a Python list?
0
1
-1
2
What will be the output of the following code? ```python my_list = [10, 20, 30, 40] print(my_list[2]) ```
10
20
30
40
Which of the following is not a Python data type?
Integer
Float
Character
Boolean
What is the result of the expression `3.0 + 4` in Python?
7
7.0
3.4
Error
What will be the output of the following code? ```python if 2 == 2: print("Yes") else: print("No") ```
Yes
No
Error
2 == 2
Which of the following is a correct way to declare a list in Python?
`list = [1, 2, 3]`
`list = (1, 2, 3)`
`list = {1, 2, 3}`
`list = 1, 2, 3`
What will be the output of the following code? ```python my_list = [1, 2, 3, 4] my_list.append(5) print(my_list) ```
`[1, 2, 3, 4]`
`[1, 2, 3, 4, 5]`
`[5, 1, 2, 3, 4]`
`[1, 2, 3, 5, 4]`
Which of the following is a correct if statement in Python?
`if x = 5:`
`if x == 5:`
`if (x == 5)`
`if x := 5`
Which of the following is a valid way to access the last element of a list `my_list`?
`my_list[-1]`
`my_list[0]`
`my_list[1]`
`my_list[len(my_list)]`
What will be the output of the following code? ```python if 10 < 5: print("Smaller") else: print("Greater") ```
Smaller
Greater
Error
10 < 5
What is the data type of the value `True` in Python?
String
Integer
Float
Boolean
What is the data type of the value "True" in Python?
int
str
bool
float
Which of the following is a data type in Python?
integer
number
digit
numeral
What is the data type of the following variable? ```python x = 3.14 ```
`int`
`str`
`float`
`bool`
What is a variable in Python?
A type of Python snake
A reserved word that cannot be used for anything other than its pre-defined purpose
A name that is used to denote something or a value is called a variable
A tool used to control the flow of a program
age = '5'
In the code above, age is a
string
integer
floating point
