Python Review Chapter 1-5 (T/F)
False
"A" < "B" evaluates to False.
False
.The remove file system function is included in the os.path module.
False
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.
True
A binary number is sometimes referred to as a string of bits or a bit string.
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.
False
A difference between functions and methods is that methods cannot return values
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 list is a sequence of data values called indexes.
False
A list is immutable.
True
A lookup table is a type of dictionary.
True
A method is always called with a given data value called an object, which is placed before the method name in the call.
False
A module behaves like a function, but has a slightly different syntax.
False
A program stored in computer memory must be represented in binary digits, which is also known as ASCII code.
True
A programmer typically starts by writing high-level language statements in a text editor.
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
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 a list's elements are always ordered by position, it is possible to impose a natural ordering on them as well.
True
Although the while loop can be complicated to write correctly, it is possible to simplify its structure and thus improve its readability.
False
An Identity function usually tests its argument for the presence or absence of some property.
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
Anytime you foresee using a list whose structure will not change, you can, and should, use a tuple instead.
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
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.
False
Data can be output to a text file using a(n) output object.
True
Each individual instruction in an algorithm is well defined.
True
Each item in a list has a unique index that specifies its position.
False
Exponentiation and assignment operations are left associative.
True
Expressions provide an easy way to perform operations on data values to produce other data values.
False
For the most part, off-by-one errors result when the programmer incorrectly specifies the lower bound of the loop.
False
If A is True, what will the statement "not A" return?
True
If pop is used with just one argument and this key is absent from the dictionary, Python raises an error.
True
In 1984, Apple computer brought forth the MAcintosh, the first successful mass produced personal computer with graphical interface.
False
In Python, = means equals, whereas == means assignment.
False
In Python, a floating-point number must be written using scientific notation.
True
In Python, all data values are objects
False
In Python, the programmer can force the output of a value by using the cout statement.
False
In a dictionary, a -> separates a key and its value.
True
In general, a variable name must begin with either a letter or an underscore (_).
False
In scripts that include the definitions of several cooperating functions, it is often useful to define a special function named init that serves as the entry point for the script.
False
In the 1930s, the mathematician Blaise Pascal explored the theoretical foundations and limits of algorithms and computation.
True
In the 1960s, batch processing sometimes caused a programmer to wait days for results, including error messages.
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
Informally, a computing agent is like a recipe.
False
Information is stored as patterns of bytes (1s and 0s)
True
Lists of integers can be built using the range function.
False
Loop statements allow a computer to make choices.
True
Magnetic storage media, such as tapes and hard disks, allow bit patterns to be stored as patterns on a magnetic field.
False
Many applications now use data mangling to protect information transmitted on networks.
True
Modern software development is usually incremental and iterative.
False
Moore's Law states that the processing speed and storage capacity of hardware will increase and its cost will decrease by approximately a factor of 3 every 18 months.
True
Programs rarely work as hoped the first time they are run.
False
Python is a loosely typed programming language.
True
Real numbers have infinite precision, which means that the digits in the fractional part can continue forever.
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.
False
Some applications extract portions of strings called characters.
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.
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 == 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 absolute value of a digit is determined by raising the base of the system to the power specified by the position (baseposition).
True
The algorithms that describe information processing can also be represented as information.
True
The assignment symbol can be combined with the arithmetic and concatenation operators to provide augmented assignment operations.
False
The augmented assignment operations have a higher precedence than the standard assignment operation.
True
The comparison operators are applied after addition but before assignment.
False
The cost of developing software is spread equally over the phases.
True
The decimal number system is also called the base 10 number system.
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.
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.
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 if-else statement is the most common type of selection statement.
False
The index of the first item in a list is 1.
True
The is operator has no way of distinguishing between object identity and structural equivalence.
False
The list method ascending mutates a list by arranging its elements in ascending order.
True
The main function usually expects no arguments and returns no value.
False
The median of a list of values is the value that occurs most frequently.
False
The modulus operator has the highest precedence and is evaluated first.
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.
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.
True
The part of a computer that is responsible for processing data is the central processing unit (CPU)
False
The simplest form of selection is the if-else statement.
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 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.
True
The two digits in the base two number system are 0 and 1.
False
The while loop is also called a sentinel-control loop, because its condition is tested at the top of the loop.
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
To prevent aliasing, a new object can be created and the contents of the original can be copied to it.
True
Using a text editor such as Notepad or TextEdit, you can create, view, and save data in a text file.
True
Variables receive their initial values and can be reset to new values with an assignment statement.
True
When replacing an element in a list, the subscript is used to reference the target of the assignment statement, which is not the list but an element's position within it.
True
When the Python interpreter evaluates a literal, the value it returns is simply that literal.
True
When the step argument is a negative number, the range function generates a sequence of numbers from the first argument plus 1.
False
When used with a single list argument, the function maximum returns the largest value contained therein.
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.
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.
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.
False
You cannot use the equality operator to compare two integer lists.
False
n Python, \b is a escape sequence that represents a horizontal tab.
False
string is an example of a data type in Python.