Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Chapter 08 – An Introduction to Programming using Python Schneider


 

Download  file with the answers

If you are not a member register here to download this file 


 

Chapter 8

1. __________ are the components of a graphical user interface.
a. widgets 
b. tkinters
c. objects
d. lists

2. Classes for widgets are defined in which module?
a. tkinter 
b. widget
c. widgetbldr
d. guibldr

3. Boxes that appear in the GUI window are called __________ widgets.
a. entry 
b. button
c. label
d. output

4. A widget can respond to
a. mouse movements
b. key presses
c. mouse clicks
d. all of the above 

5. Text that is displayed to the left of a box is contained in a(n) __________ widget.
a. label 
b. entry
c. text
d. all of the above

6. What is the default color of the Label widget?
a. the background color of the window 
b. black
c. grey
d. blue

7. What is the Entry widget used for?
a. obtain input from the user
b. display output to the user
c. both a & b 
d. none of the above

8. What happens when a user enters more characters in an Entry box than was specified in the creation of the widget?
a. text scrolls to the left 
b. text scrolls to the right
c. text scrolls down
d. the widget will not accept more characters than specified

9. What is the ReadOnly Entry widget used for?
a. to display output 
b. to display input
c. to display input that cannot be changed once typed in
d. all of the above

10. In the Listbox widget, which attribute specifies the number of lines that can appear in the list box at one time?
a. height 
b. width
c. lines
d. size

11. In the Listbox widget, which attribute specifies the number of characters that can appear on each line?
a. width 
b. height
c. pixels
d. size

12. To move through a list box, use the __________.
a. Page Down key
b. Page Up key
c. Down Arrow key
d. all of the above 

13. Which geometry manager produces the nicest layouts?
a. grid
b. pack
c. place
d. cell

14. Which geometry manager is the easiest to learn?
a. grid 
b. pack
c. place
d. cell

15. Which geometry manager provides complete control in the positioning of widgets?
a. place 
b. pack
c. grid
d. cell

16. A(n) __________ is an imaginary rectangle containing horizontal and vertical lines that subdivide in into rectangles.
a. grid 
b. cell
c. window
d. layout

17. A grid consists of rectangles called __________.
a. cells 
b. windows
c. widgets
d. squares

18. The first row of cells is referred to as row __________.
a. 0 
b. 1
c. x
d. start

19. Which attribute is used to change the placement of a widget inside a cell in the grid geometry manager?
a. sticky 
b. center
c. move
d. pad

20. Which attribute is used to enlarge a widget so that it fills an entire cell in the geometry manager?
a. sticky 
b. center
c. fill
d. pad

21. How many items does a List Box hold by default?
a. 10 
b. 5
c. 1
d. none, you must specify the number of items

22. What happens to empty rows in a List Box?
a. they are discarded 
b. they make a blank space
c. they are highlighted in grey
d. it is illegal to have an empty row in a List Box

True/False (13)
1. Widgets are objects.
Answer: true
2. GUI programs are event driven.
Answer: true
3. Events are central to text-based interfaces.
Answer: false
4. Entry widgets do not have a command argument that binds it to a callback function when an event is triggered.
Answer: true
5. Button widgets do not have a command argument that binds it to a callback function when an event is triggered.
Answer: false
6. Vertical scroll bars can be connected to List Boxes.
Answer: true
7. The text in a Label widget cannot consist of more than one line.
Answer: false
8. The text in a Button widget can consist of more than one line.
Answer: true
9. A widget can span a consecutive sequence of rows or columns in the grid geometry manager.
Answer: true
10. When attaching scroll bars to list boxes, you must declare the list box before the scroll bar.
Answer: false
11. Every GUI program can be converted to a TUI program.
Answer: false
12. Every TUI program can be converted to a GUI program.
Answer: true
13. List boxes containing long lists are typically filled from files.
Answer: true

Short Answer (9)
1. Write a statement to create an instance of the Tk class and name it window.
Answer: window = Tk()
2. Write a statement to add a title of “Tax Form” on a window object called window.
Answer: window.title(“Tax Form”)
3. What is the ReadOnly Entry widget used for?
Answer: It is used only to display output.
4. Given the following code, add a button called btn on it that says “Start Here”.
from tkinter import *
window = Tk()
Answer: btn = Button(window, text = “Start Here”)
5. What is the function of a Geometry manager?
Answer: Geometry managers are tools used to place widgets on the screen.
6. List the three geometry managers available in tkinter.
Answer: grid, pack, and place
7. When working with the grid geometry manager, what is the difference between the padx = r argument and the padx = (r, s) argument?
Answer: In the padx = r argument, you are specifying r pixels of space to both the left and right of the widget. In the padx = (r, s) argument, you are specifying r pixels of space to the left and s pixels of space to the right.
8. What does the button widget do when it is clicked?
Answer: It triggers an event.
9. How do GUI programs react to events?
Answer: They execute callback functions.

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!