Font size
WorksheetsCIS-115-81 Final Exam
Total questions: 148
Worksheet time: 1hrs 16mins
Which of the following are examples of algorithms? (multiple answers allowed)
A dictionary
A set of instructions for putting together a utility shed
A recipe
The spelling checker of a word processor
Which of the following contain information? (Multiple answers)
A running computer
An audio CD
A book
A refrigerator
Which of the following are general-purpose computing devices?
A cell phone
A laptop
A portable music player
A programmable thermostat
Which of the following are input devices?
Microphone
Speaker
A mouse
Printer
Which of the following are output devices?
A printer
A monitor
A keyboard
A camera
What is the purpose of the CPU?
Store information
Send output to the human user
Receive inputs from the human user
Decode and execute instructions
Which of the following translates and executes instructions in the Python programming language?
A compiler
An interpreter
A loader
A text editor
Which of the following outputs data in a Python program?
The main function
The print statement
The assignment statement
The input statement
What is IDLE used to do?
Run Python programs
Edit Python programs
Save Python programs to files
All of the above
What is the set of rules for forming sentences in a language called?
Pragmatics
Logic
Semantics
Which of the following is an example of an algorithm?
A dictionary.
The spelling checker of a word processor.
A shopping list.
A recipe.
Which of the following contains information
An audio CD
A refrigerator
An automobile
A stereo speaker
Which of the following is a general-purpose computing device?
A programmable thermostat
A smartphone
A microwave oven
A portable music player
Which of the following is an input device?
Printer
Monitor
Microphone
Which of the following are output devices?
A flatbed scanner
A keyboard
A digital camera
A monitor
What is the purpose of the CPU?
Receive inputs from the human user
Send output to the human user
Decode and execute instructions
Store information
Which of the following translates and executes instructions in a programming language?
An interpreter
A loader
A compiler
A text editor
Which of the following outputs data in a Python program
The main function
The input function
The assignment statement
The print function
What is IDLE used to do?
Save Python programs to files
Edit Python programs
Run Python programs
All of the other answers
What is the set of rules for forming sentences in a language called?
Logic
Pragmatics
Syntax
Semantics
Which of the following are valid variable names?
2MoreToGo
length
_width
halt!
firstBase
Let the variable x be "dog" and the variable y be "cat". Write the values returned by the following operations:
x + y
Let the variable x be "dog" and the variable y be "cat". Write the values returned by the following operations:
x * 4
dog dog dog dog
16
444
dogdogdogdog
What is used to begin an end-of-line comment
/ symbol
* symbol
# symbol
% symbol
Which of the following lists of operators is ordered by decreasing precedence?
**, *, +
+, , *
+, -
*, /, %
The expression 2 ** 3 ** 2 evaluates to which of the following values
64
512
8
12
The expression round(23.67) evaluates to which of the following values?
23.7
23
24
24.0
Assume that the variable name has the value 33. What is the value of name after the assignment name = name * 2 executes
66
35
1089
33
How many times does a loop with the header for count in range (10): execute the statements in its body?
10
12
11
9
A for loop is convenient for? (Choose as many as apply.)
running a set of statements a predictable number of times
counting through a sequence of numbers
counting through a sequence of numbers
making choices in a program
What is the output of the loop for count in range(5): print(count, end = " ")?
1 2 3 4
0 1 2 3 4
2 3 4 5
0 1 2 3 4 5
When the function range receives two arguments, what does the second argument specify?
The last value of a sequence of integers plus 1
The last value of a sequence of integers minus 1
The step value for the loop
The last value of a sequence of integers.
Consider the following code segment:
x = 5
y = 4
if x > y:
print(y)
else:
print(x
4
5
9
20
A Boolean expression using the and operator returns True when
one operand is false
both operands are true
neither operand is true
one operand is true
By default, the while loop is a(n)
exit-controlled loop
loop that iterates a definite, preestablished number of times
entry-controlled loop
count-controlled loop
Consider the following code segment:
count = 5
while count > 1:
print(count, end = " ")
count -= 1
5 4 3 2
5 4 3 2 1
1 2 3 4 5
2 3 4 5
Consider the following code segment, which is intended to print the integers 1 through 10:
count = 1
while count <= 10:
print(count, end = " ")
Which of the following describes the error in this code?
The loop is infinite
The comparison points the wrong way
The loop control variable is not properly initalized
The loop is off by 1
Consider the following code segment:
theSum = 0.0
while True:
number = input("Enter a number: ")
if number == "":
break
theSum += float(number)
How many iterations does this loop perform
Zero or more
At least one
None
Ten
In the binary number system, each digit or bit has a positional value that is a power of what?
16
8
2
1
The decimal number system, which utilizes the numbers 0-9, is also known as what number system?
hexadecimal numbering system
base 9 numbering system
base 10 numbering system
octal numbering system
What file access method can be used to read a single line of input and return the line as a string, including the newline character?
read
fetch
getline
readline
What happens if you attempt to access a string using an index equal to the string’s length?
The name of the string will be accessed.
The entirety of the string will be accessed.
The string’s location in memory will be returned.
An error will occur, indicating the index is out of range.
What is the index of the first character in a Python string?
-1
undefined
1
0
What is the value of the binary number 10010110 in base 10?
150
144
232
169
What is the value of the decimal number 98 in binary?
1110010
110010
1100010
1100011
What os module function returns the path of the current working directory?
listdir ()
cwd ()
getpwd ()
getcwd ()
What specific Python module can you use to determine the file size in bytes of a given file?
io.file
os.stat
os.path
file.ops
What statement regarding the structure of strings is accurate?
A string’s length as calculated by the len() function is always "1"
Surrounding a Python string with double quote marks generates a syntax error.
A string cannot be decomposed into more primitive parts.
A string is a sequence of zero or more characters.
What string method can you use to locate the lowest index in a string named s where the substring "findme" appears?
When a sender of information encrypts that information, what is the resulting text known as?
garbage text
plain text
cipher text
key text
You are attempting to open a file containing a list of integer numbers, each on a separate line, and read them into Python as int types. What statement could you use to do this, assuming each line is represented by the line variable in a for loop?
num = int(line.strip())
num = line.strip()
num = line.strip(int(line))
num = line[:-1]
A binary number is sometimes referred to as a string of bits or a bit string.
True
False
A Caesar cipher uses a plaintext character to compute two or more encrypted characters, and each encrypted character is computed using two or more plaintext characters.
True
False
A module behaves like a function but has a slightly different syntax.
True
False
In Python, all data values are objects.
True
False
The exists file system function is included in the os.path module.
True
False
The string method isalpha returns True if the string contains only letters or False otherwise.
True
False
The string method isnumeric returns True if the string contains only digits or False otherwise.
True
False
The two digits in the base two number system are 0 and 1.
True
False
Using a text editor such as Notepad or TextEdit, you can create, view, and save data in a text file.
True
False
When you use the open function to open a file for input (i.e., you pass in 'r' as the mode string), if the file does not exist, Python raises an error.
True
False
The encryption method that replaces a character in a text with another character some given distance away in the alphabet from the original is known as what type of cipher?
Alpha cipher
Alternate cipher
Caesar cipher
Jumble cipher
What does a mode string of 'r' indicate when opening a file in Python?
The file will be opened in binary mode.
The file will be opened for read access.
The file will be opened for write access.
The file will be opened for random access.
In a Python dictionary, an association is formed between a key and a(n) __________.
Module
Index
Value
List
What happens if you use the following statement to sort a list of numbers called numbers? numbers = numbers.sort()
The numbers list is reordered in ascending order.
The numbers variable becomes a reference to a sorted list.
numbers is assigned a value of None.
The numbers list is reordered in descending order.
What is pattern matching?
using a Boolean function to test for the presence or absence of some property
the use of a structure containing variables to access data within another structure
the situation where two different variables refer to the same object
using structural equivalence to determine object identity
What is the return value for a function whose definition includes no return statement?
The function will return the special value None.
The function will return a value of False.
The function will return a value of True, provided there are no errors.
The function will return a NULL value.
What list method should you use in order to remove and return the element at the end of the list named "books"?
books.pop()
books.get()
books.fetch()
books.pull()
What method should you utilize to add the elements of list2 onto the end of list1?
list1.append(list2)
list2.extend(list1)
list2.append(list1)
list1.extend(list2)
What will be the range of integers included in myList after the following statement is executed?
myList = list(range(50))
1 through 49
0 through 50
0 through 49
1 through 50
When creating a list of items whose structure will not change in Python, what should you ideally use to contain the values?
String
Tuple
Dictionary
List
Which statement accurately describes the difference between a list and a tuple?
A list is created with elements in parentheses, whereas a tuple is created with square brackets.
A tuple's contents cannot be changed.
A tuple can only hold integer and float data.
A list is immutable, whereas a tuple is not.
Which statement correctly defines the term median?
A median is the value that is less than half the numbers in a set and greater than the other half.
A median is the maximum value in a set—the one that is greater than all the other values.
A median is the sum of all odd values in a set.
A median is the minimum value in a set—the one that is smaller than all the other values.
You are creating a Python script that will prompt the user to input contact names and their associated phone numbers. What data structure would be ideal for storing and accessing these associated values?
A list
A dictionary
A tuple
A string
A function’s body contains one or more statements, indented below the function header.
True
False
A list is a sequence of data values called indexes.
True
False
A Python dictionary is written as a sequence of key/value pairs separated by commas. These pairs are called indexes.
True
False
Each item in a list has a unique index that specifies its position.
True
False
The == operator returns True if the variables on either side are aliases for the same object and False if they reference two different objects holding the same contents.
True
False
The index of the first item in a Python list is 1.
True
False
The index of the last item in a Python list is the length of the list.
True
False
The main function usually expects no arguments and returns no value.
True
False
The median of a list of values is the value that occurs most frequently.
True
False
The print function strips the quotation marks from a string, but it does not alter the appearance of a list.
True
False
In a dictionary, a -> separates a key and its value.
True
False
The definition of the main function and the other function definitions can appear in no particular order in a Python script, as long as main is called at the very end of the script.
True
False
What is the first argument expected by the get method for a dictionary object?
a default value
a list of keys
a possible key
an index position
The list method ascending mutates a list by arranging its elements in ascending order.
True
False
The type of statement that returns a value from a function is the
return statement
while statement
break statement
if-else statement
When a function does not include a return statement, that function returns the value______.
nothing at all
0
none
false
The part of the function that can vary with the context of its call is (are) its
Docstring
Name
Return statement
Arguements
The part of a function that provides information about its use is (are) its
Arguments
Set of statements in its body
Docstring
Return statement
A function’s parameters
are always required
are synonymous with the function’s arguments
name variables whose values are the values of the function’s arguments when it is called
are synonymous with the function’s temporary variables
Top-down design is a strategy that
develops the functions for a program in alphabetical order by function name
starts with the main function and develops the functions on each successive level beneath the main function
develops the functions for a program in a random order
develops lower-level functions before the functions that depend on those lower-level functions
The relationships among functions in a top-down design are shown in a
structure chart
flow diagram
syntax diagram
table of contents
The scope of a temporary variable is
he entire module in which the variable is introduced
the statements in the body of the function after the statement where the variable is introduced
he time during which storage for the variable is available
The statements in the body of the function where the variable is introduced
The lifetime of a parameter is
the duration of program execution
approximately one hour
few microseconds
the duration of its function’s execution
The required arguments to a function must appear
after the optional arguments
before the optional arguments
in any order
either before or after the optional arguments
A mechanism developed to simplify or hide a complex process is known by what term?
abstraction
diffraction
obfuscation
redundancy
What happens when a function is called without its default arguments?
An exception is raised.
Their default values are automatically assigned to them.
The default values are overridden by the caller’s values.
Random values are automatically assigned to them.
What is the first thing that happens when a Python function is called?
Any imported modules are evaluated.
Python evaluates the return statement expression and makes its value available to the caller.
If there are no arguments, Python returns the value None to the caller.
Any expressions supplied as arguments are evaluated.
What term is used for the gradual process of developing functions to solve each subproblem in a top-down design?
progressing resolution
stepwise refinement
incremental solving
procedural refinement
Where can the required arguments for a function be found?
in the function keyword list
in the function's return list
in the function header
in the module docstring
Which of the following statements is accurate?
Parameters for a function receive values when they are declared.
When module variables are introduced in a program, they are immediately given a value.
Temporary variables receive their values when the function they are associated with is called.
A nested variable can assign a new value to a variable outside of its scope.
A function can be called from anywhere in a program’s code, including code within other functions.
True
False
The use of a common pool of data allows a program to grow easily as new data sources are added to the program.
True
False
To the computer, the only meaning of a variable name is the value to which it happens to refer at any given point in program execution.
True
False
When you design an algorithm, it should be general enough to provide a solution to many problem instances, not just one or a few of them.
True
False
A black-and-white photograph contains more than just the black and white colors, but various shades of gray known by what term?
grayscale
graycurve
graymap
grayshade
How does digital information differ from analog information?
Digital information consists of discrete values, while analog information contains a continuous range of values.
Digital information consists of a continuous range of values, while analog information contains a set of discrete values.
Digital information can be represented as wave patterns, while analog information consists of bits.
Digital information is commonly used in basic image and sound devices, such as recorded records, while analog information is used for electronic media.
Programming that relies on the use of objects and methods to control complexity and solve problems is known as what type of programming?
access-based programming
object-based programming
serial-based programming
entry-based programming
The drawing of simple, two-dimensional shapes, such as rectangles, triangles, pentagons, and circles, is known as what type of graphics?
geometric graphics
planar graphics
vector graphics
targeted graphics
The Turtle graphics toolkit was originally developed as part of what programming language for children?
LISP
CKids
Logo
Python
What coordinate system is utilized for the Turtle graphics toolkit?
Cartesian system
Square System
polar system
fractal system
What does the term "sampling" imply in relation to images?
the conversion of digital into analog information for display on a sampling screen
the mapping of digital information in a visual format to sample analog values
the utilization of a sample of data to represent a larger digital data set
the process of creating sample analog information from digital information for use in computer programs
What is an image's aspect ratio?
the ratio of the image's bitrate to its size
the ratio of the image's width to its height
the ratio of the image's color gamut to its bitrate
the ratio of the image's colors to their brightness
What is instantiation in Python?
It is the process of creating a class-based object.
It is the process of creating an IDLE session that utilizes a graphics window.
It is the process of calling an object’s mutator method.
It is the process of calling a function that returns no object.
What is the maximum number of distinct color values that can be displayed by the true color RGB system?
16,384
16,777,216
32,768
256
What is the term used to describe the processing of a multi-row, multi-column grid of information using a nested loop structure?
field circuit mapping
row-column mapping
row-major traversal
grid-centric retrieval
What statement accurately defines what a pixel is?
A pixel is the name for the graphical draw point of any graphics generating program.
A pixel is the graphical equivalent of a byte in memory and is used to store graphics data.
A pixel is a colored dot, also known as a picture element, that makes up part of a display.
A pixel is a graphical font, which is used to write image data onto a screen.
What Turtle method is used to move a Turtle object instance t to the center of the window, pointed east?
t.start()
t.return()
t.home()
t.restart()
Which Image method returns a copy of an Image object?
new()
clone()
duplicate()
copy()
Which method call creates and returns a blank Image with height 300, width 150, the color of each pixel transparent, and the filename the empty string?
Image(300, 150, "", (0, 0, 0))
Image(300, 150)
Image(150, 300)
Image(150, 300, (0, 0, 0), "")
Which of the following image formats is considered to be one of the most popular for sampled images?
IMG
SVG
JPEG
XCF
Why is the conversion of an image to grayscale by simply replacing the color values of each pixel with their average less than ideal?
The conversion will make details that are green or blue in color hard to see.
The conversion will cause some areas of the image to be invisible.
The conversion will still contain non-grayscale colors.
The conversion does not take luminance into account.
In the RGB system, the value 255 represents the total absence of that color component.
True
False
RGB stands for red, green, and black.
True
False
The coordinate system used by Turtle graphics places the origin (0, 0) at the bottom-left corner of a window.
True
False
How can you associate a keyboard event and an event-handling method with a widget?
You must map a shortcut in the host operating system to run the script with a specific argument.
You must name the event-handling method onPress.
You must use the bind method, which expects a string argument containing a key event.
You must define the key's event in a YAML-based configuration file.
In a GUI-based program, which elements are boxes within which a program can output text or receive it as input from the user?
command buttons
title bars
labels
entry fields
In GUI terminology, what is the name used to describe a rectangular window component with its own grid that is useful for organizing other window components?
panel
superframe
layout
combo frame
In the breezypythongui module, what class provides the basic functionality for any window, such as the command buttons in the title bar?
WindowFrame
ProgFrame
BreezyFrame
EasyFrame
In which tkinter class are the basic elements of a window’s state defined and managed?
EasyFrame
frame
window
EasyWindow
One of the requirements for a breezypythongui-based Python script you're writing is that your user interface include a slider bar for selecting a value from a range of values. What type of window component do you want?
Scale
EasyRange
EasySlider
SlideRule
What is one of the most important attributes of a window?
parent frame
terminal prompt
hash code
width and height in pixels
What is the default width of a TextField in tkinter?
30 characters
20 characters
10 characters
40 characters
What is the name of the standard GUI module for Python?
PyQt5
Kivy
tkinter
breezypythongui
What scenario would be ideal for the use of a prompter box?
You require a GUI element to allow a user to choose a file to open.
You require a GUI element that allows a user to choose their preferred language from a list of languages.
You require a GUI element to display an error message upon incorrect input.
You require a GUI element to obtain a user’s password.
When the EasyFrame class is used to create a window, what method initializes the window by setting its attributes and populating it with the appropriate GUI components?
__main__
__setup__
__init__
__window__
Which argument to the addTextField method is required?
width
text
state
rowspan
Which GUI element would be ideal for allowing a user to choose one or more recipients to send a message to from a list friends?
prompter box
radio buttons
check buttons
text area
A button has a state attribute, which can be set to “enabled” or “disabled.”
True
False
Command buttons are created and placed in a window in the same manner as labels.
True
False
In the RGB system, the hex string #00ff00 represents the color red.
True
False
The addButton method returns an object of type tkinter.Button.
True
False
The tkinter module does not support the RGB color system.
True
False
The values that can be used within a window’s sticky attribute are "T,” “D,” “L,” and “R.”
True
False
Window components are laid out in a window's three-dimensional grid.
True
False
