Revision 2 Prog2
Revision 2 Prog2
1. What will be displayed on the GUI window when the button is clicked?
a) "Hello, GUI!"
b) "Button clicked!"
c) Nothing will change.
d) An error will occur.
Answer: b) "Button clicked!"
2. Which Tkinter widget is used to display a text label?
a) Label
b) Entry
c) Button
d) Canvas
Answer: a) Label.
3. What will happen if the line number 5: root.title("Simple GUI") is removed from the code?
a) The GUI window will not have a title.
b) An error will occur when running the code.
c) The label text will not be displayed on the GUI window.
d) The button click event will not be handled.
Answer: a) The GUI window will not have a title.
4. What will happen if the line number 9: button. pack () is moved above label.pack()?
a) The button will be displayed above the label on the GUI window.
b) The label text will not be displayed on the GUI window.
c) The button click event will not be handled.
d) An error will occur when running the code.
Answer: a) The button will be displayed above the label on the GUI window.
5. What will happen if line 8: command=on_button_click is changed to command=on_button_click ()?
a) The button click event will not be handled.
b) An error will occur when running the code.
c) The label text will not be displayed on the GUI window.
d) The button will not be displayed on the GUI window.
Answer: b) An error will occur when running the code.
a) Scatter plot
b) Line plot
c) Bar plot
d) Histogram
Answer: b) Line plot
2. Which Python library is commonly used for creating data visualizations?
a) NumPy
b) Pandas
c) Matplotlib
d) Scikit-learn
Answer: c) Matplotlib
3-Which of the following methods should be employed in the code to print the created plot?
a) find_missing()
b) detect_nulls()
c) is_null()
d) isna()
Answer: d) isna()
2-The following code create a dataframe named ‘D1’ with _______________ columns. import
pandas as pd D1 = pd.DataFrame([1,2,3] ) a-1 b-2 c-3 d-4
Part 4 : OOP
1-Which of the following is correct with respect to OOP concept in Python?
A. Objects are real world entities while classes are not real.
B. Classes are real world entities while objects are not real.
C. Both objects and classes are real world entities.
D. Both object and classes are not real.
2-
Which of the following is an example of polymorphism in Python?
a) Using the + operator to concatenate two strings
b) Accessing different elements in a list using indexing
c) Defining a class with multiple methods having the same name but different parameters
d) Storing different data types in a single list
Answer: c) Defining a class with multiple methods having the same name but different parameters