Worksheetsaabbcc
Total questions: 49
Worksheet time: 25mins
Name
Class
Date
1.
1. Who developed Python?
a)
Guido van Rossum
b)
Dennis Ritchie
c)
James Gosling
d)
Bjarne Stroustrup
2.
2. Python was first released in which year?
a)
1989
b)
1991
c)
1995
d)
2000
3.
3. What is the correct file extension for Python files?
a)
.py
b)
.pt
c)
.pyt
d)
.pyc
4.
4. Which of the following is used to display output in Python?
a)
echo()
b)
printf()
c)
print()
d)
output()
5.
5. Which symbol is used for single-line comments in Python?
a)
//
b)
#
c)
--
6.
6. What is the keyword to define a function in Python?
a)
func
b)
def
c)
function
d)
lambda
7.
7. Which keyword is used to create a class in Python?
a)
object
b)
class
c)
cls
d)
defclass
8.
8. Which operator is used for exponentiation in Python?
a)
^
b)
**
c)
//
d)
%
9.
9. Which operator is used for floor division?
a)
/
b)
%
c)
//
d)
**
10.
10. Which data type is mutable?
a)
String
b)
List
c)
Tuple
d)
Frozenset
11.
11. Which data type is immutable?
a)
List
b)
Dictionary
c)
Set
d)
Tuple
12.
12. Which function converts a string to an integer?
a)
str()
b)
int()
c)
float()
d)
eval()
13.
13. Which function is used to get the length of a list?
a)
count()
b)
len()
c)
length()
d)
size()
14.
14. What does the type() function return?
a)
The value of a variable
b)
The data type of a variable
c)
The memory size
d)
The length
15.
15. Which keyword is used to write a loop in Python?
a)
loop
b)
repeat
c)
for
d)
foreach
16.
16. What is the keyword used to exit a loop prematurely?
a)
stop
b)
quit
c)
break
d)
exit
17.
17. Which keyword is used to skip an iteration in a loop?
a)
pass
b)
skip
c)
continue
d)
next
18.
18. Which function is used to read input from the user?
a)
input()
b)
read()
c)
scan()
d)
get()
19.
19. What is the default data type of user input in Python 3?
a)
int
b)
float
c)
str
d)
bool
20.
20. Which method is used to add an item to a list?
a)
push()
b)
insert()
c)
append()
d)
add()
21.
21. Which method removes the last item from a list?
a)
pop()
b)
remove()
c)
delete()
d)
discard()
22.
22. Which method removes a specific item from a list?
a)
pop()
b)
remove()
c)
delete()
d)
discard()
23.
23. Which data structure stores key-value pairs?
a)
List
b)
Tuple
c)
Dictionary
d)
Set
24.
24. Which keyword is used to define a block with no implementation?
a)
skip
b)
pass
c)
continue
d)
null
25.
25. What will be the output of print(2 ** 3)?
a)
6
b)
8
c)
9
d)
12
26.
26. What is the result of print(10 // 3)?
a)
3.33
b)
4
c)
3
d)
2
27.
27. What is the result of print(10 % 3)?
a)
1
b)
2
c)
3
28.
28. Which built-in function returns the absolute value?
a)
abs()
b)
fabs()
c)
absolute()
d)
modulus()
29.
29. Which module in Python is used for mathematical operations?
a)
math
b)
statistics
c)
numbers
d)
calc
30.
30. What is the output of print(type(3.0))?
a)
int
b)
float
c)
str
d)
bool
31.
31. Which function is used to convert a number to a string?
a)
str()
b)
int()
c)
chr()
d)
repr()
32.
32. Which keyword is used to handle exceptions?
a)
try
b)
error
c)
catch
d)
throw
33.
33. Which keyword is used to raise an exception?
a)
throw
b)
error
c)
raise
d)
except
34.
34. What is the output of print(10 > 9)?
a)
true
b)
10
c)
9
35.
35. What is the output of print("a" in "apple")?
a)
true
b)
None
c)
Error
36.
36. Which method returns the number of items in a dictionary?
a)
size()
b)
items()
c)
len()
d)
count()
37.
37. Which method returns only the keys of a dictionary?
a)
keys()
b)
values()
c)
items()
d)
get()
38.
38. Which method returns only the values of a dictionary?
a)
keys()
b)
values()
c)
items()
d)
get()
39.
39. Which keyword is used to define an anonymous function?
a)
func
b)
def
c)
lambda
d)
function
40.
40. Which function returns the maximum value from a list?
a)
max()
b)
largest()
c)
maximum()
d)
big()
41.
41. Which function returns the minimum value from a list?
a)
min()
b)
smallest()
c)
minimum()
d)
low()
42.
42. Which function sorts a list in ascending order?
a)
sort()
b)
sorted()
c)
arrange()
d)
order()
43.
43. What is the keyword used to import a module?
a)
include
b)
import
c)
use
d)
require
44.
44. Which module is used for random number generation?
a)
math
b)
random
c)
randint
d)
numbers
45.
45. Which method is used to split a string into a list?
a)
divide()
b)
split()
c)
slice()
d)
cut()
46.
46. Which method joins elements of a list into a string?
a)
join()
b)
glue()
c)
merge()
d)
combine()
47.
47. Which symbol is used for logical AND in Python?
a)
&&
b)
and
c)
&
d)
&&&
48.
49. Which symbol is used for logical NOT in Python?
a)
not
b)
!
c)
~
d)
negate
49.
50. What is the keyword used to define a variable inside a function?
a)
def
b)
local
c)
var
d)
None
100 %
