WorksheetsGroup-B Python Quiz
Total questions: 7
Worksheet time: 35secs
Name
Class
Date
1.
Which of the following is not a valid data type in Python?
a)
int
b)
float
c)
char
d)
str
2.
What does the len() function in Python return?
a)
The length of a string
b)
The number of elements in a list or tuple
c)
The number of keys in a dictionary
d)
All of the mentioned
3.
What does the append() method do when used with lists in Python?
a)
Adds an element to the end of the list
b)
Removes the last element of the list
c)
Sorts the elements of the list
d)
Reverses the order of elements in the list
4.
Which of the following is the correct way to import the math module in Python?
a)
import math
b)
include math
c)
use math
d)
require math
5.
What does the pop() method do when used with lists in Python?
a)
Removes the first element of the list
b)
Removes the last element of the list
c)
Removes the element at the specified index
d)
Adds an element to the end of the list
6.
Which of the following function convert a string to a float in python?
a)
long(x [,base] )
b)
float(x)
c)
str(x)
7.
What data type is the object below ? L = [1, 23, ‘hello’, 1]
a)
List
b)
Dictionary
c)
Tuple
d)
Array
100 %
