SDEV 140 FInal Exam Study Guide

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What comparison operator is used to test whether an expression does NOT equal another expression?

!=

What will be the return value of running the following function? chr(ord('T') + 5)?

"Y"

In the RGB system, what hexadecimal value represents the color black?

#000000

When passing color values to the tkinter module in hexadecimal, what hex string represents the color red? #0000ff #00ff00 #ff0000 #ff00ff

#ff0000

What class in the breezypythongui module provides a scrollable box for the display and selection of items? EasyIntegerField EasyListbox EasyTextField TextArea

.EasyListbox

In Python, the programmer can force the output of a value by using the cout statement. True or False.

False

In order to allow a program to respond to a button click, the programmer must set the button's "response" attribute.

False

In the early 1940s, computer scientists realized that a symbolic notation could be used instead of machine code, and the first assembly languages appeared. True or False.

False

In turtle graphics, the width of the line drawn when the turtle moves is initially 2 pixels.

False

Information is stored as patterns of bytes (1s and 0s). True or False.

False

Like with an infinite loop, an infinite recursion eventually halts execution with an error message.

False

Moore's Law states that the processing speed and storage capacity of hardware will increase and its cost will decrease by approximately a factor of 3 every 18 months. True or False.

False

Most recursive functions expect no arguments.

False

Python has a built-in type for rational numbers called rational.

False

Recursive solutions are often more natural and elegant than their iterative counterparts.

False

Some applications extract portions of strings called characters.

False

Text processing is by far the least common application of computing. True or False.

False

The + operator allows you to build a string by repeating another string a given number of times. True or False.

False

The Boolean data type is named for the twentieth-century British mathematician George Boole.

False

The absolute value of a digit is determined by raising the base of the system to the power specified by the position (baseposition).

False

The attributes of each window component are actually stored in a list.

False

The augmented assignment operations have a higher precedence than the standard assignment operation.

False

The code x % y is actually shorthand for the code __mod__(x, y).

False

The coordinate system for turtle graphics is the standard Cartesian system, with the origin (0, 0) at the bottom-left corner of a window.

False

The cost of developing software is spread equally over the phases. True or False.

False

The remove file system function is included in the os.path module.

False

The scope of an instance variable is the entire module.

False

The simplest form of selection is the if-else statement.

False

The values that can be used within the sticky attribute are "T, D, L, R".

False

When using a computer, human users primarily interact with the memory. True or False.

False

When using functions that have default arguments, the required arguments must be provided and must be placed in the same positions as they are in the function definition's header.

False True

The addButton method returns an object of type tkinter.Button.

True

The assignment of roles and responsibilities to different actors in a program is also called responsibility-driven design

True

The breezypythongui module's IntegerField component is a subclass of the Entry class.

True

The comparison operators are applied after addition but before assignment.

True

The creation of a customized version of an existing class is called subclassing.

True

The decimal number system is also called the base ten number system.

True

The exists file system function is included in the os.path module.

True

The font attribute in tkinger.Label is an object imported from tkinter.font.

True

The function call str(s) is equivalent to the method call s.__str__().

True

The not operator expects a single operand and returns its logical negation, True, if it's false, and False if it's true.

True

The screen coordinate system for the display of an image is somewhat different from the standard Cartesian coordinate system used with Turtle graphics.

True

The size of a pixel is determined by the size and resolution of the display.

True

The two digits in the base two number system are 0 and 1.

True

The use of a common pool of data allows a program to grow easily as new data sources are added to the program.

True

The values of an object's instance variables make up its state.

True

To get a better understanding of how recursion works, it is helpful to trace its calls.

True

To overload an arithmetic operator, you just define a new method using the appropriate method name.

True

To reduce a rational number to its lowest terms, you first compute the greatest common divisor (GCD) of the numerator and the denominator, using Euclid's algorithm.

True

Using a text editor such as Notepad or TextEdit, you can create, view, and save data in a text file. True or False

True

What does the os module function remove do when called?A binary number is sometimes referred to as a string of bits or a bit string.

True

When the Python interpreter evaluates a literal, the value it returns is simply that literal. True or False.

True

You can use parentheses to change the order of evaluation in an arithmetic expression. True or False.

True

What two keyword arguments can be used to force a horizontal and/or vertical spanning of grid positions? gridspan gridlock rowspan columnspan

rowspan columnspan

What two methods can be used to return a copy of a string named s converted to all lowercase and all uppercase respectively?

s.lower & s.upper

The gradual process of developing functions to solve each subproblem in a top-down design is known as what process?

stepwise refinement

You are parsing a comma separated value string with Python. What method can you use to separate the values in each line and place them in a list?

string.split(',')

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? superframe combo frame panel layout

panel

What function do you use to save an object utilizing the pickle module?

pickle.dump

What statement should you use to print the value of total with a precision of 5 digits?

print("The total is %0.5f" % total)

What print statement will output a single '\' character?

print('\\')

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

The assignment of roles and responsibilities to different actors in a program is known as what type of design?

responsibility-driven design

What is the decimal number 98 in binary?

1100010‬

What is the value of the binary number 10010110 in base-10?

150

What operator should you utilize if you wish to test for object identity between two objects? is != == @!

==

What statement regarding the use of lists is accurate? The individual elements within a list are immutable, in that the values cannot be changed. A list can be sliced into sublists. When a list is evaluated, the elements are not evaluated. Two lists cannot be concatenated together, without the creation of a third list.

A list can be sliced into sublists.

What does a block cipher utilize in order to change plaintext characters into two or more encrypted characters?

A mathematical structure known as an invertible matrix.

What statement accurately describes the use of a parameter in Python? A parameter is the name used for a function that is then referenced by other parts of the program. A parameter is the name used in the function definition for an argument that is passed to the function when it is called. A parameter is the name given to an acceptable range of values that are output from a program. A parameter is the name used for data that is returned from the execution of a function.

A parameter is the name used in the function definition for an argument that is passed to the function when it is called.

How does top-down design work?

A problem is decomposed into smaller problems, which are gradually solved to produce a solution.

What statement accurately describes what a semantic error is?

A semantic error occurs when an expression is syntactically correct, but the expression cannot be carried out.

In a conditional iteration loop, such as a while loop, what is a sentinel value?

A sentinel value is a special value provided by the user to terminate the loop.

At what point in the interpretation of a Python program are syntax error messages generated?

Before execution of the program, when it is passed through the translator.

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?

Caesar cipher

When the pickle.load function reaches the end of a file, what type of exception is raised? EOFError DataError IOError FileError

EOFError

What class in the breezypythongui module provides a scrollable box for the display and selection of items? EasyListbox EasyIntegerField TextArea EasyTextField

EasyListbox

1,500 is a valid integer literal in Python. True or False.

False

4 != 4 evaluates to 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.

False

A black-box chart is a diagram that shows the relationships among a program's functions and the passage of data between them.

False

A difference between functions and methods is that methods cannot return values.

False

A module behaves like a function, but has a slightly different syntax.

False

A program stored in computer memory must be represented in binary digits, which is also known as ASCII code. True or False.

False

For data that are owned by individual objects, you must use class variables.

False

For the most part, off-by-one errors result when the programmer incorrectly specifies the lower bound of the loop.

False

In Python, % is the exponentiation operator. True or False.

False

In general terms, what does a selection statement do?

It allows a computer to make choices based on test conditions.

What is the lambda function in Python utilized for?

It allows for the creation of an anonymous function, which contains the names of its arguments and a single expression.

Which of the following are examples of protocols that utilize encryption for data transfer? (Choose two.)

HTTPS & FTPS

What processor was contained in the first mass-produced personal computer?

INTEL 8080

Where can the required arguments for a function be found?

In the function header.

What effect does using the model/view pattern of design have? It involves the creation of a model GUI environment, and then involves the creation of views for the user to choose from. It combines the roles and responsibilities of the system between data management and user interface display. It divides the roles and responsibilities of the system between data management and user interface display. It involves the user in the defining of how data will be modeled by a program.

It divides the roles and responsibilities of the system between data management and user interface display.

What effect does a higher DPI have on the sampling done by a digital camera? It increases the number of samples that are taken. It decreases the amount of time needed for each sample. It increases the amount of time needed for each sample. It decreases the number of samples that are taken.

It increases the number of samples that are taken.

What is a one-way selection statement in the context of Python?

It is a single if statement without a corresponding else statement used to test a condition and run statements, then proceed to the next statement.

In the context of Python objects, what does the pickling process do? -It preserves objects by storing them in memory. -It preserves objects by adding them to the calling Python script file. -It preserves objects by creating a sqlite database. -It preserves objects by storing them to a file.

It preserves objects by storing them to a file.

What special character does the '\b' escape sequence generate?

It produces a backspace special character, which performs the same function as the backspace key.

What does the os module function remove do when called?

It removes a given file that is passed to it.

In Python, what does the "%" operator do in the expression 6 % 4?

It returns a remainder or modulus.

Which of the following image formats is considered to be the most popular? (Choose two.) JPEG XCF GIF SVG

JPEG & GIF

What statement accurately reflects the difference between the quotient operator and the division operator?

The quotient operator produces an integer, while the division operator produces a float.

What type of programming is defined by the term "imperative programming"? Programming that uses cooperating subprograms to solve problems. Programming that views a program as a set of cooperating functions. Programming such that classes can be defined for objects and reused to define similar objects. Programming that involves the use of input and output statements, assignment statements, and control statements for selection and iteration.

Programming that involves the use of input and output statements, assignment statements, and control statements for selection and iteration.

What type of programming is defined by the term "functional programming"? -Programming utilizing cooperative subprograms to solve problems. -Programming using input and output statements, assignment statements, and control statements for selection and iteration. -Programming such that classes can be defined for objects and reused to define similar objects. -Programming using a set of cooperating functions rather than relying on assignment.

Programming using a set of cooperating functions rather than relying on assignment.

What type of programming is defined by the term "procedural programming"? -Programming utilizing cooperative subprograms to solve problems. -Programming using input and output statements, assignment statements, and control statements for selection and iteration. -Programming using a set of cooperating functions rather than relying on assignment. -Programming such that classes can be defined for objects and reused to define similar objects.

Programming utilizing cooperative subprograms to solve problems.

What component of Python is responsible for the execution of Python byte code?

Python virtual machine (PVM)

The decimal number system, which utilizes the numbers 0-9, is also known as what number system?

The base-10 numbering system.

What statement regarding precedence of operators is accurate?

The comparison operators (==, !=, <, >, <=, >=) are higher in precedence than the assignment operator (=).

When you launch Python, what file system path does it start with?

The current working directory.

What part of the loop comprises the statements to be executed?

The loop body

What problem was the Atanasoff-Berry Computer designed to solve?

The solving of systems of simultaneous linear equations.

What is NOT one of the more important attributes of a window? The title string. The terminal prompt. The width and height in pixels. The resizability of the window.

The terminal prompt.

In evaluating a loop, you find the following statement: "value += 1". What happens to the value variable upon each iteration of the loop?

The variable is increased by 1 each iteration through the loop.

Who is credited as having created the World Wide Web in 1992?

Tim Berners-Lee

When attempting to produce a correct program, what is the point of developing a test suite?

To provide a small set of inputs as a test to verify that a program will be correct for all inputs.

A class variable is visible to all instances of a class and does not vary from instance to instance.

True

A data structure is a compound unit that consists of several smaller pieces of data.

True

A method is always called with a given data value called an object, which is placed before the method name in the call.

True

A variable associates a name with a value, making it easy to remember and use the value later in a program. True or False.

True

A while loop can be used for a count-controlled loop.

True

After input is finished, another call to read returns an empty string to indicate that the end of the file has been reached.

True

Although Python is considered an object-oriented language, its syntax does not enforce data encapsulation.

True

An abstraction hides detail and thus allows a person to view many things as just one thing.

True

An algorithm solves a general class of problems. True or False.

True

Any object can be pickled before it is saved to a file, and then unpickled as it is loaded from a file into a program.

True

As a rule of thumb, when you are defining a new class of objects, you should look around for a class that already supports some of the structure and behavior of such objects, and then subclass that class to provide the service you need.

True

Command buttons are created and placed in a window in the same manner as labels.

True

Constructors are used to create new instances of a class.

True

Default, a newly opened window shrink-wraps around its components and is resizable.

True

Each individual instruction in an algorithm is well defined. True or False.

True

GUI-based programs utilize file dialogs in order to allow the user to browse a computer's file system.

True

If the statements in the try clause raise no exceptions, the except clause is skipped and control proceeds to the end of the try-except statement.

True

In 1984, Apple Computer brought forth the Macintosh, the first successful mass-produced personal computer with a graphical user interface. True or False.

True

In general, you should use class variables only for symbolic constants or to maintain data held in common by all objects of a class.

True

Lists of strings can be displayed in list boxes.

True

Objects in the natural world and objects in the world of artifacts can be classified using inheritance hierarchies.

True

Programs rarely work as hoped the first time they are run. True or False.

True

Python programmers typically capitalize their own class names to distinguish them from variable names.

True

Recursive functions are frequently used to design algorithms for computing values that have a recursive definition.

True

You are utilizing the pickle.load function to load objects into a program from a file. However, your program raises an exception as soon as the end of the file is reached. What must you do? -Use a nested loop to run the pickle.load function line by line. -Use an if-else statement to check if the load function is at the end of the file. -Use a try-except statement to catch the exception and continue with the program. -Use the pickle.len() function to determine the size of the file, then pass the size to the pickle.load() function using the size key.

Use a try-except statement to catch the exception and continue with the program.

In Python, when does an object reach the end of its life? -When it has been terminated by the destroy method. -When it can no longer be referred to by the program that created it. -When it has passed the last statement that uses it. -When its timeout value has expired.

When it can no longer be referred to by the program that created it

The while loop is also known as what kind of a loop?

entry-control loop

How could you overload the addition operator in the Python language? -You create a new class with the same name as the arithmetic class, and define the __add__ method. -You declare a new method with the same name, __add__, and define the method. -You create a Python script named __add__.py, and then define the new method in that script, then import it. -You create a def statement with an asterisk, then specify math.__add__ as the method name.

You declare a new method with the same name, __add__, and define the method.

How can you associate a keyboard event and an event-handling method with a widget? \You must use the bind method, which expects a string containing a key event. You must define the key's event in a YAML-based configuration file. You must name the event-handling method "onPress_". You must map a shortcut in the host operating system to run the script with a specific argument.

You must use the bind method, which expects a string containing a key event.

What scenario would be ideal for the use of a prompter box? You require a GUI element to prompt for a user's text input. You require a GUI element to allow a large amount of text to be entered by the user. You require a GUI element that restricts a user to a single choice of items out of a group of items. You require a GUI element to display an error message upon incorrect input.

You require a GUI element to prompt for a user's text input.

If you wanted to overload the greater than or equal operator, what method name should you define? __ge__ __geq__ __gt__ __gte__

__ge__

What method is known as a class's constructor, because it is run automatically when a user instantiates the class?

__init__

What method is known as a class's constructor, because it is run automatically when a user instantiates the class? __build__ __main__ __start__ __init__

__init__

What are the two functions available in the tkinter.filedialog module used to support file access in a GUI program? askopenfilename askopenfileaccess askfilesystemaccess asksaveasfilename

asksaveasfilename askopenfilename

In a recursive function, what is used to determine whether to stop or to continue with another recursive step?

base case

When a sender of information encrypts that information, what is the resulting text known as?

cipher text

What type of processing occurs when processes run for a slice of time, then yield access to the CPU to another process, cycling through processes repeatedly?

concurrent processing

What concept within object-oriented programming involves the restriction of the manipulation of an object's state by external users to a set of method calls? polymorphism data encapsulation inheritance data modeling

data encapsulation

What are the two different types of loops that are used within the Python language? (Choose two.): predetermined looping definite iteration ,infinite cycling, & indefinite iteration

definite iteration & indefinite iteration

Programming that is tied to user-generated actions, such as mouse clicks, is known as what type of programming? object-oriented programming user-driven programming access-driven programming event-driven programming

event-driven programming

Most object-oriented languages require the programmer to master the following techniques: data encapsulation, inheritance, and abstraction.

false

Your script is parsing filenames and is creating a count of how many files per file extension type exist within a directory. What slice could you use to extract the file extension substring, assuming the extensions are three letters only?

filename[-3:]

What two Turtle methods affect the color of a Turtle drawing? (Choose two.) fillcolor() pencolor() setcolor() drawcolor()

fillcolor() pencolor()

In what higher-order function do you apply a predicate to each value within a list, and if the predicate returns true, the value is added to an object?

filtering

You are working on a Python script that relies heavily on the cos and sin functions of the math module. As these are the only functions you require, what should you do to import only these functions, rather than the whole math module?

from math import cos, sin

What is the process in which the Python virtual machine recycles its storage known as? -data dumping -garbage collection -trash expunging -tombstoning

garbage collection

What os module function should you use to get the path of the current working directory?

getcwd()

What built-in function should you use in Python to prompt a user for data input?

input

What term describes a dictionary of functions keyed by command names?

jump table

Which of the following is NOT a valid name that can be used for a variable?

lending

An off-by-one error is an example of what type of error in programming?

logic error

What higher-order function process applies a function to each value in a sequence and returns a new sequence of the results?

mapping

What os.path module function can you use to convert a path to a pathname appropriate for the current file system?

normcase(path)

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 continuous loop?

num = int(line.strip())

At the top, or root of the class hierarchy is the most abstract class. What is the name of this class?

object

At the top, or root of the class hierarchy is the most abstract class. What is the name of this class? parentClass root object Main

object

Which of the following functions and expressions will convert the ASCII character "Z" to its numeric equivalent ASCII code?

ord('Z')

What specific Python module can you use to determine the file size in bytes of a given file?

os.path

Given a Turtle object of t, what method can you use to erase all of the turtle's drawings, without changing the state? t.clear() t.delete() t.erase() t.scratch()

t.erase()

What technology replaced the vacuum tube as the mechanism for implementing electronic switches in computer hardware?

transistor

A method automatically returns the value None when it includes no return statement.

true

What kind of statement can be used to attempt a graceful recovery from an exception? if-else statement attempt-fail statement try-except statement test-succeed statement

try-except statement

What kind of statement can be used to attempt a graceful recovery from an exception? test-succeed statement try-except statement attempt-fail statement if-else statement

try-except statement

A GUI-based program displays a window that contains various components, also known by what specific term? doodads sprockets gadgets widgets

widgets

What is NOT a Boolean or logical operator used in the Python language?

xor


Kaugnay na mga set ng pag-aaral

Chapter 8- Adolescents, Young Adults, and Adults

View Set

C++ Chapter 6 OCCC Fall 2019 Goulden

View Set

AWS Academy Cloud Foundations - Modules 1 - 8

View Set

Unit 2- Med Surg: Cardiovascular

View Set