Software Design

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

In the following numeric expression 4 * a + 7 / (x - y) + (n ** 3) what is evaluated first? -(n**3) -4*a -a+7 -(x-y)

(x-y)

The first row of cells is referred to as row __________

0

A function header must end with a(n) _________.

:

What is the output of the following Python code? K = [ Larry , Curly , Mo ] print(type(K))

<class 'list>

A grid consists of rectangles called __________

Cells

What function do you use to terminate a connection to a file?

Close

Writing Python statements is called _______________.

Coding

Conditions that use the logical operators are called ____________ conditions.

Compound

Combining two strings to form a new string is called ____________. -concatenation -joining -stringing -slicing

Concatenation

True or false: "In the program development cycle, the first step in writing instructions to carry out a task is to determine how to process the input to obtain the desired output."

False

True or false: A class must contain at least one accessor method

False

True or false: A class must contain at least one mutator method

False

True or false: A function cannot call another function.

False

True or false: A try statement can include more than one else clause that follows the except clauses

False

True or false: A try statement cannot end with a finally clause

False

True or false: As a rule, functions should perform many tasks to be efficient.

False

True or false: Continue statements cannot be used with if-statements.

False

True or false: Each object of a class will have the same values

False

True or false: Indentation is not semantically meaningful in Python.

False

True or false: Items in a list may not include a user-defined class

False

True or false: Iterative solutions usually execute slower than recursive solutions

False

True or false: List comprehension cannot be applied to arithmetic progressions generated by range functions.

False

True or false: The default mode for opening a file is writing

False

True or false: The else part of an if statement cannot be omitted.

False

True or false: The parameter self is a reserved word in Python

False

True or false: The relational operators cannot be applied to lists or tuples.

False

True or false: The sort method does not actually alter the order of the items in a list.

False

True or false: The sorted function can only be used with lists.

False

True or false: The text in a Label widget cannot consist of more than one line

False

True or false: When a runtime error occurs, it is the responsibility of the user to correct it

False

True or false: When an argument to a function is an expression, the expression is not evaluated until it is passed to the function body.

False

True or false: When attaching scroll bars to list boxes, you must declare the list box before the scroll bar

False

True or false: When indenting a block of statements for an if-else statement, as long as the statements are indented to the right enough to visually see, the number of spaces for each line does not have to be exactly the same.

False

True or false: When the break statement is executed, the loop terminates after the body has finished executing.

False

True or false: isinstance(55.3, int)

False

True or false: planning a solution to a problem is called coding.

False

Each piece of data in a CSV file record is referred to as a(n) __________

Field

Python has an object called _________ that is used to denote a lack of value.

None

What happens when a user enters more characters in an Entry box than was specified in the creation of the widget?

Text scrolls to the left

True or false: A class is a template from which objects are created

True

True or false: A subclass can change the behavior of an inherited method

True

True or false: Any problem that can be solved with recursion can be solved with iteration

True

True or false: Bad user input can cause runtime errors

True

True or false: De Morgan s law can be applied from left to right or from right to left.

True

True or false: Every TUI program can be converted to a GUI program

True

True or false: Flowcharts are time-consuming to write and difficult to update.

True

True or false: Functions can return any type of object.

True

True or false: If a file that already exists is opened for writing, the contents of the file will be erased

True

True or false: In order for two tuples to be equal, they must have the same length and corresponding items must have the same value.

True

True or false: Instance variables are also called properties of an object

True

True or false: It is a poor programming practice to directly access class instance variables outside of the class

True

True or false: List boxes containing long lists are typically filled from files

True

True or false: List comprehension can be applied to tuples.

True

True or false: Pseudocode is typically more compact than a flowchart

True

True or false: Python is considered a block-structured language.

True

True or false: Python requires all programs be saved as a file on a storage device before they can be executed.

True

True or false: Recursive solutions often require less code than iterative solutions

True

True or false: The isinstance function can be applied to both built-in and user-defined functions

True

True or false: The remove and rename functions cannot be used with open files

True

True or false: The value of set() is the empty set

True

True or false: The word disk is often used to refer to any storage device.

True

True or false: The words "if" and "else" are reserved words.

True

True or false: Two sets are equal if they contain the same elements

True

True or false: Widgets are objects

True

True or false: infile is a descriptive name bot not mandatory for file input usage

True

True or false: not((x < 0) or word.isalpha()) is the same as not(x < 0) and not(word.isalpha())

True

True or false:A try statement can control more than one except clause

True

When a function returns 2 or more values it is actually returning a(n) _________.

Tuple

Which method provides a customized way to represent the state of an object as a string?

_ _ str _ _

A widget can respond to -mouse clicks -key presses -mouse movements -all of the above

all of the above

Hierarchy charts are also called: structure charts top-down charts visual table of content charts

all of the above

The parentheses of the range function can contain ____________ values. -one -two -three -all of the above

all of the above

The sorted function can be used with _________. -lists -tuples -strings -all of the above

all of the above

To move through a list box, use the __________ -page down key -page up key -down arrow key -all of the above

all of the above

What advantage is there to using functions in programming? -The eliminate repetitive code -They let the programmer first focus on the tasks, then later how to accomplish each task. -they break complex problems into smaller problems -all of the above

all of the above

Why do programmers use top-down design and structured programming? -it leads to programs that are easier to read -it tends to produce programs containing fewer initial errors -it increases productivity -all of the above

all of the above

After all the lines of a file have been read, the readline method returns __________

an empty string

Class definitions can contain __________ methods

an unlimited number

In Turtle graphics, the white region inside the Window is called the __________

canvas

Which function returns the single-character string of the character with ASCII value n for nonnegative numbers?

chr(n)

What type of method is called when an object is created?

constructor

The ____________ statement causes the current iteration of the body of a loop to terminate and execution returns to the loopÕs header.

continue

In Turtle graphics, the tail of the turtle is initially _________

down

In Turtle graphics, the turtle is initially facing __________

east

When an if-else statement needs to allow for more than two possible alternatives, you use a(n) ____________ clause

elif

Boxes that appear in the GUI window are called __________ widgets

entry

When reading data from a file, the open function returns a(n) __________

file object

Methods in a class have self as their __________ parameter

first

A ____________ is a Boolean-valued variable used to report whether a certain circumstance has occurred.

flag

The parameters in a function definition are also called _________ parameters.

formal

A variable that can be recognized everywhere in the program is called a _________ variable.

global

A(n) __________ is an imaginary rectangle containing horizontal and vertical lines that subdivide in into rectangles

grid

Which geometry manager is the easiest to learn?

grid

Which geometry manager produces the nicest layouts?

grid

In the Listbox widget, which attribute specifies the number of lines that can appear in the list box at one time?

height

Which programming tools is used to show how the different parts of a program relate to each other?

hierarchy chart

__________ recursion results when two procedures call each other

indirect

A(n) ____________ loop is one that never ends.

infinite

The statement object = className(arg1, arg2, )

inherit

Using a while loop to ensure a proper response is received from a request is called ____________.

input validation

A specific literal from a built-in classes is called a(n) __________

instance

Text that is displayed to the left of a box is contained in a(n) __________ widget

label

The following statement is an example of _________. [int(num) for num in listOfNums]

list comprehension

A variable created inside a function is called a _________ variable.

local

Function parameters have _________ scope. -no available -global -local -all of the above

local

A part of a program that executes a block of code repeatedly is called a(n) ____________.

loop

Which standard library module contains trigonometric, exponential, and logarithmic functions?

math

When one loop is contained in the body of another loop, it is said to be ___________.

nested

Which standard library module do you need to import in order to use the remove and rename functions for files?

os

Each execution of the body of a loop is called a(n) ____________.

pass

The ____________ statement is a do-nothing statement.

pass

In order for Python to use functions to work with binary files, you must first import which standard library module?

pickle

Which geometry manager provides complete control in the positioning of widgets?

place

Each line of a CSV file is referred to as a(n) __________

record

A function that calls itself is called __________

recursive

A function is said to _________ its output.

return

A program is said to be __________ if it performs well under atypical situations

robust

The _________ of a variable is the portion of the program that can refer to it.

scope

A(n) __________ is an unordered collection of items with no duplicates

set

A sequence of consecutive characters from a string is called a(n) ____________. -slice -run -group -cut

slice

Computer programs are referred to as ________________.

software

Instructions ins a Python program are called _______________.

source code

Which method turns a single string into a list of substrings? -slice -split -join -splice

split

Repeatedly using a "divide-and-conquer" approach to break up a large problem into smaller subproblems is called _________.

stepwise refinement

Which attribute is used to change the placement of a widget inside a cell in the grid geometry manager?

sticky

Which attribute is used to enlarge a widget so that it fills an entire cell in the geometry manager?

sticky

The statement set1.intersection(set2) is:

the set containing the elements that are in both set1 and set2

The statement set1.union(set2) is:

the set containing the elements that are in either set1 and set2 without duplicates

The statement set1.difference(set2) is:

the set containing the elements that are in set1 with the elements of set2 removed

A robust way to explicitly handle exceptions is to protect code with a(n) __________ statement

try

Which standard library module are turtle graphics object and methods imported from?

turtle

To avoid a potential runtime error when opening files for reading or writing:

use the os.path.isfile function

A ____________ is any person who runs a program.

user

What Python loop repeatedly executes a block of statements as long as a certain condition is met?

while

In the Listbox widget, which attribute specifies the number of characters that can appear on each line?

width

What is the output of the following Python statement? print (set ( bookkeeper ) )

{'b', 'o', 'k', 'e', 'p', 'r'}

In a function call, the items inside parentheses are called _________.

Arguments

True or false: "In a hierarchy chart, details on how modules work should be included."

False

How many items does a List Box hold by default?

10

If the value of n is 3.14159, the function round(n) will return ____________. - 3.1 -a logic error -3 -a syntax error

3

In Python, you create a comment with the character(s) ____________. -# -## -// -a or b

A or B

What type of methods are used to retrieve the values of instance variables?

Accessor

The arguments in a function call are called _________ parameters.

Actual

In Python, variable names may consist of ____________. -letters -digits -underscores -all of the above

All of the above

When using inheritance to define a new class, the new class is called a __________ -subclass -derived class -child class -all of the above

All of the above

Which one of the following is a reserved word? -try -finally -except -all of the above

All of the above

Why would you write a recursive solution to a problem? -they are easier to read -they often generate less code -they are more elegant -all of the above

All of the above

Which one of the following is not a high-level language? -python -visual basic -java -assembly language

Assembly language

Which exception flags an error from unavailable functionality that is requested for an object?

AttributeError

In inheritance, the existing class that is used to create a subclass from is called a __________

Base class

In Python, variable names may begin with ____________. -a letter -an underscore -both a & b -none of the above

Both a & b

What happens when a runtime error occurs that the programmer has not explicitly addressed with exception handling code? -a traceback error message is displayed -the program terminates -a and b -none of the above

Both a and b

What is the Entry widget used for? -obtain input from the user -display output to the user -both a and b -none of the above

Both a and b

When are the contents of the buffer written to disk? -when the file is closed -when the buffer is full -both a and b -none of the above

Both a and b

Which of the following is an example of a runtime error? -invalid input data -file cannot be accessed -both a and b -none of the above

Both a and b

In Turtle graphics, the write method displays a string with the __________ corner of the string approximately at the current position of the pen

Bottom-left

The ____________ statement causes an exit from anywhere in the body of a loop.

Break

Python uses a(n) __________ as a temporary holding place for data to be written to disk

Buffer

An error in a program is called ________________.

Bug

What type of classes in Python are str, int, float, list, tuple, dictionary and set?

Built-in

What do you call runtime errors that usually occur due to circumstances beyond the programmer's control?

Exceptions

When as much implementation detail as possible in a program is hidden, it is called __________

Data Hiding

"In a flowchart, the representation of instructions that require a ""yes"" or ""no"" answer is called a(n)"

Decision structure

Functions that do not return values _________.

Do not have return statements

The process of bundling together data and methods while hiding the implementation of the methods is called __________

Encapsulation

_________ is a mechanism in Python that allows the programmer to recover from errors that occur while a program is still running

Exception Handling

Because each string holds its own value, all strings do not have the same methods

False

Child classes normally have all the characteristics of their parents, but less functionality

False

Every GUI program can be converted to a TUI program

False

Which programming tool graphically depicts the logical steps to carry out a task and show how the steps relate to each other?

Flowchart

The ____________ loop is used to iterate through a sequence of values.

For

What is the feature called in Python that allows us to define a new class that is a modified version of an existing class?

Inheritance

An attempt to open a nonexistent file for input:

Generates a runtime error

The mechanical and electrical devices of a computer are referred to as ______________.

Hardware

In a while loop, the line beginning with while is called a(n) ____________.

Header

In a dictionary, a pair such such as dog : rover is called a(n) __________

Item

_________ are file that facilitate the reuse of functions.

Library modules

When an if-else statement contains other if-else statements, it is said to be ____________.

Nested

In Turtle graphics, what does the statement t.hideturtle() do?

Makes the chevron visible

What type of methods are used to assign new values to the instance variables?

Mutator

Which exception flags an error when the value of a variable cannot be found

NameError

If a method defined in the subclass has the same name as a method in its superclass, the child's method will __________

Override the parent's method

In order for Python to use functions to work with binary files, you must first import which standard library module?

Pickle

In Turtle graphics, points on a canvas are called __________

Pixels

When two classes use the same method name, it is called __________

Polymorphism

In a function definition, arguments passed by position must _________ arguments passed by keyword.

Precede

In a function definition, the parameters without default values must _________ the parameters with default values.

Precede

A sequence of instructions is called a(n) _______________ .

Program

Which programming tool uses English-like phrases with some Python terms to outline the task?

Pseudocode

In Python, the numbers generated by the random module are said to be __________

Pseudorandom

The default mode for opening a file is

Reading

Each line of a CSV file is referred to as a(n) __________

Record

When Python stops evaluating a compound condition with the logical and operator because a condition evaluates to False, it is called ____________ evaluation.

Short-circuit

What is the default color of the Label widget?

The background color of the window

If a file that already exists is opened for writing:

The contents of the file will be erased

When an if-elif-else statement is evaluated, which block of statements is evaluated?

The first condition satisfied

What happens to empty rows in a List Box?

They are discarded

If two variables with the same name are created in two different functions _________.

They have no relationship to each other

Classes for widgets are defined in which module?

Tkinter

What is the ReadOnly Entry widget used for?

To Display Output

A child class that is a specialization of the parent class is said to have an "is-a" relationship

True

Given x = 5, y = 7 and z = "kitten" what does the following condition evaluate to? (x + y) / 2 == len(z)

True

Which exception flags an error when the function or operator receives the wrong type of argument?

TypeError

When does recursion end?

When a base case is reached

__________ are the components of a graphical user interface

Widgets

Elements of a set are delimited with __________

{}


Set pelajaran terkait

chapter 61: caring for clients requiring orthopedic treatment prepu

View Set

Chapter 14: Statute of Frauds and Equitable Exceptions

View Set

Historia Contemporánea -finales XVIII hasta 1945- (crisis del Antiguo Régimen hasta Segunda Guerra Mundial incluida)

View Set

6.59 Greek Philosophers: Socrates, Plato, and Aristotle

View Set

Chapter 8: Political Geography AP Human Geography Rubenstein

View Set

La Casa De Los Espíritus Chapt. 1 1/2

View Set