Review Game Zone
Flash Cards
(current)
Games
Teachers
Search
Computer Programming 2 Final Exam Review
Test Description: Use these games to help you review for the Programming 2 final exam.
Instructions: Answer all questions to get your test result.
1) read(10) means...
A
read the first 9 lines of a file
B
read the first 9 characters of a file
C
read the first 10 lines of a file
D
read the first 10 characters of a file
2) readlines() means:
A
reads all the lines from the file into a string
B
reads all the lines from the file, but don't do anything
C
reads all the lines from the file into a list
D
reads all the lines from the file into a tuple
3) What is a constructor?
A
a special type of class
B
method called when you create an object
C
the base of a GUI program
D
a function to create an object
4) Should attributes be public or private?
A
It depends
B
Public
C
Private but Python doesn’t keep you from accessing them
D
You should have both
5) Which method allows for a printed object to display customized information?
A
Class method
B
Static method
C
__str__method
D
__init__ method
6) What is a “class attribute”?
A
Attribute accessible by way of an object only
B
An attribute stored in the __init__
C
Common attribute between two objects
D
Common attribute across the class—not saved in each object
7) Why might you use a static method?
A
If you want something to stay constant
B
To call another method
C
If your method will not be changing
D
To access a class attribute
8) What method sets the size of a root window?
A
root(“200x100”)
B
root.geometry(“200x100”)
C
root.dimensions(“200x100”)
D
root.size(“200x100”)
9) How do you bind an event to an event handler?
A
Use the widget's command option, such as 'command = xxx'
B
By calling another method in the init method
C
mainloop()
D
By creating a submit button
10) What’s the purpose of grid()?
A
Layout manager that puts the widget in a container and positions it
B
To display the root GUI window
C
None of the above
D
To position elements in the frame
11) What’s the difference between Text and Entry in a GUI app?
A
You can only write to Text.
B
Text is just one row, and Entry is defined by how many rows and columns.
C
Entry is just one row, and Text is defined by how many rows and columns.
D
You can only write to Entry.
12) What is an 'event driven program'?
A
A sequential program that runs based on predetermined events
B
A non-sequential program that runs based on predetermined events
C
A non-sequential program that runs based on user input
D
A sequential program that runs based on user input
13) What is a parameter?
A
A variable that can receive values for a function.
B
A variable that can send values to a function.
C
Part of a calculation in a function.
D
The variable name a function returns.
14) A GUI widget that only allows you to select one among many options.
A
Checkbox
B
Button
C
Label
D
Radio button
15) Which line of code will import the tkinter module into the global scope of the program?
A
from tkinter import all
B
import tkinter
C
from tkinter import *
D
from tk import *
16) A blueprint for creating software objects is...
A
a method
B
a class
C
a function
D
an attribute
17) Which text widget option will remove text from a widget?
A
insert()
B
delete()
C
erase()
D
del()
18) What kind of object does a check button need associated with it to reflect the check button’s status?
A
StringVar
B
BooleanVar
C
IntVar
D
IntegerVar
19) What can you do to a closed file?
A
Write to it
B
None of the above
C
Read and write to it
D
Read from it
20) Which of these statements is true?
A
Usually, you want to avoid directly accessing an object’s attributes outside of its class definition.
B
Creating a variable inside a function makes it global.
C
You can't call a static method unless you've instantiated at least one object.
D
You must have a submit button to make a GUI app event-driven.
*select an answer for all questions
Check Results & Get Answers
Play Games with the Questions Above
Teachers: Create FREE classroom games with your questions
Click for more info!
©2007-2024
ReviewGameZone.com
|
About
|
Privacy
|
Contact
|
Terms
|
Site Map
WAIT! Find what you needed?
×
Still Looking for the Answers?
Have Another Question?
Play a Review Game with These Questions?
Want to Make Your Own Test Like This One?