Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/100

Click to flip

100 Cards in this Set

  • Front
  • Back
It is possible to create a while loop that determines when the end of a file has been reached.
True
The decision structure that has two possible paths of execution is know as ___________________.
Dual Alternative
The if statement causes one or more statements to execute only when a Boolean expression is true.
True
The \t escape character causes the output to skip over to the next horizontal tab.
True
The first line in the while loop is referred to as the condition clause.
False
The main reason for using secondary storage is to hold data for long periods of time, even when the power supply to the computer is turned off.
True
The integrity of a program's output is only as good as the integrity of its input. For this reason the program should discard input that is invalid and prompt the user to enter correct data.
True
In Python, there is nothing that can be done if the program tries to access a file to read that does not exist.
False
Where does a computer store a program and the data that the program is working with while the program is running?
Main Memory
Python uses the same symbols for the assignment operator and the equality operator.
False
Which list will be referenced by the variable number after the execution of the following code?
number = range(0, 9, 2)
​[0, 2, 4, 6, 8]
A(n) _____________ structure is a logical design that controls the order in which a set of statements execute.
Control
Unlike other languages, in Python the number of values a function can return is limited to one.
False
Words that have a special meaning and may be used only for their intended purpose are known as:
key words
In Python, the variable in the for clause is referred to as the _______ because it is the target of an assignment at the beginning of each loop iteration.
target variable
Decision structures are also known as selection structures.
True
What do you call the process of retrieving data from a file?
Reading data
Programmer-defined names of memory locations that may hold data are:
Variables
What does the following expression mean? X <= Y
x is less than or equal to y
When a file has been opened using the 'r' mode specifier, which method will return the file's contents as a string.
read
The following is an example of an instruction written in which computer language?
10110000
machine language
Nested decision structures are one way to test more than one condition.
True
Python comes with ____________ functions that have been already prewritten for the programmer.
standard
In Python the ___________ symbol is used as the equality operator.
==
Assume that the customer file references a file object, and the file was opened using the 'w' mode specifier. How would you write the string 'Mary Smith' to the file?
customer.write('Mary Smith')
What is the structure that causes a statement or a set of statements to execute repeatedly?
Repetition
An exception handler is a piece of code that is written using the try/except statement.
True
The _________ function reads a piece of data that has been entered at the keyboard and returns that piece of data, as a string, back to the program.
Input
When an if statement is placed within the conditionally-executed code of another if statement, this is known as:
Nesting
What symbol is used to mark the beginning and end of a string?
Quotation
An action in a single alternative decision structure is performed only when the condition is true.
True
Given the following function definition, what would the statement print magic(5) display?
def magic(num):
return num + 2 * 10
25
If a file with the specified name already exists when the file is opened, and the file is opened in 'w' mode then an alert will appear on the screen.
False
A better way to repeatedly perform an operation is to write the statements for the task once, and then place the statements in a loop that will repeat the statements as many times as necessary.
True
A(n) ____________ is a diagram that graphically depicts the steps that take place in a program.
Flowchart
The variable used to keep the running total is called a(n) _________.
Accumulator
What is the disadvantage of coding in one long sequence structure?
If parts of the duplicated code have to be corrected, the correction has to be made many times.
What is a group of statments that exists within a program for the purpose of performing a specific task?
Function
Which of the following is the correct if clause to determine whether y is in the range 10 through 50
if y > 10 and y < 50
The Python library functions that are built into the Python ______ can be used by simply calling the function.
interpreter
What does the following statement mean?
num1, num2 = get_num()
The function get_num() is expected to return a value each for num1 and num2.
Computer programs typically perform three steps: Input is received, some process is performed on the input, and output is produced.
True
Strings can be written directly to a file with the write method, but numbers must be converted to strings before they can be written.
True
What makes it easier to reuse the same code in more than one program?
Modules
Which mode specifier will erase the contents of a file if it already exists and create it if it does not exist?
'w'
In Python, the variable in the for clause is referred to as the _______ because it is the target of an assignment at the beginning of each loop iteration.
Global
___________ are used to translate each source code instruction into the appropriate machine language.
Compilers
A Boolean variable can reference one of two values: ___________________.
True or False
What is the result of the following statement?
x = random.randint(5,15) * 2
A random integer from 5 to 15, multiplied by 2, assigned to the variable x
Multiple Boolean expressions can be combined by using a logical operator to create ____________________ expression.
Compound
Which mode specifier will open a file but will not let you change the file or write to it?
'r'
A(n) _____________ is a set of instructions that the computer follows to solve a problem.
Program
What type of loop structure repeats the code based on the value of the Boolean expression?
​Condition-controlled loop
A(n) ___________ access file is also known as a direct access file.
random
What type of function can be used to determine whether a number is even or odd?
Boolean
A value-returning function is ________.
a function that will return a value back to the part of the program that called it
The Python standard library"s _______ module contains numerous functions that can be used in mathematical calculations.
math
Which of the following statements causes the interpreter to load the contents of the random module into memory?
import random
The __________ coding scheme contains a set of 128 numeric codes that are used to represent characters in the computer memory.
ASCII
Which language from the following list is referred to as a low-level language?
Assembly language
The hierarchy shows all the steps that are taken inside a function.
False
In a value-return function, the value of the expression that follows the key word _________ will be sent back to the part of the program that called the function.
return
What type of loop structure repeats the code a specific number of times?
Count-controlled loop
This is a complete instruction that causes the computer to perform some action.
Statement
What are the values that the variable num contains through the iterations of the following for loop?
for num in range(2, 9, 2)
2,4,6,8
Which method could be used to convert a numeric value to a string?
str
What type of value is returned by the functions random and uniform?
float
__________ is the process of inspecting data that has been input to a program to make sure it is valid before it is used in a computation.
input validation
Which logical operators perform short-circuit evaluation?
or, and
Reducing duplication of code is one of the advantages of using a loop structure.
True
Which of the following represents an example to calculate the sum of the numbers (accumulator)?
total += number
What is the format for the while clause in Python?
while condition :
These operators connect two or more relational expressions into one, or reverse the logic of an expression
logical
Which of the following will assign a random number in the range of 1 through 50 to the variable number?
number = random.randint(1, 50)
Which step creates a connection between a file and a program?
Open the file.
Both of the following for clauses would generate the same number of loop iterations:
for num in range(4):
for num in range(1,5):
True
Closing a file disconnects the communication between the file and the program.
True
Which method could be used to strip specific characters from the end of a string?
rstrip
When will the following loop terminate?
while keep_on_going != 999 :
When keep_on_going refers to a value equal to 999.
In Python, an infinite loop usually occurs when the computer accesses the wrong memory address.
False
Python comes with _________ functions that have been already prewritten for the programmer.
standard
Three primary activities of a program are:
input, processing, and output
An example of a secondary storage device is:
​a hard disk
The statements written by the programmer are called:
Source Code
What is not an example of an augmented assignment operator?
<=
The randrange function returns a randomly selected value from a specific sequence of numbers.
True
What type of file access jumps directly to any piece of data in a file without reading the data that came before it?
Random
In Python, an infinite loop usually occurs when the computer accesses the wrong memory address.
False
Computer programs are also known as:
software
Which of the following is the correct if clause to determine whether y is in the range 10 through 50?
if y > 10 or y < 50
The computer's main memory is commonly known as:
RAM
This is a set of rules that must be followed when constructing a program.
Syntax
What type of volatile memory is usually used only for temporary storage while running a program?
RAM
A(n) __________ variable is created inside a function.
Local
In a menu-driven program, what statement is used to determine and carry out the user's desired action?
if-elif-else
The first line in the function defintion is known as the function __________.
header
What does the term hardware refer to?
​the physical components that a computer is made of
A value-returning function is like a simple function except that when it finishes it returns a value back to the called part of the program.
True
Which of the following is not an integer?
3.0
What are the values that the variable num contains through the iterations of the following for loop?
for num in range(4)
0. 1, 2, 3