MCQ
Coding and Data Visualization
By Dr. Hana RABBOUCH
2023_2024
Question 1
2
Question 2
3
Question 3
4
Question 4
5
Question 5
6
Question 6
7
Question 7
8
Question 8
9
Question 9
10
Question 10
11
Question 11
12
Question 12
13
Question 13
14
Question 14
15
Question 15
16
Question 16
17
Question 17
18
Question 18
19
Question 19
20
Question 20
21
Question 21
22
Question 22
23
Question 23
24
Question 24
25
Question 25
26
Question 26
27
Question 27
28
Question 28
29
Question 29
30
Question 30
31
Question 31
32
Question 32
33
Question 33
34
Question 34
35
Question 35
36
Question 36
37
Question 37
38
Question 38
39
Question 39
40
Question 40
41
Question 41
42
Question 42
43
Question 43
44
Question 44
45
Question 45
46
Question 46
47
Question 47
48
Question 48
49
Question 49
50
Question 50
51
Question 51
52
Question 52
53
Question 53
54
Question 54
55
Question 55
56
Question 56
57
Question 57
58
Question 58
59
Question 59
60
Question 60
61
Question 61
What is Python?
A. code
B. Interpreter
C. A type of snake
D. None of the above
62
Question 62
What is the output of print(2 + 3 * 4)?
A. 20
B. 14
C. 32
D. 18
63
Question 63
How do you convert a string
to an integer in Python?
A. int("42")
B. str(42)
C. float("42")
D. chr(42)
64
What is the output of print(2 + 3 * 4)?
A. 20
B. 14
Question 64 C. 32
D. 18
65
Question 65
What does the plt.plot()
function do in Matplotlib?
A. Create a scatter plot
B. Create a line plot
C. Create a bar plot
D. Create a pie chart
66
How can you add a title to a
Matplotlib plot?
A. plt.title()
Question 66
B. plt.add_title()
C. plt.set_title()
D. plt.plot_title()
67
Which library is built on top of
Question 67 Matplotlib and provides a high-level
interface for drawing attractive and
informative statistical graphics?
A. NumPy
B. Pandas
C. Seaborn
D. SciPy
68
Question 68
What does the sns.barplot() function do in Seaborn?
A. Create a scatter plot
B. Create a bar plot
C. Create a line plot
D. Create a pie chart
69
Question 69
What is the purpose of the return statement in a Python function?
A. To print a value
B. To exit the function and return a value
C. To define a new variable
D. None of the above
70
Question 70
What is the primary purpose of the plt.scatter() function in Matplotlib?
A. Create a line plot
B. Create a bar plot
C. Create a scatter plot
D. Create a 3D plot
71
Question 71
How can you add grid lines to a Matplotlib plot?
A. plt.grid(True)
B. plt.add_grid()
C. plt.set_grid()
72
Question 72
Which method is used to save a
Matplotlib figure to a file?
A. plt.save()
B. plt.savefig()
C. plt.save_figure()
D. plt.export()
73
What is the primary advantage of
Question 73 using Seaborn over Matplotlib for
statistical data visualization?
A. Seaborn has more color options
B. Seaborn provides a high-level
interface for drawing attractive and
informative statistical graphics
C. Seaborn is faster in rendering plots
D. Seaborn is better suited for 3D
plotting
74
Question
74
Question 75
What is the purpose of the sns.heatmap() function in Seaborn?
A. Create a scatter plot with a regression line
B. Visualize the distribution of a single variable
C. Display the correlation matrix of a DataFrame
D. Plot a 3D surface plot
76
Question 76
How can you create a violin plot
in Seaborn using the sns.violinplot() function?
A. sns.create_violinplot()
B. sns.plot_violin()
C. sns.violin_plot()
D. sns.violinplot()
77
Question 77
Question 78
What is the purpose of the elif keyword in Python?
A. It represents the end of an if-else block
B. It is short for "else if" and allows checking multiple conditions
C. It is used to create a loop
D. It is a built-in function for mathematical calculations
79
Question 79
Which data type is used to store a
sequence of characters in Python?
A. int
B. float
C. str
D. list
80
Question 80
Using matplotlib, the parameter “c” is used to change the color of the …… in
scatterplot
A- line
B- bars
C- points
81
Question 81
The first line of a function is called the
•a. initialisation
•b. header
•c. name
•d. conclusion
82
Question 82
To execute a function, you …………… it.
A. define B. import C. upload D. call
83
Question 83
A local variable that is created……. a function
A- inside B- outside
84
Question 84
The parameter used to control transparency in matplotlib is
A- marker
B- alpha
C- line color
85
Question 85
In matplotlib, to create multiple plots in one figure, we use
A. savefigure()
B. barplot()
C. subplot()
86
Question 86
To handle exceptions in Python, we use
A. error…. try
B. Try …….. Except
C. Try ………. stop
87
Question 87
In Matplotlib, the parameter bins
is used to define the …… of bins
A- number
B- width
88
Question 88
An approach that aids in minimizing code repetition in a
program especially when using functions is
a- code reuse
B- exception
89
Question 89
In the library seaborn, we use the function ……….. to
visualize pair-wise relationships in a dataset
A- scatterplot()
B- hist()
C- pairplot()
90
The += is a(n) ……. assignment operator.
A- boolean
Question 90
B- comparaison
C- augmented
91
Question 91
The function “randint” returns a ………….
within a specified range of values.
A- random B- random C- random
integer float complex
92
Good luck!
93