1/284
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
When the step argument is a negative number, the range function generates a sequence of numbers from the first argument down to the second argument plus 1.
True
What statement regarding precedence of operators is accurate?
The comparison operators (==, !=, <, >, <=, >=) are higher in precedence than the assignment operator (=).
The statements within a while loop can execute one or more times.
False
4 != 4 evaluates to True.
False
In programming, what is a prototype?
It is a rough draft of a program.
What is NOT a Boolean or logical operator used in the Python language?
xor
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
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 comparison operator is used to test whether an expression does NOT equal another expression?
!=
The not operator expects a single operand and returns its logical negation, True, if it's false, and False if it's true.
True
Loop statements allow a computer to make choices.
False
What part of the loop comprises the statements to be executed?
The loop body.
Some computer scientists argue that a while True loop with a delayed exit violates the spirit of the while loop.
True
What is a one-way selection statement in the context of Python?
It is a single if statement without a corresponding else statement used to test a condition and run statements, then proceed to the next statement.
In general terms, what does a selection statement do?
It allows a computer to make choices based on test conditions.
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
A condition expresses a hypothesis about the state of its world at that point in time.
True
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
The use of +=, -=, and *= are all examples of what type of operators?
augmented assignment operators
What character is used as the format operator when formatting output?
%
What is the minimum number of spaces that should be used to create an indented statement?
four spaces
In Python, = means equals, whereas == means assignment.
False
Although the while loop can be complicated to write correctly, it is possible to simplify its structure and thus improve its readability.
True
Given the following statement: "%4d" % var1, which of the following is accurate?
The variable var1 must be an integer value.
What scenario would it make logical sense to use a multi-way selection statement for?
You need to convert numeric grades to letter grades.
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
What function call will generate a random number in the range of 1 through 6 using the random module?
random.randint(1, 6)
What are the two different types of loops that are used within the Python language? (Choose two.)
indefinite iteration
predetermined looping
definite iteration
infinite cycling
indefinite iteration & definite iteration
For the most part, off-by-one errors result when the programmer incorrectly specifies the lower bound of the loop.
False
Conditional iteration requires that a condition be tested within the loop to determine whether the loop should continue.
True
The assignment symbol can be combined with the arithmetic and concatenation operators to provide augmented assignment operations.
True
"A" < "B" evaluates to False.
False
A while loop can be used for a count-controlled loop.
True
What is a count controlled loop?
It is a loop that counts through a range of numbers to control when the loop ends.
The or operator returns True if and only if both of its operands are true, and returns False otherwise.
False
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
The if-else statement is the most common type of selection statement.
True
An off-by-one error is an example of what type of error in programming?
logic error
The simplest form of selection is the if-else statement.
False
The augmented assignment operations have a higher precedence than the standard assignment operation.
False
The not operator has a lower precedence than the and and or operators.
False
The while loop is also called a sentinel-control loop, because its condition is tested at the top of the loop.
False
If A is True, what will the statement "not A" return?
False
The comparison operators are applied after addition but before assignment.
True
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.
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 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.
Real numbers have infinite precision, which means that the digits in the fractional part can continue forever.
True
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.
What are the two different means by which a floating-point number can be written? (Choose two.)
scientific notation
decimal notation
line notation
octal notation
scientific notation & decimal notation
What special character does the '\b' escape sequence generate?
It produces a backspace special character, which performs the same function as the backspace key.
The + operator allows you to build a string by repeating another string a given number of times.
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
What is the total number of distinct values in the ASCII set?
256
What effect does the following print statement have? print("Hello" * 5)
The print statement will produce "HelloHelloHelloHelloHello".
Testing is a deliberate process that requires some planning and discipline on the programmer's part.
True
Python is a loosely typed programming language.
False
A variable associates a name with a value, making it easy to remember and use the value later in a program.
True
Which of the following is NOT a valid name that can be used for a variable?
1ending
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
In Python, % is the exponentiation operator.
False
In general, a variable name must begin with either a letter or an underscore (_).
True
Expressions provide an easy way to perform operations on data values to produce other data values.
True
The design phase of the waterfall model is also called the coding phase.
False
Exponentiation and assignment operations are left associative.
False
How does the int function convert a float to an int?
By removing the fractional value of the number.
1,500 is a valid integer literal in Python.
False
string is an example of a data type in Python.
False
Text processing is by far the least common application of computing.
False
In Python, \b is a escape sequence that represents a horizontal tab.
False
A semantic error is detected when the action that an expression describes cannot be carried out, even though that expression is syntactically correct.
True
The modulus operator has the highest precedence and is evaluated first.
False
In Python, what data type is used to represent real numbers between -10^308 and 10^308 with 16 digits of precision?
float
What statement accurately describes the analysis phase of the waterfall model?
In this phase, the programmers determine what the program will do.
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
Modern software development is usually incremental and iterative.
True
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.
The cost of developing software is spread equally over the phases.
False
Which of the following functions and expressions will convert the ASCII character "Z" to its numeric equivalent ASCII code?
ord('Z')
Computer scientists refer to the process of planning and organizing a program as software development.
True
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.
In Python, what does the "%" operator do in the expression 6 % 4?
It returns a remainder or modulus.
Functions that are always available in Python come from what module?
__builtin__
Programs rarely work as hoped the first time they are run.
True
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 the waterfall development model, what is the most expensive part of software development?
The maintenance phase.
Which of the following literals would be considered a float type in Python?
3.14
What print statement will output a single '\' character?
print(‘\\’)
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
In evaluating the precedence rules used by Python, what statement is accurate?
Exponentiation has the highest precedence.
What function can you call inside of IDLE to show the resources of the math module, once it has been imported?
dir(math)
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.
Ancient mathematicians developed the first algorithms.
True
What technology replaced the vacuum tube as the mechanism for implementing electronic switches in computer hardware?
transistor
In a computer, what component is known as the "processor"?
CPU
A program stored in computer memory must be represented in binary digits, which is also known as ASCII code.
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
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 program is used by a programmer to convert high-level code into executable code?
translator