Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Question 1
- 0.5 out of 0.5 points
- In a dictionary, a pair such such as dog : rover is called a(n) __________
- Selected Answer:
- Correct item
- Answers:
- couple
- Correct item
- key
- pair
- Question 2
- 0.5 out of 0.5 points
- The default mode for opening a file is
- Selected Answer:
- Correct reading
- Answers:
- Correct reading
- appending
- writing
- deleting
- Question 3
- 0.5 out of 0.5 points
- The statement set1.difference(set2) is:
- Selected Answer:
- Correct the set containing the elements that are in set1 with the elements of set2 removed
- Answers:
- the set containing the elements that are in both set1 and set2
- the set containing the elements that are in set2 with the elements of in set1 removed
- Correct the set containing the elements that are in set1 with the elements of set2 removed
- the set containing the elements that are in either set1 and set2 without duplicates
- Question 4
- 0 out of 0.5 points
- The statement set1.intersection(set2) is:
- Selected Answer:
- Incorrect the set containing the elements that are in both set1 and set2
- Answers:
- Correct the set containing the elements that are in either set1 and set2 without duplicates
- the set containing the elements that are in both set1 and set2
- the set containing the elements that are in set1 with the elements of set2 removed
- the set containing the elements that are in set2 with the elements of in set1 removed
- Question 5
- 0.5 out of 0.5 points
- If a file that already exists is opened for writing:
- Selected Answer:
- Correct the contents of the file will be erased
- Answers:
- the user will be prompted for the action they wish to take
- a Throwback error will occur
- the new data to be written will be appended to the end of the rile
- Correct the contents of the file will be erased
- Question 6
- 0.5 out of 0.5 points
- A(n) __________ is an unordered collection of items with no duplicates
- Selected Answer:
- Correct set
- Answers:
- tuple
- file
- dictionary
- Correct set
- Question 7
- 0.5 out of 0.5 points
- After all the lines of a file have been read, the readline method returns __________
- Selected Answer:
- Correct an empty string
- Answers:
- the empty tuple
- Correct an empty string
- the value None
- a Throwback error
- Question 8
- 0.5 out of 0.5 points
- What is the output of the following Python statement?
- print (set ( bookkeeper ) )
- Selected Answer:
- Correct
- {'b', 'o', 'k', 'e', 'p', 'r'}
- Answers:
- Correct
- {'b', 'o', 'k', 'e', 'p', 'r'}
- {'b', 'o', 'o', 'k', 'k', 'e', 'e', 'p', 'e', 'r'}
- {'o', 'k', 'e'}
- {'b', 'p', 'r'}
- Question 9
- 0.5 out of 0.5 points
- Python uses a(n) __________ as a temporary holding place for data to be written to disk
- Selected Answer:
- Correct buffer
- Answers:
- Correct buffer
- temp space
- special memory location
- list
- Question 10
- 0 out of 0.5 points
- An attempt to open a nonexistent file for input:
- Selected Answer:
- Incorrect none of the above
- Answers:
- creates an empty input file
- Correct generates a runtime error
- generates a syntax error
- none of the above
- Question 11
- 0.5 out of 0.5 points
- Each piece of data in a CSV file record is referred to as a(n) __________
- Selected Answer:
- Correct field
- Answers:
- line
- record
- Correct field
- tupule
- Question 12
- 0.5 out of 0.5 points
- Elements of a set are delimited with __________
- Selected Answer:
- Correct { }
- Answers:
- Correct { }
- [ ]
- ( )
- < >
- Question 13
- 0.5 out of 0.5 points
- What function do you use to terminate a connection to a file?
- Selected Answer:
- Correct close
- Answers:
- stop
- terminate
- Correct close
- disconnect
- Question 14
- 0.5 out of 0.5 points
- The statement set1.union(set2) is:
- Selected Answer:
- Correct the set containing the elements that are in either set1 and set2 without duplicates
- Answers:
- the set containing the elements that are in both set1 and set2
- Correct the set containing the elements that are in either set1 and set2 without duplicates
- the set containing the elements that are in set1 with the elements of set2 removed
- the set containing the elements that are in set2 with the elements of in set1 removed
- Question 15
- 0 out of 0.5 points
- To avoid a potential runtime error when opening files for reading or writing:
- Selected Answer:
- Incorrect use the Boolean value try to check if the file exists
- Answers:
- use the Boolean value try to check if the file exists
- prompt the user for the action to take if the file does not exist
- Correct use the os.path.isfile function
- use the os.path.file.exists function
- Question 16
- 0 out of 0.5 points
- In order for Python to use functions to work with binary files, you must first import which standard library module?
- Selected Answer:
- Incorrect osfile
- Answers:
- Correct pickle
- osfile
- os
- binaries
- Question 17
- 0.5 out of 0.5 points
- When reading data from a file, the open function returns a(n) __________
- Selected Answer:
- Correct file object
- Answers:
- Correct file object
- file name
- file handle
- file tuple
- Question 18
- 0.5 out of 0.5 points
- Which standard library module do you need to import in order to use the remove and rename functions for files?
- Selected Answer:
- Correct os
- Answers:
- Correct os
- file
- path
- pickle
- Question 19
- 0 out of 0.5 points
- When are the contents of the buffer written to disk?
- Selected Answer:
- Incorrect When the buffer is full
- Answers:
- When the buffer is full
- When the file is closed
- Correct Both a & b
- None of the above
- Question 20
- 0.5 out of 0.5 points
- Which file format stores data as a sequence of types that can only be access by special readers?
- Selected Answer:
- Correct binary
- Answers:
- CSV- formatted
- Correct binary
- text
- all of the above
- Question 21
- 0.5 out of 0.5 points
- Dictionaries cannot be created with comprehension
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Question 22
- 0.5 out of 0.5 points
- Elements of a set have no order
- Selected Answer:
- Correct True
- Answers:
- Correct True
- False
- Question 23
- 0.5 out of 0.5 points
- It is common to create dictionaries from text files
- Selected Answer:
- Correct True
- Answers:
- Correct True
- False
- Question 24
- 0.5 out of 0.5 points
- infile is a descriptive name bot not mandatory for file input usage
- Selected Answer:
- Correct True
- Answers:
- Correct True
- False
- Question 25
- 0.5 out of 0.5 points
- Elements of a set may be duplicated
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Question 26
- 0.5 out of 0.5 points
- Dictionaries cannot have other dictionaries as values
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Question 27
- 0.5 out of 0.5 points
- After all the lines of a file have been read, the readline method returns the value None
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Question 28
- 0.5 out of 0.5 points
- You must close a file in order to guarantee that all data has been physically written to the disk
- Selected Answer:
- Correct True
- Answers:
- Correct True
- False
- Question 29
- 0 out of 0.5 points
- An attempt to open a nonexistent file for input generates a syntax error
- Selected Answer:
- Incorrect True
- Answers:
- True
- Correct False
- Question 30
- 0.5 out of 0.5 points
- The remove and rename functions cannot be used with open files
- Selected Answer:
- Correct True
- Answers:
- Correct True
- False
- Question 1
- 0.5 out of 0.5 points
- In Turtle graphics, the turtle is initially facing __________
- Selected Answer:
- Correct east
- Answers:
- north
- south
- Correct east
- west
- Question 2
- 0.5 out of 0.5 points
- Which exception flags an error when the value of a variable cannot be found
- Selected Answer:
- Correct NameError
- Answers:
- ValueError
- Correct NameError
- VariableError
- AttributeError
- Question 3
- 0.5 out of 0.5 points
- When does recursion end?
- Selected Answer:
- Correct When a base case is reached
- Answers:
- When the looping mechanism completes
- Correct When a base case is reached
- When another recursive call is made
- When computation becomes too complex to handle
- Question 4
- 0.5 out of 0.5 points
- _________ is a mechanism in Python that allows the programmer to recover from errors that occur while a program is still running
- Selected Answer:
- Correct exception handling
- Answers:
- error catching
- Correct exception handling
- dynamic programming
- error reporting
- Question 5
- 0.5 out of 0.5 points
- In Turtle graphics, the write method displays a string with the __________ corner of the string approximately at the current position of the pen
- Selected Answer:
- Correct bottom-left
- Answers:
- top-left
- bottom-center
- top-center
- Correct bottom-left
- Question 6
- 0.5 out of 0.5 points
- In Turtle graphics, points on a canvas are called __________
- Selected Answer:
- Correct pixels
- Answers:
- Correct pixels
- turtles
- chevrons
- dots
- Question 7
- 0.5 out of 0.5 points
- In Turtle graphics, the white region inside the Window is called the __________
- Selected Answer:
- Correct canvas
- Answers:
- turtle board
- turtle
- chevron
- Correct canvas
- Question 8
- 0.5 out of 0.5 points
- Which one of the following is a reserved word?
- Selected Answer:
- Correct all of the above
- Answers:
- try
- except
- finally
- Correct all of the above
- Question 9
- 0.5 out of 0.5 points
- In Turtle graphics, the turtles tail is initially located __________
- Selected Answer:
- Correct at the origin of the coordinate system
- Answers:
- Correct at the origin of the coordinate system
- at the bottom middle of the canvas
- at a random location on the canvas
- at the top left corner of the canvas
- Question 10
- 0.5 out of 0.5 points
- Which exception flags an error from unavailable functionality that is requested for an object?
- Selected Answer:
- Correct AttributeError
- Answers:
- IndexError
- ValueError
- Correct AttributeError
- FunctionalityError
- Question 11
- 0.5 out of 0.5 points
- A robust way to explicitly handle exceptions is to protect code with a(n) __________ statement
- Selected Answer:
- Correct try
- Answers:
- exception
- Correct try
- protection
- handler
- Question 12
- 0.5 out of 0.5 points
- __________ recursion results when two procedures call each other
- Selected Answer:
- Correct indirect
- Answers:
- infinite
- Correct indirect
- illegal
- inconclusive
- Question 13
- 0.5 out of 0.5 points
- A program is said to be __________ if it performs well under atypical situations
- Selected Answer:
- Correct robust
- Answers:
- correct
- Correct robust
- high-performance
- well-behaved
- Question 14
- 0 out of 0.5 points
- What do you call runtime errors that usually occur due to circumstances beyond the programmer's control?
- Selected Answer:
- Incorrect
- user errors
- Answers:
- syntax errors
- random
- Correct
- exceptions
- user errors
- Question 15
- 0.5 out of 0.5 points
- In Python, the numbers generated by the random module are said to be __________
- Selected Answer:
- Correct pseudorandom
- Answers:
- truly random
- partially random
- artificially random
- Correct pseudorandom
- Question 16
- 0.5 out of 0.5 points
- Which of the following is an example of a runtime error?
- Selected Answer:
- Correct both a & b
- Answers:
- invalid input data
- file cannot be accessed
- Correct both a & b
- none of the above
- Question 17
- 0.5 out of 0.5 points
- In Turtle graphics, the tail of the turtle is initially __________
- Selected Answer:
- Correct down
- Answers:
- Correct down
- neither up or down
- non-existent
- up
- Question 18
- 0.5 out of 0.5 points
- Which exception flags an error when the function or operator receives the wrong type of argument?
- Selected Answer:
- Correct TypeError
- Answers:
- AttributeError
- Correct TypeError
- ArgumentError
- ValueError
- Question 19
- 0.5 out of 0.5 points
- Which standard library module are turtle graphics object and methods imported from?
- Selected Answer:
- Correct turtle
- Answers:
- pickle
- Correct turtle
- random
- graphics
- Question 20
- 0.5 out of 0.5 points
- What happens when a runtime error occurs that the programmer has not explicitly addressed with exception handling code?
- Selected Answer:
- Correct Both a & b
- Answers:
- The program terminates
- A Traceback error message is displayed
- Correct Both a & b
- None of the above
- Question 21
- 0 out of 0.5 points
- In Turtle graphics, what does the statement t
- Selected Answer:
- Incorrect resets the original position and orientation of the turtle
- Answers:
- resets the original position and orientation of the turtle
- makes all of the pixels on the canvas invisible
- Correct makes the chevron invisible
- resets the standard colors for the canvas
- Question 22
- 0.5 out of 0.5 points
- A function that calls itself is called __________
- Selected Answer:
- Correct recursive
- Answers:
- a palindrome
- repetitive
- inclusive
- Correct recursive
- Question 23
- 0 out of 0.5 points
- Recursive solutions often require less code than iterative solutions
- Selected Answer:
- Incorrect True
- Answers:
- True
- Correct False
- Question 24
- 0.5 out of 0.5 points
- When a runtime error occurs, it is the responsibility of the user to correct it
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Question 25
- 0 out of 0.5 points
- A try statement must contain either an except clause or a finally clause
- Selected Answer:
- Incorrect True
- Answers:
- True
- Correct False
- Question 26
- 0 out of 0.5 points
- Iterative solutions usually execute slower than recursive solutions
- Selected Answer:
- Incorrect True
- Answers:
- True
- Correct False
- Question 27
- 0 out of 0.5 points
- Any problem that can be solved with recursion can be solved with iteration
- Selected Answer:
- Incorrect True
- Answers:
- True
- Correct False
- Question 28
- 0.5 out of 0.5 points
- A try statement cannot end with a finally clause
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Question 29
- 0 out of 0.5 points
- A try statement can include more than one else clause that follows the except clauses
- Selected Answer:
- Incorrect True
- Answers:
- True
- Correct False
- Question 30
- 0.5 out of 0.5 points
- A single except clause may not refer to more than one type of error
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Question 1
- 0.5 out of 0.5 points
- In the Listbox widget, which attribute specifies the number of characters that can appear on each line?
- Selected Answer:
- Correct width
- Answers:
- height
- pixels
- size
- Correct width
- Question 2
- 0.5 out of 0.5 points
- Classes for widgets are defined in which module?
- Selected Answer:
- Correct tkinter
- Answers:
- guibldr
- Correct tkinter
- widget
- widgetbldr
- Question 3
- 0.5 out of 0.5 points
- A(n) __________ is an imaginary rectangle containing horizontal and vertical lines that subdivide in into rectangles
- Selected Answer:
- Correct grid
- Answers:
- cell
- Correct grid
- layout
- window
- Question 4
- 0.5 out of 0.5 points
- Which geometry manager provides complete control in the positioning of widgets?
- Selected Answer:
- Correct place
- Answers:
- cell
- grid
- pack
- Correct place
- Question 5
- 0 out of 0.5 points
- To move through a list box, use the __________
- Selected Answer:
- Incorrect Down Arrow key
- Answers:
- Page Down key
- Page Up key
- Down Arrow key
- Correct all of the above
- Question 6
- 0 out of 0.5 points
- Which geometry manager is the easiest to learn?
- Selected Answer:
- Incorrect pack
- Answers:
- cell
- Correct grid
- pack
- place
- Question 7
- 0.5 out of 0.5 points
- Which attribute is used to change the placement of a widget inside a cell in the grid geometry manager?
- Selected Answer:
- Correct sticky
- Answers:
- center
- move
- pad
- Correct sticky
- Question 8
- 0 out of 0.5 points
- What is the default color of the Label widget?
- Selected Answer:
- Incorrect grey
- Answers:
- black
- blue
- grey
- Correct the background color of the window
- Question 9
- 0.5 out of 0.5 points
- In the Listbox widget, which attribute specifies the number of lines that can appear in the list box at one time?
- Selected Answer:
- Correct height
- Answers:
- Correct height
- lines
- size
- width
- Question 10
- 0 out of 0.5 points
- What happens when a user enters more characters in an Entry box than was specified in the creation of the widget?
- Selected Answer:
- Incorrect text scrolls to the right
- Answers:
- text scrolls down
- text scrolls to the right
- Correct text scrolls to the left
- the widget will not accept more characters than specified
- Question 11
- 0.5 out of 0.5 points
- What is the Entry widget used for?
- Selected Answer:
- Correct both a & b
- Answers:
- obtain input from the user
- display output to the user
- Correct both a & b
- none of the above
- Question 12
- 0.5 out of 0.5 points
- A grid consists of rectangles called __________
- Selected Answer:
- Correct cells
- Answers:
- Correct cells
- windows
- widgets
- squares
- Question 13
- 0 out of 0.5 points
- What happens to empty rows in a List Box?
- Selected Answer:
- Incorrect they make a blank space
- Answers:
- it is illegal to have an empty row in a List Box
- they are highlighted in grey
- they make a blank space
- Correct they are discarded
- Question 14
- 0.5 out of 0.5 points
- Which attribute is used to enlarge a widget so that it fills an entire cell in the geometry manager?
- Selected Answer:
- Correct sticky
- Answers:
- center
- fill
- Correct sticky
- pad
- Question 15
- 0.5 out of 0.5 points
- __________ are the components of a graphical user interface
- Selected Answer:
- Correct widgets
- Answers:
- list
- objects
- tkinters
- Correct widgets
- Question 16
- 0.5 out of 0.5 points
- Text that is displayed to the left of a box is contained in a(n) __________ widget
- Selected Answer:
- Correct label
- Answers:
- Correct label
- entry
- text
- all of the above
- Question 17
- 0.5 out of 0.5 points
- What is the ReadOnly Entry widget used for?
- Selected Answer:
- Correct to display output
- Answers:
- Correct to display output
- to display input
- to display input that cannot be changed once typed in
- all of the above
- Question 18
- 0.5 out of 0.5 points
- The first row of cells is referred to as row __________
- Selected Answer:
- Correct 0
- Answers:
- Correct 0
- x
- start
- 1
- Question 19
- 0.5 out of 0.5 points
- Which geometry manager produces the nicest layouts?
- Selected Answer:
- Correct grid
- Answers:
- cell
- Correct grid
- pack
- place
- Question 20
- 0 out of 0.5 points
- How many items does a List Box hold by default?
- Selected Answer:
- Incorrect none, you must specify the number of items
- Answers:
- 1
- Correct 10
- 5
- none, you must specify the number of items
- Question 21
- 0.5 out of 0.5 points
- Boxes that appear in the GUI window are called __________ widgets
- Selected Answer:
- Correct entry
- Answers:
- button
- Correct entry
- label
- output
- Question 22
- 0.5 out of 0.5 points
- A widget can respond to
- Selected Answer:
- Correct all of the above
- Answers:
- mouse movements
- key presses
- mouse clicks
- Correct all of the above
- Question 23
- 0 out of 0.5 points
- When attaching scroll bars to list boxes, you must declare the list box before the scroll bar
- Selected Answer:
- Incorrect True
- Answers:
- True
- Correct False
- Question 24
- 0.5 out of 0.5 points
- The text in a Label widget cannot consist of more than one line
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Question 25
- 0 out of 0.5 points
- Entry widgets do not have a command argument that binds it to a callback function when an event is triggered
- Selected Answer:
- Incorrect False
- Answers:
- Correct True
- False
- Question 26
- 0.5 out of 0.5 points
- Every TUI program can be converted to a GUI program
- Selected Answer:
- Correct True
- Answers:
- Correct True
- False
- Question 27
- 0 out of 0.5 points
- Events are central to text-based interfaces
- Selected Answer:
- Incorrect True
- Answers:
- True
- Correct False
- Question 28
- 0.5 out of 0.5 points
- Vertical scroll bars can be connected to List Boxes
- Selected Answer:
- Correct True
- Answers:
- Correct True
- False
- Question 29
- 0.5 out of 0.5 points
- GUI programs are event driven
- Selected Answer:
- Correct True
- Answers:
- Correct True
- False
- Question 30
- 0.5 out of 0.5 points
- Button widgets do not have a command argument that binds it to a callback function when an event is triggered
- Selected Answer:
- Correct False
- Answers:
- True
- Correct False
- Monday, April 9, 2018 8:26:01 PM EDT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement