Python final part 1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

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

!=

What method reorders items in a list from least to greatest?

.sort()

On a UNIX-based file system, the path to a given file or directory in the system is a string that starts with the ____ symbol, followed by the names of the directories traversed to reach the file or directory.

/

The default value for the column Grid attribute is ____.

0

What will the following loop print on the screen? for count in range(4):print count,

0 1 2 3

The first and second numbers in the Fibonacci sequence are ____, respectively.

0 and 1 or 1 and 1

What RGB value should you use to produce a blue color?

0, 0, 255

What will the following loop print on the screen? for count in range(4): print count,

0,1,2,3

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

1 5 0

The first and second numbers in the Fibonacci sequence are ____, respectively.

1 and 1

The underline tkinter.Font attribute can be set to ____.

1 or 0

What is the total number of distinct values in the ASCII set?

256

Which of the following literals would be considered a float type in Python?

3.14

A ____ must follow the else in an if-else statement.

:

In Python, a ____ ends the loop header.

:

In the ____ phase of the waterfall model, the programmers receive a broad statement of a problem that is potentially amenable to a computerized solution. a. customer request c. design b. analysis d. maintenance

A

In the case of infinite recursion, the stack frames are added until the PVM ____. a. runs out of memory c. notes the anomaly b. is halted by the user d. iterates 210 times

A

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.

T

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

F

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

What statement regarding the structure of strings is accurate?

A string is a sequence of zero or more characters.

What happens if you attempt to access a string using an index equal to the strings length?

An error will occur, indicating the index is out of range.

A ____ function is a function that calls itself. a. unitary c. self-calling b. recursive d. constructor

B

In Python, int, long, and ____ are called numeric data types. a. str c. dec b. float d. decimal

B

In the ____ phase of the waterfall model, the programmers determine what the program will do. a. customer request c. design b. analysis d. maintenance

B

The decimal number 6 is expressed as ____ in binary. a. 100 c. 111 b. 110 d. 1000

B

____ is the set of rules for constructing well-formed expressions or sentences in a language. a. Grammar c. Semantics b. Syntax d. Logic

B

Another name for a logic error is a ____ error. a. syntax b. debugging c. design d. pseudocode

C

The individual problems that make up a class of problems are known as problem ____. a. indexes c. instances b. items d. modules

C

The result of evaluating 45%0 is ____. a. 0 c. 45 b. 1 d. an error

D

Unlike an integer, which cannot be factored into more primitive parts, a string is a ____. a. record c. data field b. datum d. data structure

D

____ can be performed easily from an IDLE window a. Designing an algorithm b. Writing code c. Compiling d. Testing

D

____ recursion arises when the programmer fails to specify the base case or to reduce the size of the problem in a way that terminates the recursive process. a. Looping c. Stepwise b. Limitless d. Infinite

D

A user's editing within a Text widget can be disabled by setting its state attribute to ____.

DISABLED

____ restricts the manipulation of an object's state by external users to a set of method calls.

Data encapsulation

#

End-of-line comments begin with the ____ symbol.

"A" < "B" evaluates to False.

False

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

False

The Tkinter module supports the CMYK color system, but not the RGB color system.

False

Unlike other object-oriented languages, Python does not support polymorphic methods.

False

What is the minimum number of spaces that should be used to create an indented statement?

Four spaces

What is the name used for the integrated program development environment that comes with a Python installation?

IDLE

function

If designed properly, a ____'s code captures an algorithm as a general method for solving a class of problems.

T

In Python, all data values are objects.

float

In Python, int, long, and ____ are called numeric data types.

Functions

In a computer program, ____ can enforce a division of labor.

functions

In a computer program, ____ can enforce the division of labor.

Base

In a recursive function, the ____ case determines whether to stop or to continue with another recursive step.

Design

In the ____ phase of the waterfall model, the programmers determine how the program will do its task.

Customer request

In the ____ phase of the waterfall model, the programmers receive a broad statement of a problem that is potentially amenable to a computerized solution.

Where can the required arguments for a function be found?

In the function header.

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

Intel 8080

In general terms, what does a selection statement do?

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

What is a count controlled loop?

It is a loop that counts through a range of numbers to control when the loop ends.

In programming, what is a prototype?

It is a rough draft of a program.

How is data stored within a computer's memory?

It is stored as Binary data

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

Logic error

The Turtle graphics toolkit was originally developed as part of what programming language for children?

Logo

Comprehensions can be used for all of the following, except:

Modules

When using IDLE for Python programming, what color is used to distinguish built-in function names?

Purple

F

Some applications extract portions of strings called characters.

When there are no more elements then a ________ exception is raised

StopIteration

Which of the following exceptions is raised by the next() function to indicate that there is no further item to be returned by iterator

StopIteration

Which of the following exceptions is raised by the next() function to indicate that there is no further item to be returned by iterator RuntimeError StopIteration OverflowError EOFError

StopIteration

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

T

14. In Python, all data values are objects.

T

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

T

Median

The ____ is the value which is less than half the numbers in the set and greater than the other half.

or

The ____ operator returns False if and only if both of its operands are false, and returns True otherwise.

chr

The _____ function is the inverse of the ord function.

Computing agent

The action described by the instruction in an algorithm can be performed effectively or be executed by a ____.

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

The base-10 numbering system.

What does a mode string of 'r' indicate when opening a file in Python?

The file will be opened for read access.

instances

The individual problems that make up a class of problems are known as problem ____.

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

The loop body

What happens when you make a new class a subclass of another class?

The new class inherits the attributes and behaviors defined in the parent class.

What effect does the following print statement have? print("Hello" * 5)

The print statement will produce "HelloHelloHelloHelloHello".

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.

When discussing an image, what is an image's aspect ratio?

The ratio of the image's width to its height.

In a GUI-based program, what are labels supposed to do?

They are text elements that describe inputs and outputs.

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

Tim Berners-Lee

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

Transistor

A Python function cannot under normal circumstances reference a variable for its value outside of the function.

True

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

True

By default, a window has an empty title string and is resizable.

True

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

True

Syntax errors are due to code not being typed in a way that the Python interpreter can interpret.

True

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

True

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

True

____ is used to describe and document the analysis and design of complex software systems.

UML

A ____ exception is raised when Python attempts to convert a string with a bad format to a number.

ValueError

T

When used with strings, the left operand of Python's in operator is a target substring and the right operand is the string to be searched

Concatenation (+)

You can join two or more strings to form a new string using the concatenation operator ____.

Other than specifying key values when performing the method call to EasyFrame, what can you use to change a window's attributes?

You can utilize the attribute dictionary.

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.

What scenario would it make logical sense to use a multi-way selection statement for?

You need to convert numeric grades to letter grades.

Top-down

____ design starts with a global view of the entire problem and breaks the problem into smaller, more manageable subproblems.

In a class diagram, the name of each class appears in a ____.

box

The index of the first item in a list is 1.

false

Assuming you have an images module object named i, what method can you use to change the pixel at coordinate 238, 590 to red?

i.setPixel(238, 590, (255, 0, 0))

Code in the ____ programming style consists of input and output statements, assignment statements, and control statements for selection and iteration.

imperative

The individual problems that make up a class of problems are known as problem ____.

instances

The individual problems that make up as class of problems are known as problem _.

instances

What type of image compression analyzes larger regions of pixels and saves a color value that the pixels' colors approximate?

lossy compression

Separating the logic of choosing a task from the process of carrying out a task makes the program more ____.

maintainable

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

mapping

The iterator can move to the next element, using the ____ method

next()

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

normcase(path)

A ____ behaves like a variable and is introduced in a function or method header.

parameter name

To pickle an object, you start by importing the ____ module.

pickle

What function call will generate a random number in the range of 1 through 6 using the random module?

random.randint(1, 6)

Each method definition must include a first parameter named ____, even if that method seems to expect no arguments when called.

self

The ____ tkinter.MessageBox function shows a warning message.

showwarning

In Python, a string literal is a sequence of characters enclosed in ____.

single or double quotation marks

For each call of a function, the Python virtual machine must allocate a small chunk of memory on the call stack, which is known by what term?

stack frame

____ is the set of rules for constructing well-formed expressions or sentences in a language.

syntax

The ____ argument of Python's range function specifies a step value.

third

_ design starts with a global view of the entire problem and breams the problem into smaller, more manageable subproblems.

top-down

What program is used by a programmer to convert high level code into executable code?

translator

A recursive function must contain at lease one selection statement.

true

A semantic error is detected when the action that an expression describes cannot be carried out, even though that expression is syntactically correct.

true

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

true

An N-level c-curve can be drawn with a recursive function.

true

In Python, users can create their own exceptions

true

Python's ____ statement allows an exception to be caught and the program to recover.

try-except

A(n) ____ is a type of sequence that resembles a list, except that, unlike a list, it is immutable.

tuple

In general, it is a good idea to divide the code for most interactive applications into at least ____ sets of classes.

two

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

widge ts

The code x + y is actually shorthand for the code ____.

x.__add__(y)

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

xor

Access to the items in a list box is index-based. The index of any item in a list box may be specified with ____.

zero-based integer

What is the output of the following code? class test: def __init__(self,a="Hello World"): self.a=a def display(self): print(self.a) obj=test() obj.display() The program has an error because constructor can't have default arguments Nothing is displayed "Hello World" is displayed The program has an error display function doesn't have parameters

"Hello World" is displayed

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

"Y"

End-of-line comments begin with the ____ symbol.

#

In the RGB system, the value ____ represents the color black.

#000000

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?

#ff0000

In the RGB system, the value ____ represents the color white.

#ffffff

What character is used as the format operator when formatting output?

%

Python comes with _______, which helps to start from the point where we left off 'pause' 'break' 'halt' 'yield'

'yield'

Python comes with _______, which helps to start from the point where we left off.

'yield'

You indicate a tuple literal in Python by enclosing its elements in ____.

()

In Python, a ____ is the area of program text in which the name refers to a given value.

*name's scope module

You can join two or more strings to form a new string using the concatenation operator ____.

+

The decimal number 8 is expressed as ____ in binary.

1000

What is the decimal number 98 in binary?

1100010

What is the maximum number of distinct color values that can be displayed by the true color RGB system?

16,777,216

In the binary number system, each digit or bit has a positional value that is a power of what?

2

What is the output of the following code? class change: def __init__(self, x, y, z): self.a = x + y + z x = change(1,2,3) y = getattr(x, 'a') setattr(x, 'a', y+1) print(x.a) 6 7 Error 0

7

A legacy program is outputting values in octal format, and you need to translate the octal to hexadecimal. What is 173 in octal expressed as a hexadecimal value?

7B

A try, except, or finally block must all be followed by a ____ before stating individual commands.

:

A try, except, or finally block must all be followed by a ____ before stating individual commands. ( ) ; : { }

:

To extract a substring, the programmer places a ____ in the subscript.

:

The ____ keyboard event occurs when any key has been pressed.

<KeyPress>

The ____ mouse event occurs when the mouse cursor has left the widget.

<Leave>

The ____ comparison operator is used for equality.

==

38. Python includes a set of string operations called that make tasks like counting the words in a single sentence easy. a. methods c. classes b. functions d. modules

A

40. The string method returns a copy of the string, centered within the given number of columns. a. center c. format b. split d. strip

A

43. The string method returns a copy of the string converted to lowercase. a. lower c. lowerCase b. toLower d. toLowerCase

A

46. The newline escape character is . a. \n c. \eol b. \l d. \0

A

A(n) ____ program produces the expected output for any legitimate input. a. correct b. appropriate c. efficient d. logical

A

After you initialize a variable, subsequent uses of the variable name in expressions are known as ____. a. variable references c. literals b. variable instances d. implementations

A

Arguments are also known as ____. a. parameters c. members b. variables d. records

A

Python's ____ function returns a string's length when it is passed a string. a. len c. siz b. length d. size

A

There are several approaches to software development. One version is known as the ____ model. a. waterfall c. object b. abstraction d. algorithm

A

You can join two or more strings to form a new string using the concatenation operator ____. a. + c. <-> b. -> d. *

A

____ design starts with a global view of the entire problem and breaks the problem into smaller, more manageable subproblems. a. Top-down c. White-box b. Bottom-up d. Object-oriented

A

____ is a character set. a. Unicode c. Waterfall b. STX d. Bytecode

A

____ is a protocol for secure Web page transfer. a. HTTPS c. XML b. SHTTP d. FTPS

A

F

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.

List

A ____ allows the programmer to manipulate a sequence of data values of any types.

:

A ____ must follow the else in an if-else statement.

Loader

A ____ takes a set of machine language instructions as input and loads them into the appropriate memory locations

Regarding class variables, what statement is accurate? A class variable is only visible to a single instance of a class. A class variable is visible only to methods inside a class. A class variable is visible to all instances of a class, but can vary from instance to instance. A class variable is visible to all instances of a class, and does not vary from instance to instance.

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

T

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

F

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

What statement accurately defines what a pixel is?

A pixel is a colored dot, also known as a picture element, that makes up part of a display.

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.

Caesar

A very simple encryption method that has been in use for thousands of years is called a(n) _____ cipher.

Algorithm

A(n) ____ is a general method for solving a class of problems.

algorithm

A(n) ____ is a general method for solving a class of problems.

block

A(n) _____ cipher uses an invertible matrix to determine the values of the encrypted characters.

Which of the following is a Python built-in exception? EOFError KeyError SystemExit All of the above

All of the above

What kind of programming language is Python?

An interpreted language

1. _____ represents an entity in the real world with its identity and behavior. A method An object A class An operator

An object

Design error

Another name for a logic error is a ____ error. syntax

39. The string method can be used to obtain a list of the words contained in an input string. a. substring c. words b. split d. strip

B

45. Python's open function, which expects a file pathname and a string as arguments, opens a connection to the file on disk and returns a file object. a. reference c. pattern b. mode d. bit

B

49. The method of a file object inputs the contents of a file and returns them as a single string. a. get c. readfile b. read d. getfile

B

A very simple encryption method that has been in use for thousands of years is called a(n) ____ cipher. a. RSA c. HTTPS b. Caesar d. block

B

A(n) ____ expression consists of operands and operators combined in a manner that is already familiar to you from learning algebra. a. mathematical c. algebraic b. arithmetic d. integer

B

Algorithms are more often written in a somewhat stylized version of English called ____. a. byte code c. machine code b. pseudocode d. Boolean code

B

The escape sequence ____ is the newline character. a. \l c. \eof b. \n d. \eol

B

To extract a substring, the programmer places a ____ in the subscript. a. . c. ; b. : d. ,

B

Inside of a loop, after a termination condition has been met, what statement can be used to cause an exit from the loop and execute the remainder of the script?

Break

What are the two different ways that default arguments can be provided to a function? (Choose two.)

By assigning values to the keys in the function header. By supplying arguments in which they occur in the function header.

How does the int function convert a float to an int?

By removing the fractional value of the number.

. ____ is the set of rules that allow an agent to interpret the meaning of those expressions or sentences. a. Grammar c. Semantics b. Syntax d. Logic

C

41. The string method returns the number of non-overlapping occurrences of a substring in the string. a. center c. count b. split d. strip

C

44. The string method returns a copy of the string with leading and trailing whitespace (tabs, spaces, newlines) removed. a. clean c. strip b. split d. trim

C

47. In Python, the values of most data types can be converted to strings by using the function. a. convert c. str b. toString d. string

C

48. The method of a file object inputs a line of text and returns it as a string, including the newline. a. line c. readline b. read d. readLine

C

A(n) ____ is a piece of program text that the interpreter ignores but that provides useful documentation to programmers. a. literal c. comment b. instance d. documentation

C

Each digit or bit in a binary number has a positional value that is a power of ____. a. 0 c. 2 b. 1 d. 10

C

In a recursive function, the ____ case determines whether to stop or to continue with another recursive step. a. exception c. base b. exit d. selection

C

In programming, a ____ consists of a set of values and a set of operations that can be performed on those values. a. class c. data type b. data structure d. literal

C

In the ____ phase of the waterfall model, the programmers determine how the program will do its task. a. customer request c. design b. analysis d. maintenance

C

The ____ function is the inverse of the ord function. a. dro c. chr b. rord d. in

C

When using the subscript operator, the integer expression is also called a(n) ____. a. suffix c. index b. step d. iterator

C

In a computer, what component is known as the "processor"?

CPU

You are running a Python script and suspect that the script has entered an infinite loop. What key combination can you use to halt the loop?

CTRL + c

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

___________ allow sequences to be built from other sequences.

Comprehensions

What was the first PC-based operating system called?

Control Program for Microcomputers (CP/M)

36. The decimal number 8 is expressed as ____ in binary. a. 100 c. 111 b. 110 d. 1000

D

42. The string method returns a string that is the concatenation of the strings in the sequence. a. center c. concatenate b. split d. join

D

A ____ is the way a value of a data type looks to a programmer. a. class c. data type b. data structure d. literal

D

A(n) ____ cipher uses an invertible matrix to determine the values of the encrypted characters. a. RSA c. HTTPS b. Caesar d. block

D

A(n) ____ function is a function with the same name as the data type to which it converts. a. semantic c. casting b. abstraction d. type conversion

D

A(n) ____ is a general method for solving a class of problems. a. class c. module b. function d. algorithm

D

As functions are developed to solve each subproblem, the solution to the overall problem is gradually filled out in detail. This process is also called ____. a. top-down design c. object-oriented design b. bottom-up design d. stepwise refinement

D

During the ____ phase of the waterfall model, requirements change, errors are detected, and minor or major modifications are made. a. customer request c. design b. analysis d. maintenance

D

End-of-line comments begin with the ____ symbol. a. + c. & b. // d. #

D

If the program works correctly with ____, we can assume that it will work correctly with larger values. a. input values b. an abstraction c. a syntax error d. a test suite

D

In Python, ____ is the exponentiation operator. a. ^ c. % b. & d. **

D

In Python, a string literal is a sequence of characters enclosed in ____. a. square brackets c. double quotation marks b. single quotation marks d. single or double quotation marks

D

In ____ design, you decompose a complex problem into smaller problems of exactly the same form. a. top-down c. modular b. bottom-up d. recursive

D

How does digital information differ from analog information?

Digital information consists of discrete values, while analog is a continuous range of values.

When using cPickle.load, if the end of the file has been reached an ____ is raised.

EOFError

Which of the following exceptions is raised when the input() functions hits end-of-file condition.

EOFError

Which of the following exceptions is raised when the input() functions hits end-of-file condition. EOFError MemoryError AsertionError TypeError

EOFError

Joseph Jacquard

Early in the nineteenth century, ____ designed and constructed a machine that automated the process of weaving.

In the breezypythongui module, what class provides the basic functionality for any window, such as the command buttons in the title bar?

EasyFrame

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

EasyListbox

In evaluating the precedence rules used by Python, what statement is accurate?

Exponentiation has the highest precedence.

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

F

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

F

15. The string method isalphabetic returns True if the string contains only letters or False otherwise.

F

16. The string method isnumeric returns True if the string contains only digits or False otherwise.

F

19. Data can be output to a text file using a(n) output object.

F

20. When using the open function to open a file for output (i.e., using 'w' as the mode string), if the file does not exist, Python raises an error.

F

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.

F

A list is a sequence of data value called indexes.

F

A list is immutable.

F

Many applications now use data mangling to protect information transmitted on networks.

F

Some applications extract portions of strings called characters.

F

The == operator returns True if the variables are aliases for the same object. Unfortunately, == returns False if the contents of two different objects are the same.

F

The index of the first item in a list is 1.

F

The index of the last item in a list is the length of the list.

F

The is operator has no way of distinguishing between object identity and structural equivalence.

F

The list method ascending mutates a list by arranging its elements in ascending order.

F

The string is a mutable data structure.

F

You cannot use the equality operator to compare two integer lists.

F

1,500 is a valid integer literal in Python.

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 Python dictionary is written as a sequence of key/value pairs separated by commas. These pairs are sometimes called indexes.

False

A Python function cannot under normal circumstances reference a module variable for its value.

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 button has a state attribute, which can be set to "enabled" or "disabled".

False

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

False

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

False

A fractal object can be described using Euclidean geometry.

False

A function call expresses the idea of a process to the programmer, forcing him or her to wade through the complex code that realizes that idea.

False

A function call expresses the idea of a process to the programmer, forcing him or her to wade through the complex code that realizes that idea. I True False

False

A function call requires a programmer to understand every line of code inside of the function. (Hint: Do you have to know every line of code inside the print() function?)

False

A lambda is an abstract function.

False

A method header looks very different from a function header.

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.

False

A recursive function must contain at least one repetition statement.

False

Abstraction enables us to apply a function to each value in a list and returns a new list of the results.

False

Assuming that the value of x is 4, and the value of y is 6, what is the value of the following expression? (x - y)**2 > y

False

Command buttons can display text but not images.

False

Comprehensions can not be used to generate the Cartesian product of two sets

False

Data can be output to a text file using a(n) output object.

False

Each box in a structure chart is labeled with a module name.

False

Early recording and playback devices for images and sound were all discrete devices.

False

Exponentiation and assignment operations are left associative.

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

GUI-based programs use windows that contain various components, also called window objects or gadgets.

False

If A is True, what will the statement "not A" return?

False

If the parenthesized parent class name is omitted from the class definition, the new class is automatically made a subclass of self.

False

In Python, % is the exponentiation operator.

False

In Python, = means equals, whereas == means assignment.

False

In Python, = means equals, whereas == means assignment. True False

False

In Python, \b is a escape sequence that represents a horizontal tab.

False

In Python, a floating-point number must be written using scientific notation.

False

In Python, a try clause can have only one except clause.

False

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

False

In Python, you cannot pass a function as an argument to another function.

False

In a GUI-based program, the user can usually alter the size of a window by holding the mouse on its lower-left corner and dragging in any direction.

False

In a dictionary, a -> separates a key and its value.

False

In bottom-up design, you decompose a complex problem into a set of simpler problems and solve these with different functions.

False

In the 1930s, the mathematician Blaise Pascal explored the theoretical foundations and limits of algorithms and computation.

False

In the RGB system, the value 255 represents the total absence of that component.

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.

False

In the maintenance phase of the waterfall model, the parts of a program are brought together into a smoothly functioning whole, usually not an easy task.

False

In turtle graphics, the turtle is initially facing east.

False

Informally, a computing agent is like a recipe.

False

Information is stored as patterns of bytes (1s and 0s)

False

Inheritance allows several different classes to use the same general method names.

False

Inheritance allows several different classes to use the same general method names. True False

False

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

False

Loop statements allow a computer to make choices.

False

Many applications now use data mangling to protect information transmitted on networks.

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.

False

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

False

Most recursive functions expect no arguments.

False

Newer versions of Python (Python 3) comprehensions can not be used with dictionary and sets.

False

Procedural programming dispenses with assignment altogether.

False

Python does not support anonymous functions.

False

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

False

Python includes many useful functions, which are organized in libraries of code called classes.

False

Python is a loosely typed programming language.

False

Recursive functions tend to be more complicated than the corresponding loops.

False

Some applications extract portions of strings called characters.

False

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

False

Text within a Text widget is accessed by index positions, which are specified as integers.

False

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

False

The == operator returns True if the variables are aliases for the same object. Unfortunately, == returns False if the contents of two different objects are the same.

False

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

False

The GIF format uses a lossless compression scheme.

False

The Python interpreter picks out equality from the other comparisons by looking for an __equals__ method when it encounters the == and != operators.

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 amount of memory needed for a loop grows with the size of the problem's data set.

False

The amount of memory needed for a loop grows with the size of the problem's data set. True False

False

The attributes of an object are represented as instance datum.

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 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.

False

The data container object type (class) that can be used with Entry fields to enter float data is called FloatVar.

False

The default value of the wrap attribute of the Text widget is NONE.

False

The design phase of the waterfall model is also called the coding phase.

False

The first five numbers of the Fibonacci sequence are 1 3 5 8 13.

False

The if-else statement is the most common type of selection statement.

False

The imperative programming style scales well.

False

The index of the first item in a list is 1.

False

The ipady Grid attribute indicates the number of pixels of horizontal padding added within the boundaries of the widget.

False

The modulus operator has the highest precedence and is evaluated first.

False

The not operator has a lower precedence than the and and or operators.

False

The or operator returns True if and only if both of its operands are true, and returns False otherwise.

False

The process of sending a result back to another part of a program is known as pushing a value.

False

The scope of an instance variable is the entire module.

False

The scope of an instance variable is the entire module. True False

False

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

False

The simplest form of selection is the if-else statement. Incorrect Response True False

False

The statements in the loop body need not be indented and aligned in the same column.

False

The statements within a while loop can execute one or more times.

False

The statements within a while loop can execute one or more times. True False

False

The str method is a good example of a polymorphic method that appears throughout Python's system of classes.

False

The string is a mutable data structure.

False

The string method isalphabetic returns True if the string contains only letters or False otherwise.

False

The string method isnumeric returns True if the string contains only digits or False otherwise.

False

The tkDialogBox module includes several functions that can be used to create common pop-up dialog boxes.

False

The tkFont.Font slant attribute can be set to "italic" or "normal".

False

The tkFont.Font weight attribute can be set to "bold" or "roman".

False

The use of min(MyList) finds the max value of MyList.

False

The while loop is also called a sentinel-control loop, because its condition is tested at the top of the loop.

False

When a call returns or completes its execution, the memory for the stack frame is reallocated.

False

When executing the print statement, Python first displays the value and then evaluates the expression.

False

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

False

When using the open function to open a file for output (i.e., using 'w' as the mode string), if the file does not exist, Python raises an error.

False

You cannot use the equality operator to compare two integer lists.

False

string is an example of a data type in Python.

False

In the RGB system, the value #00ff00 represents the color red.

False (Green)

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

'_______' blocks get executed automatically, and are mostly used to release external resources.

Finally

'_______' blocks get executed automatically, and are mostly used to release external resources. Finally Try Catch Except

Finally

____ programming views a program as a set of cooperating functions.

Functional

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

GIF JPEG

___________ are functions that generate the requisite sequences.

Generators

What language, created by Tim Berners-Lee, allows browsers to structure the information to be displayed on Web pages?

HTML

____ recursion arises when the programmer fails to specify the base case or to reduce the size of the problem in a way that terminates the recursive process.

Infinite

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.

What effect does a higher DPI have on the sampling done by a digital camera?

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.

What is instantiation in Python?

It is the process of creating a class-based object.

What is the "self" parameter utilized for in a class definition block?

It is used within the class and method definitions to call other methods on the same object, or to access that object's variables or data.

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.

What is the purpose of a higher-order function?

It separates the task of transforming data values from the logic of accumulating the results.

What language was designed based on a theory of recursive functions and is considered to be an ideal language for solving difficult or complex problems?

LISP

What is not one of the initial four locations connected by the ARPANENT in the 1970s

MIT

F

Many applications now use data mangling to protect information transmitted on networks

Which of the following exceptions is raised when a variable is not found in local or global scope?

NameError

Which of the following exceptions is raised when a variable is not found in local or global scope? OSError KeyError AssertionError NameError

NameError

Which of the following exceptions is raised by abstract methods?

NotImplementedError

Which of the following exceptions is raised by abstract methods? NotImplementedError ReferenceError EOFError IndexError

NotImplementedError

eliminating redundant, or repetitious, code

One way in which functions serve as abstraction mechanisms is by ____.

hiding complicated details

One way in which functions serve as abstraction mechanisms is by ____.

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

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

Python Virtual Machine (PVM)

What happens when a function tries to assign or change a value of a variable that has been defined at the module level?

Python creates a temporary variable with the same name, and the value of that variable exists only within the scope of the function.

methods

Python includes a set of string operations called _____ that make tasks like counting the words in a single sentence easy.

len

Python's _____ function returns a string's length when it is passed a string.

In the ____ color system, a color consists of three integer components that specify the intensities of red, green, and blue mixed into that color.

RGB

What is the term used to describe the processing of a multi-row, multi-column grid of information using a nested loop structure?

Row-major traversal

One of the requirements for a breezypythongui-based Python script you're writing is that you be able to use a slider bar for selecting a value from a range of values. What type of window component do you want?

Scale

18. All data output to or input from a text file must be strings.

T

21. The file method write expects a single string as an argument.

T

22. When using the open function to open a file for input (i.e., using 'r' as the mode string), if the file does not exist, Python raises an error.

T

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

T

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

T

Although a list's elements are always ordered by position, it is possible to impose a natural ordering on them as well.

T

Each item in a list has a unique index that specifies its position.

T

Lists of integers can be built using the range function.

T

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

T

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

T

To prevent aliasing, a new object can be created and the contents of the original can be copied to it.

T

When replacing an element in a list, the subscript is used to reference the target of the assignment statement, which is not that list but an element's position within it.

T

When used with strings, the left operand of Python's in operator is a target substring and the right operand is the string to be searched.

T

Python includes a ____ widget for the display of multiple lines of text.

Text

What is the call stack used for in the Python virtual machine?

The call stack is an area of reserved memory used to store chunks of memory related to functions.

What statement regarding precedence of operators is accurate?

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

When instantiating a class and assigning the resulting object to a variable, what is the right side of the assignment called?

The constructor statement.

Why is the conversion of an image to grayscale by simply computing the average of a pixel less than ideal?

The conversion does not take luminance into account.

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

The current working directory

You are running a Python script that is supposed to write data to an open file, but discover that the file contents are not updating even after the script finishes. What is most likely the issue?

The file was not closed using the close() method.

You are running a Python script that is supposed to write data to an open file, but discover that the file contents are being erased each time the script runs. What is most likely the issue?

The file was opened using a mode string other than 'a'.

What must be done in order to concatenate a string and a float object?

The float object must be converted to a string object via the str() function.

In the waterfall development model, what is the most expensive part of software development?

The maintenance phase

What does the term "sampling" imply in relation to images?

The mapping of analog information in a visual format to discrete values.

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

The solving of systems of simultaneous linear equations

What would be the output if you were to print the variable named value as declared by this statement: value = "2" + "2"?

The string "22"

F

The string is a mutable data structure.

Strip

The string method ____ returns a copy of the string with leading and trailing whitespace (tabs, spaces, newlines) removed.

split

The string method _____ can be used to obtain a list of the words contained in an input string.

join

The string method _____ returns a copy of a string that is a concatenation of the strings in a sequence.

lower

The string method _____ returns a copy of the string converted to lowercase.

strip

The string method _____ returns a copy of the string with leading and trailing whitespace (tabs, spaces, newlines) removed.

center

The string method _____ returns a copy of the string, centered within the given number of columns.

count

The string method _____ returns the number of non-overlapping occurrences of a substring within the string.

F

The string method is alphabetic returns True if the string contains only letters or False otherwise.

F

The string method isnumeric returns True if the string contains only digits or false otherwise.

What can often provide you with a pattern for designing the structure of a program?

The structure of the problem you're attempting to solve.

What is NOT one of the more important attributes of a window?

The terminal prompt

While viewing a screen displaying an active IDLE session, what does green text mean?

The text represents a string

When using the range function, what effect does the specification of a third argument have?

The third argument specifies a step value to be used in the range.

What is the largest value of an int data type in the Python programming language?

The value is limited only by the memory of the host computer.

You are reviewing the code written by another programmer, and encounter a variable whose name is entirely in capital letters. What might you discern from this variable name?

The variable is a symbolic constant.

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.

Given the following statement: "%4d" % var1, which of the following is accurate? The variable var1 must be an integer value. The variable var1 must be a string value. The variable var1 will be in octal format. The variable var1 will be formatted regardless of type.

The variable var1 must be an integer value

Given the following statement: "%4d" % var1, which of the following is accurate?

The variable var1 must be an integer value.

When reading the syntax for the print command, what does the ellipsis between expressions indicate?

They indicate that you could include multiple expressions after the first one.

What is the name of the standard GUI module for Python?

Tkinter

The ____ class includes a wide array of methods for managing items in a list box.

Tkinter.Listbox

:

To extract a substring, the programmer places a _____ in the subscript.

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.

____ design starts with a global view of the entire problem and breaks the problem into smaller, more manageable subproblems.

Top-down

A binary number is sometimes referred to as a string of bits or a bit string.

True

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

True

A condition expresses a hypothesis about the state of its world at that point in time.

True

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

True

A for loop can be used to iterate through a list, tuple, string, or a dictionary.

True

A function can be defined in a Python shell, but it is more convenient to define it in an IDLE window, where it can be saved to a file.

True

A logic error is when the programmer means to create one output, but gets another for some reason.

True

A lookup table is a type of dictionary.

True

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

True

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

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 method reference always uses an object, which can be denoted by a string followed by a dot and the method name.

True

A method reference always uses an object, which can be denoted by a string followed by a dot and the method name. True False

True

A program's namespace is the set of its variables and their values.

True

A programmer typically starts by writing high-level language statements in a text editor.

True

A raw image file saves all of the sampled information.

True

A semantic error is detected when the action which an expression describes cannot be carried out, even though that expression is syntactically correct.

True

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

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

All data output to or input from a text file must be strings.

True

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

True

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

True

Although the while loop can be complicated to write correctly, it is possible to simplify its structure and thus improve its readability.

True

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

True

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

True

An algorithm describes a process that ends with a solution to a problem.

True

An algorithm solves a general class of problems.

True

An important part of any operating system is its file system, which allows human users to organize their data and programs in permanent storage.

True

Ancient mathematicians developed the first algorithms

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

By the mid 1980s, the ARPANET had grown into what we now call the Internet, connecting computers owned by large institutions, small organizations, and individuals all over the world.

True

Computer scientists refer to the process of planning and organizing a program as software development.

True

Conditional iteration requires that a condition be tested within the loop to determine whether the loop should continue.

True

Each individual instruction in an algorithm is well defined.

True

Expressions provide an easy way to perform operations on data values to produce other data values.

True

GUI-based programs are almost always object-oriented.

True

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

True

Generally, it is easiest for both the programmer and the user to manage a window that is not resizable.

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 graphical interface.

True

In Python, all data values are objects

True

In Python, all data values are objects.

True

In Python, functions and other resources are coded in components called modules.

True

In Python, users can create their own exceptions.

True

In a case of infinite recursion, the Python virtual machine eventually runs out of memory resources to manage the process, so it halts execution with an error message.

True

In general, a variable name must begin with either a letter or an underscore (_).

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

In the 1960s, batch processing sometimes caused a programmer to wait days for results, including error messages.

True

In the MVC pattern, the controller often handles the interactions between a program's data model and its view.

True

In the earlier version of Python (Python 2.0) only list comprehensions were allowed.

True

Inheritance allows a class to automatically reuse and extend the code of similar but more general classes.

True

It is not usual to bother subclassing unless the two classes share a substantial amount of abstract behavior.

True

It is possible to construct any algorithm using only Python's built-in operators and control statements.

True

Lists of strings can be displayed in list boxes.

True

Magnetic storage media, such as tapes and hard disks, allow bit patterns to be stored as patterns on a magnetic field.

True

Modern software development is usually incremental and iterative.

True

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

True

Operator overloading is an example of an abstraction mechanism.

True

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

True

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

True

Real numbers have infinite precision, which means that the digits in the fractional part can continue forever.

True

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

True

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

True

Sequences like geometric progression, Fibonacci series, etc., can be easily generated using generator.

True

Simple Boolean expressions consist of the Boolean values True or False, variables bound to those values, function calls that return Boolean values, or comparisons.

True

Smart compilers exist that can optimize some recursive functions by translating them to iterative machine code.

True

Some computer scientists argue that a while True loop with a delayed exit violates the spirit of the while loop.

True

Testing is a deliberate process that requires some planning and discipline on the programmer's part.

True

The RGB system is called a true color system.

True

The ValueError exception type catches when a user types in an input of an invalid data type.

True

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

True

The algorithms that describe information processing can also be represented as information.

True

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

True

The assignment symbol can be combined with the arithmetic and concatenation operators to provide augmented assignment operations.

True

The comparison operators are applied after addition but before assignment.

True

The constants ACTIVE and END specify index positions in a list box.

True

The data container object type (class) that can be used with Entry fields to enter int data is called IntVar.

True

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

True

The default behavior of the widgets when the user expands the window is to stay huddled together, in an invisible shrink-wrap, in the center of the window.

True

The definition of the main function and the other function definitions can appear in no particular order in the script, as long as main is called at the very end of the script.

True

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

True

The file method write expects a single string as an argument.

True

The first electronic digital computers, sometimes called mainframe computers, consisted of vacuum tubes, wires, and plugs, and filled entire rooms.

True

The following code can be used to set an iterator on a list: <myIter> = iter(<myList>)

True

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

True

The most important example of system software is a computer's operating system.

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 pady Grid attribute indicates the number of pixels of vertical padding added between the boundaries of the widget and its cell boundaries.

True

The part of a computer that is responsible for processing data is the central processing unit (CPU)

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

There are two types of loops -- those that repeat an action a predefined number of times(definite iteration) and those that perform the action until the program determines that it needs to stop (indefinite iteration).

True

There are various ways to allow a user to view text that extends beyond the visible area of a Text widget.

True

There is more to software development than writing code.

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

Variables receive their initial values and can be reset to new values with an assignment statement.

True

When the step argument is a negative number, the range function generates a sequence of numbers from the first argument plus 1.

True

When used with strings, the left operand of Python's in operator is a target substring and the right operand is the string to be searched.

True

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.

True

When using the open function to open a file for input (i.e., using 'r' as the mode string), if the file does not exist, Python raises an error.

True

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

You add a new key/value pair to a dictionary by using the subscript operator [].

True

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

True

Data structure

Unlike an integer, which cannot be factored into more primitive parts, a string is a ____.

data structure

Unlike an integer, which cannot be factored into more primitive parts, a string is a _____.

In the images module, how does the Image class represent an image?

Using a two-dimensional grid of RGB values.

Which of the following statements are accurate? (Choose two.) Parameters for a function receive values when they are declared. When module variables are introduced in a program, they are immediately given a value. A nested variable can assign value to a variable outside of its scope. Temporary values receive their values as soon as they are introduced.

When module variables are introduced in a program, they are immediately given a value. Temporary values receive their values as soon as they are introduced.

Index

When using the subscript operator, the integer expression is also called a(n) ____.

index

When using the subscript operator, the integer expression is also called a(n) _____.

What scenario would be ideal for the use of a check button?

You require a GUI element that can be grouped with other elements that can be selected at the same time.

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.

What exception type catches division by 0?

ZeroDivisionError

____ is not a valid list in Python.

[2:4]

The newline escape character is ____.

\n

High-level

____ programming languages resemble English and allow the author to express algorithms in a form that other people can understand.

HTTPS

_____ is a protocol for secure Web page transfer.

Functions that are always available in Python come from what module?

__builtin__

Most classes include a special method named ____, which is the class's constructor.

__init__

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

__init__

When using the EasyFrame class to create a window, what method specifically is used to set up any window components to display in the window?

__init__

The ____ method builds and returns a string representation of an object's state.

__str__

What two items are included in the class header of a class defined in Python? (Choose two.)

a. The class name, conventionally capitalized. b. The list of one or more parent classes.

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

a. asksaveasfilename b. askopenfilename

Which of the following classes are associated with a Turtle object? (Choose two.)

a.Canvas b.Screen

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

a.HTTPS d.FTPS

What two keyword arguments can be used to force a horizontal and/or vertical spanning of grid positions? (Choose two.)

a.columnspan b.rowspan

What two Turtle methods affect the color of a Turtle drawing? (Choose two.)

a.fillcolor() b.pencolor()

Pop

aList.____(index) Which method of the List type removes and returns the element at index?

A(n) ____ class includes data and methods common to its subclasses, but is never instantiated.

abstract

What term describes the process of substituting a simple process for a complex process in a program to make the program easier to understand and maintain?

abstraction

What type of method returns the values of an object's attributes without altering its state?

accessor methods

Methods that allow a user to observe but not change the state of an object are called ____.

accessors

A(n) ____ is a general method for solving a class of problems.

algorithm

An _ is a general method for solving a class of problems.

algorithm

The ____ method of the list type adds an element to the end of the list.

append

A(n) ____ expression consists of operands and operators combined in a manner that is already familiar to you from learning algebra.

arithmetic

The use of +=, -=, and *= are all examples of what type of operators?

augmented assignment operators

Extend

bList.____(aList) What method of the List type adds the elements of aList to the end of bList?

In a recursive function, the _ case determines whether to stop or to continue with another recursive step.

base

In a recursive function, the ____ case determines whether to stop or to continue with another recursive step.

base

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

base case

You can associate a mouse event and an event-handling method with a widget by calling the ____ method.

bind

When a Python interpreter runs a script, what is the script translated into?

byte code

Which of the following statements are accurate? (Choose two.)

c. Temporary values receive their values as soon as they are introduced. d. When module variables are introduced in a program, they are immediately given a value.

What are two common methods by which functions serve as abstraction mechanisms? (Choose two.)

c.The elimination of redundant, or repetitious code. d.The hiding of complicated processes.

What coordinate system is utilized for the Turtle graphics toolkit?

cartesian system

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

cipher text

One can define a(n) ____, in which _init_, _iter_, and _next_ can be defined as per the requirement.

class

The ____ definition syntax has two parts: a header and a set of method definitions that follow the header.

class

In Python, you can write a print statement that includes two or more expressions separated by ____.

commas

A(n) ____ is a piece of program text that the interpreter ignores but that provides useful documentation to programmers.

comment

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

The index of the last item in a list is the length of the list.

dalse

What are the two different types of loops that are used within the Python language? (Choose two.)

definite iteration indefinite iteration

GUI-based programs rely extensively on pop-up ____ that display messages, query the user for a Yes/No answer, and so forth.

dialog boxes

A ____ organizes data values by association with other data values rather than by sequential position.

dictionary

What function can you call inside of IDLE to show the resources of the math module, once it has been imported?

dir(math)

One way in which functions help in creating easy to read code is by ____.

eliminating redundant, or repetitious, code

One way in which functions serve as abstraction mechanisms is by ____.

eliminating redundant, or repetitious, code

In order to change the print function to output on the same line as the previous one, without printing a newline, what expression can be added?

end = ""

In GUI-based programs, ____ are boxes within which the program can output text or receive it as input from the user.

entry fields

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

entry-control loop

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

event-driven programming

To activate a button and enable it to respond to mouse clicks, you must set its command attribute to a(n) ____ method.

event-handling

In GUI-based programs, mouse-clicks are user-generated ____.

events

In Python, exceptions can be handled using a try and _____ statements

except

In Python, exceptions can be handled using a try and _____ statements catch finally throw except

except

Run time errors are known as ________ faults exceptions conditions breaks

exceptions

Run time errors are known as _________.

exceptions

1,500 is a valid integer literal in Python.

false

A Python function cannot under normal circumstances reference a module variable for its value.

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 fractal curve is one-dimensional.

false

A function call expresses the idea of a process to the programmer, forcing him or her to wade through the complex code that realizes that idea.

false

A list is immutable.

false

A recursive function must contain at least one repetition statement.

false

An abstraction hides detail and this allows a person to view one thing and many things.

false

Command buttons can display text but not images.

false

Each box in a structure chart is labeled with a module name.

false

Exponentiation and assignment operations are left associative.

false

In Python, % is the exponentiation operator.

false

In Python, a floating-point number must be written using scientific notation.

false

In Python, a try clause can have only one except clause

false

In a case of infinite recursion, the Python virtual machine keeps on looping on forever.

false

In bottom-up design, you decompose a complex problem into a set of simpler problems and solve these with different functions.

false

In the RGB system, each color component can range from 0 through 127.

false

In the RGB system, the value #00ff00 represents the color red.

false

In the maintenance phase of the waterfall model, the parts of a program are brought together into a smoothly functioning whole, usually not an easy task.

false

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

false

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

false

Most recursive functions expect no arguments.

false

Python is a loosely typed programming language.

false

RGB stands for red, green, and black.

false

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

false

Recursive functions tend to be more complicated than the corresponding loops.

false

Recursive solution are often more choppy and clumsy than their iterative counterparts.

false

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

false

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

false

The Tkinter module supports the CMYK color system, but not the RGB color system.

false

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

false

The design phase of the waterfall model is also called the coding phase.

false

The development of the transistor in the ealry 1960s allowed comupter engineers to build even smaller, faster, and less expensive computer hardware components.

false

The first five numbers of the Fibonacci sequence are 1 3 5 8 13.

false

The images module is a standard, open-source Python tool.

false

The modulus operator has the highest precedence and is evaluated first.

false

The setPixels method of the Turtle class changes the width of the turtle in pixels to the specified value.

false

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

false

When a call returns or completes its execution, the memory for the stack frame is reallocated.

false

When executing the print statement, Python first displays the value and then evaluates the expression.

false

When writing Python programs, you should use a .pyt extension.

false

Window components are laid out in the window's three-dimensional grid.

false

n Python, \b is a escape sequence that represents a horizontal tab.

false

string is an example of a data type in Python.

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 argument can be specified to the two file dialog functions in order to specify the available file types that can be used?

filetypes

A form ____ consists of labeled entry fields, which allow the user to enter and edit a single line of text.

filler

In the ____ process, a function called a predicate is applied to each value in a list. If the predicate returns True, the value passes the test and is added to a new list. Otherwise, the value is dropped from consideration.

filtering

In Python, functions can be treated as ____. This means that they can be assigned to variables (as they are when they are defined), passed as arguments to other functions, returned as the values of other functions, and stored in data structures such as lists and dictionaries.

first-class data objects

In Python, int, long, and ____ are called numeric data types.

float

In Python, what data type is used to represent real numbers between -10^308 and 10^308 with 16 digits of precision?

float

The iterator can be used to manipulate lists, strings, tuples, files, and dictionary, in the same way as a ____ loop.

for

The ____ color of a label or an entry field is its text color.

foreground

For each call of a function, the PVM must allocate on the call stack a small chunk of memory called a stack ____.

frame

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

If designed properly, a ____'s code captures an algorithm as a general method for solving a class of problems.

function

In a stack frame, the system places the values of the arguments and the return address for the particular ____.

function call

In a computer program, ____ can enforce a division of labor.

functions

___________ are functions that generate the requisite sequences Iterators Generators Classes Comprehensions

generators

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

getcwd()

A black-and-white photograph contains more than just the black and white colors, but various shades of gray known by what term?

grayscale

A(n) ____ layout allows the programmer to place components in the cells of an invisible grid in the window.

grid

If the existence of a key is uncertain, the programmer can test for it using the dictionary method ____.

has_key

One way in which functions serve as abstraction mechanisms is by ____.

hiding complicated details

____ programming languages resemble English and allow the author to express algorithms in a form that other people can understand.

high-level

A(n) ____ function separates the task of transforming each data value from the logic of accumulating the results.

higher-order

_ recursion arises when the programmer fails to specify the base case or to reduce the size of the problem in a way that terminates the recursive process.

infinite

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

input

Python is a(n) ____ language.

interpreted

The ____ operator returns True if self and other refer to the exact same object.

is

A list is a sequence of data values called ____.

items

The _______ function returns the iterator of the object passed as an argument

iter

In a loop, each repetition of the action is known as a pass or a(n) ____.

iteration

A ____ is a dictionary of functions keyed by command names.

jump table

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

jump table

In a function header, following the required arguments are one or more default or ____ arguments.

keyword

In GUI-based programs, ____ are text elements that describe the inputs and outputs.

labels

____ returns the number of elements in the list.

len(L)

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

lending

A comprehension contains the input sequence along with the expression that represents the ______.

members

Python's open function, which expects a file pathname and a ____ string as arguments, opens a connection to the file on disk and returns a file object.

mode

GUI-based programs adhere to the ____ pattern.

model/view

When ____ are introduced in a program, they are immediately given a value.

module variables

The condition in the if-else statement ____ be a Boolean expression.

must

Methods that allow a user to modify an object's state are called ____.

mutators

What statement accurately describes the analysis phase of the waterfall model?

n this phase, the programmers determine what the program will do.

In Python, a ____ is the area of program text in which the name refers to a given value.

name's scope

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())

The process of hiding a complex process by developing a mechanism to simplify or hide that process is known by what term?

obfuscation

A(n) ____ packages a set of data values—its state—and a set of operations—its methods—in a single entity that can be referenced with a name.

object

In Python, all classes automatically extend the built-in ____ class, which is the most general class possible.

object

Programming that relies on the use of objects and methods to control complexity and solve problems is known as what type of programming?

object-based programming

____ programming attempts to control the complexity of a program while still modeling data that change their state.

object-oriented

The ____ operator returns False if and only if both of its operands are false, and returns True otherwise.

or

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

When working with file systems, you can use the module variable ____ to obtain the appropriate slash symbol (/ or \) on the current file system.

os.sep

In carrying out the instructions of any algorithm, the computing agent transforms some given information according to well-defined rules, and produces new information, known as ____.

output

Python allows the programmer to ____ many of the built-in operators for use with new data types.

overload

In GUI terminology, a nested frame is sometimes called a ____.

pane

In GUI-based applications, groups of GUI-components can be nested in multiple ____ in a window.

panes

Pickled objects can be loaded into a program from a file using the function ____.

pickle.load

Python includes a module that allows the programmer to save and load objects using a process called ____.

pickling

To delete an entry from a dictionary, one removes its key using the method ____.

pop

A comprehension may also have an optional _______ expression.

predicate

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('\\')

1. Which of the following functions is a built-in function in python? a) seed() b) sqrt() c) factorial() d) print() seed() sqrt() factorial() print()

print()

The use of cooperating subprograms to solve problems is called ____ programming.

procedural

In a generator, the values are generated as and when we ______ pause compile proceed repeat

proceed

In a generator, the values are generated as and when we _______.

proceed

The _____(n) function generates numbers up to n.

range

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?

readline

A _ function is a function that calls itself.

recursive

A ____ function is a function that calls itself.

recursive

In _ design, you decompose a complex problem into smaller problems of exactly the same form.

recursive

In ____ design, you decompose a complex problem into smaller problems of exactly the same form.

recursive

A(n) ____ consists of equations that state what a value is for one or more base cases and one or more recursive cases.

recursive definition

The Fibonacci sequence is a series of values that can be easily calculated with what kind of function?

recursive function

In the ____ process, we take a list of values and repeatedly apply a function to accumulate a single data value.

reducing

What higher-order function takes a list of values and repeatedly applies a function to accumulate a single data value?

reducing

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

responsibility-driven design

At the top of a file-system tree is the ____.

root directory

In the case of infinite recursion, the stack frames are added until the PVM _.

runs out of memory

In the case of infinite recursion, the stack frames are added until the PVM ____.

runs out of memory

What string method can you use to locate the lowest index in a string named s where substring "findme" is found?

s.find("findme")

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

s.upper(), s.lower()

What are the two different means by which a floating-point number can be written? (Choose two.)

scientific notation, decimal notation

In Python, what is the term that is used to describe the area of a program text in which an object name refers to a given value?

scope

A flash memory stick is an example of what type of storage media?

semiconductor storage media

What EasyFrame method is used to specify if a window is resizable or not?

setEnableResize()

For each call of a function, the Python virtual machine must allocate a small chunk of memory on the call stack, which is known by what term? stack chunk stack frame data nibble memory slice

stack frame

What type of error is raised when the Python virtual machine runs out of memory resources to manage a process?

stack overflow error

As functions are developed to solve each subproblem, the solution to the overall problem is gradually filled out in detail. This process is also called _.

stepwise refinement

As functions are developed to solve each subproblem, the solution to the overall problem is gradually filled out in detail. This process is also called ____.

stepwise refinement

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

stepwise refinement

The ____ Grid attribute specifies how to distribute extra space in the widget's cell.

sticky

What attribute can be used to override the default alignment of a window component?

sticky

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(',')

What is the name for a diagram that shows the relationships among a program's functions and the passage of data between them?

structure chart

The Python interpreter rejects any statement that does not adhere to the grammar rules, or ____, of the language.

syntax

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

t.erase()

What Turtle method is used to move the Turtle object instance t to the center of the window, pointed east?

t.home()

____ can be performed easily from an IDLE window.

testing

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

true

An attempt to manipulate a turtle whose window has been closed raises an error.

true

An entry field is a box in which the user can position the mouse cursor and enter a number or a single line of text.

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

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

true

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

true

Computer scientists refer to the process of planning and organizing a program as software development.

true

Constructors are used to create new instances of a class.

true

Each item in a list has a unique index that specifies its position.

true

Expressions provide an easy way to perform operations on data values to produce other data values.

true

GUI-based programs are almost always object-oriented.

true

GUI-based programs can be configured to respond to various keyboard events and mouse events.

true

Generally, an object's state is the set of values of its attributes at any given point in time.

true

In a case of infinite recursion, the Python virtual machine eventually runs out of memory resources to manage the process, so it halts execution with an error message.

true

In general, a variable name must begin with either a letter or an underscore (_).

true

In top-down design, you decompose a complex problem into a set of simpler problems and solve these with different functions.

true

In turtle graphics, the color used is initially black.

true

Lists of strings can be displayed in list boxes.

true

Many image-processing algorithms use a nested loop structure to traverse a two-dimensional grid of pixels.

true

Modern software development is usually incremental and iterative.

true

Most recursive functions expect at least one argument.

true

Programmers who use objects interact with them through their interfaces.

true

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

true

Real numbers have infinite precision, which means that the digits in the fractional part can continue forever.

true

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

true

Recursive functions tend to be less complicated than the corresponding loops.

true

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

true

Sequences like geometric progression, Fibonacci series, etc., can be easily generated using generator.

true

Smart compilers exist that can optimize some recursive functions by translating them to iterative machine code.

true

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

true

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

true

The interpreter reads a Python expression or statement, also called the source code, and verifies that it is well formed.

true

The rectangular display area on a computer screen is made up of colored dots called picture elements or pixels.

true

The ticks representing seconds on the analog clock's face represent an attempt to sample moments of time as discrete values, whereas time itself is continuous, or analog.

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

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

true

Variables receive their initial values and can be reset to new values with an assignment statement.

true

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

true

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

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

true

"%6s" % "four" right-justifies the string by padding it with ____.

two spaces to its left

Python's ____ function is used to determine whether or not two objects are of the same type.

type

After you initialize a variable, subsequent uses of the variable name in expressions are known as ____.

variable references

A ____ is the period of time during program execution when the variable has memory storage associated with it.

variable's lifetime

The drawing of simple, two-dimensional shapes, such as rectangles, triangles, pentagons, and circles, is known as what type of graphics?

vector graphics


Ensembles d'études connexes

Chapter 4 | Strategic Management

View Set

Chapter 5 - Microbio of Pond Water

View Set

Laptop Hardware - CompTIA A+ 220-1001 - 1.1

View Set

ACE 346 Exam 2 Polling Questions

View Set

Earthquakes and Volcanoes Study Guide for Test

View Set