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 characters of a file
B
read the first 10 characters of a file
C
read the first 9 lines of a file
D
read the first 10 lines 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 list
C
reads all the lines from the file into a tuple
D
reads all the lines from the file into a string
3) What is a constructor?
A
a function to create an object
B
a special type of class
C
method called when you create an object
D
the base of a GUI program
4) Should attributes be public or private?
A
It depends
B
You should have both
C
Public
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
Static method
C
__str__method
D
Class method
6) What is a “class attribute”?
A
An attribute stored in the __init__
B
Attribute accessible by way of an object only
C
Common attribute across the class—not saved in each object
D
Common attribute between two objects
7) Why might you use a static method?
A
If your method will not be changing
B
To call another method
C
If you want something to stay constant
D
To access a class attribute
8) What method sets the size of a root window?
A
root.geometry(“200x100”)
B
root(“200x100”)
C
root.dimensions(“200x100”)
D
root.size(“200x100”)
9) How do you bind an event to an event handler?
A
By calling another method in the init method
B
mainloop()
C
By creating a submit button
D
Use the widget's command option, such as 'command = xxx'
10) What’s the purpose of grid()?
A
To display the root GUI window
B
Layout manager that puts the widget in a container and positions it
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 user input
B
A non-sequential program that runs based on user input
C
A non-sequential program that runs based on predetermined events
D
A sequential program that runs based on predetermined events
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
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
from tk import *
B
import tkinter
C
from tkinter import *
D
from tkinter import all
16) A blueprint for creating software objects is...
A
a function
B
a method
C
a class
D
an attribute
17) Which text widget option will remove text from a widget?
A
erase()
B
del()
C
delete()
D
insert()
18) What kind of object does a check button need associated with it to reflect the check button’s status?
A
StringVar
B
IntegerVar
C
IntVar
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 must have a submit button to make a GUI app event-driven.
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
Usually, you want to avoid directly accessing an object’s attributes outside of its class definition.
*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?