NEW
Font size
WorksheetsPython Variable and Datatype Quiz
Total questions: 11
Worksheet time: 8mins
Which of the following is a valid Python variable name?
2variable
variable_2
@variable
var-iable
What will be the output of the following code?
int
float
complex
none
Which of these data types is immutable?
List
Set
Dictionary
Tuple
A single-element tuple requires a trailing comma, like (5,)
tuple = (5)
tuple = 5
tuple = (5,)
tuple = [5]
Which of the following statements creates an empty set in Python?
set1 = {}
set1 = set()
set1 = []
set1 = emptyset{}
What will be the output of the following code?
3
4
5
6
What will the following code output?
Pyt
Pyth
Py
Python
Which of these Python collections is unordered?
List
Tuple
Set
String
What will be the output of the following code?
{1, 2, 3, 4}
{3, 1, 2, 3, 4}
{1, 2, 3, 3, 4}
An error will occur
Which of the following data types can hold duplicate values?
Set
Tuple
Dictionary
None of the above
Which operator would you use to check if a value is in a String/List/Set?
in
==
contains
is
