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 10 lines of a file
B
read the first 9 lines of a file
C
read the first 10 characters of a file
D
read the first 9 characters of a file
2) readlines() means:
A
reads all the lines from the file, but don't do anything
B
reads all the lines from the file into a tuple
C
reads all the lines from the file into a list
D
reads all the lines from the file into a string
3) What is a constructor?
A
method called when you create an object
B
the base of a GUI program
C
a function to create an object
D
a special type of class
4) Should attributes be public or private?
A
Public
B
You should have both
C
It depends
D
Private but Python doesn’t keep you from accessing them
5) Which method allows for a printed object to display customized information?
A
__init__ method
B
Class method
C
Static method
D
__str__method
6) What is a “class attribute”?
A
An attribute stored in the __init__
B
Common attribute across the class—not saved in each object
C
Common attribute between two objects
D
Attribute accessible by way of an object only
7) Why might you use a static method?
A
To call another method
B
To access a class attribute
C
If you want something to stay constant
D
If your method will not be changing
8) What method sets the size of a root window?
A
root.size(“200x100”)
B
root.dimensions(“200x100”)
C
root.geometry(“200x100”)
D
root(“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
By creating a submit button
D
mainloop()
10) What’s the purpose of grid()?
A
To position elements in the frame
B
None of the above
C
Layout manager that puts the widget in a container and positions it
D
To display the root GUI window
11) What’s the difference between Text and Entry in a GUI app?
A
Text is just one row, and Entry is defined by how many rows and columns.
B
You can only write to Entry.
C
Entry is just one row, and Text is defined by how many rows and columns.
D
You can only write to Text.
12) What is an 'event driven program'?
A
A sequential program that runs based on user input
B
A sequential program that runs based on predetermined events
C
A non-sequential program that runs based on user input
D
A non-sequential program that runs based on predetermined events
13) What is a parameter?
A
Part of a calculation in a function.
B
The variable name a function returns.
C
A variable that can send values to a function.
D
A variable that can receive values for a function.
14) A GUI widget that only allows you to select one among many options.
A
Label
B
Button
C
Checkbox
D
Radio button
15) Which line of code will import the tkinter module into the global scope of the program?
A
import tkinter
B
from tk import *
C
from tkinter import *
D
from tkinter import all
16) A blueprint for creating software objects is...
A
a class
B
an attribute
C
a function
D
a method
17) Which text widget option will remove text from a widget?
A
del()
B
delete()
C
erase()
D
insert()
18) What kind of object does a check button need associated with it to reflect the check button’s status?
A
IntegerVar
B
IntVar
C
StringVar
D
BooleanVar
19) What can you do to a closed file?
A
None of the above
B
Read from it
C
Read and write to it
D
Write to it
20) Which of these statements is true?
A
You can't call a static method unless you've instantiated at least one object.
B
Creating a variable inside a function makes it global.
C
Usually, you want to avoid directly accessing an object’s attributes outside of its class definition.
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?