Computer Programming 2 Final Exam Review Question Preview (ID: 31462)
Use These Games To Help You Review For The Programming 2 Final Exam.
TEACHERS: click here for quick copy question ID numbers.
read(10) means...
a) read the first 10 lines of a file
b) read the first 10 characters of a file
c) read the first 9 characters of a file
d) read the first 9 lines of a file
readlines() means:
a) reads all the lines from the file into a list
b) reads all the lines from the file into a tuple
c) reads all the lines from the file into a string
d) reads all the lines from the file, but don't do anything
What is a constructor?
a) a special type of class
b) a function to create an object
c) method called when you create an object
d) the base of a GUI program
Should attributes be public or private?
a) Private but Python doesn’t keep you from accessing them
b) Public
c) It depends
d) You should have both
Which method allows for a printed object to display customized information?
a) __init__ method
b) __str__method
c) Static method
d) Class method
What is a “class attribute”?
a) Common attribute between two objects
b) Common attribute across the class—not saved in each object
c) Attribute accessible by way of an object only
d) An attribute stored in the __init__
Why might you use a static method?
a) To call another method
b) If your method will not be changing
c) If you want something to stay constant
d) To access a class attribute
What method sets the size of a root window?
a) root.geometry(“200x100”)
b) root.size(“200x100”)
c) root(“200x100”)
d) root.dimensions(“200x100”)
How do you bind an event to an event handler?
a) mainloop()
b) Use the widget's command option, such as 'command = xxx'
c) By creating a submit button
d) By calling another method in the init method
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) To position elements in the frame
d) None of the above
What’s the difference between Text and Entry in a GUI app?
a) Entry is just one row, and Text is defined by how many rows and columns.
b) You can only write to Text.
c) Text is just one row, and Entry is defined by how many rows and columns.
d) You can only write to Entry.
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
What is a parameter?
a) The variable name a function returns.
b) A variable that can receive values for a function.
c) A variable that can send values to a function.
d) Part of a calculation in a function.
A GUI widget that only allows you to select one among many options.
a) Checkbox
b) Radio button
c) Button
d) Label
Which line of code will import the tkinter module into the global scope of the program?
a) from tkinter import all
b) from tk import *
c) import tkinter
d) from tkinter import *
A blueprint for creating software objects is...
a) a function
b) a class
c) a method
d) an attribute
Which text widget option will remove text from a widget?
a) erase()
b) delete()
c) insert()
d) del()
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
What can you do to a closed file?
a) Read from it
b) Write to it
c) Read and write to it
d) None of the above
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.
Play Games with the Questions above at ReviewGameZone.com
To play games using the questions from above, visit ReviewGameZone.com and enter game ID number: 31462 in the upper right hand corner or click here.
To play games using the questions from above, visit ReviewGameZone.com and enter game ID number: 31462 in the upper right hand corner or click here.
TEACHERS / EDUCATORS
Log In | Sign Up / Register
Log In | Sign Up / Register