Python (Chapters 4,5 & 10)

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

There are always ________ steps that must be taken when a file is used by a program.

three

Some languages, such as Visual Basic, use ________ as the not equal to operator.

<>

In languages such as Java, Python, C, and C++ the ________ operator determines whether a variable is equal to another variable.

==

The ________ operator is used to determine whether the operands are exactly the same as each other.

==

The ________ operator could be used, in some situations, to simplify nested selection structures.

AND

The ________ operator requires both sub expressions to be true for the compound expression to be true.

AND

Which operator would make the following expression false? True ________ False

AND

What type of data file cannot be opened and viewed in an editor such as Notepad?

Binary file

The statements that appear between the While and the End While clauses are called the ________.

Body of the loop

________ expressions are named in honor of mathematician George Boole.

Boolean

What type of loop uses a Boolean expression to control the number of times that it repeats a statement or set of statements?

Condition-controlled

To ________ a variable means to decrease its value.

Decrement

True/False: A file with the extension .doc usually indicates that the file contains a note written by a doctor.

False

True/False: In a For loop, the programmer should know the exact number of iterations the loop must perform before writing the code.

False

True/False: In the For statement, you can only use positive integers as step values.

False

True/False: It is possible to write a complete program using only a decision structure.

False

True/False: Pseudocode could be logically incorrect if not properly indented.

False

True/False: The programmer has the option to append data anywhere in an output file.

False

True/False: The short-circuit evaluation is performed with expressions containing any logical operators.

False

True/False: The term "input file" is used to describe a file that data is written to.

False

True/False: The term "output file" is used to describe a file that data is read from.

False

What is a short sequence of characters that appears at the end of a filename and is preceded by a period called?

Filename extension

The ________ statement is specifically designed to initialize, test, and increment a counter variable.

For

Which loop is specifically designed to initialize, test, and increment a counter variable?

For

Which loop statement does not contain an increment statement but automatically increments the counter at the end of each iteration?

For

A case structure is a ________ alternative decision structure.

Multiple

If the expression is false, the ________ operator will return true.

NOT

The ________ operator is a unary operator, as it works with only one operand.

NOT

Which of the following operators reverses the logic of its operand?

NOT

In general, how many types of files are there?

two

The following loop will perform ________ iterations. For start = 6 To 2 Step -3

two

When writing a program to perform a file operation, there are ________ names that you have to work with in the program's code.

two

Programmers usually refer to the process of saving data to a file as ________ a file.

writing data to

True/False: The While loop gets its name from the way it works: While a condition is false, do some task.

False

Which structure causes a statement or set of statements to execute repeatedly?

Repetition

The ________ operator is best to determine whether a number is outside a range.

OR

Which operator would make the following expression true? False ________ True

OR

How many times will the following loop iterate? Set k = 1 Do Display k Set k = k + 1 Until k > 1

One

What type of operators are the following? > < >= <= == !=

Relational

The ________ represents a special value that marks the end of a list of values.

Sentinel

Consider the following statement: A store is giving a discount of 30% for all purchases of over $100. Which of the following is not the appropriate structure to use to program the statement?

Sequence

True/False: A While loop repeats infinitely when there is no statement inside the loop body that makes the test condition false.

True

True/False: A condition-controlled loop can be used to iterate the body of the loop a specific number of times.

True

True/False: A nested decision structure can achieve the same logic as a case structure.

True

True/False: When an input file is opened, the read position is initially set to the first item in the file.

True

When the ________ loop executes, the condition is tested; if it is true, the loop body is executed, and then the loop starts over; if the condition is false, the loop terminates.

While

Which pair of loops causes a statement or set of statements to repeat as long as a condition is true?

While and Do-While

True/False: Any loop that can be written as a Do-While loop can also be written as a While loop.

True

True/False: Decision structures are also known as selection structures.

True

True/False: In a text file, all data is stored as a series of characters.

True

True/False: In an expression with an OR operator, it does not matter which sub expression is true for the compound expression to be true.

True

True/False: Modules can be called from statements in the body of any loop.

True

In most languages, if a file with the specified external name already exists when the file is opened, the contents of the existing file will be ________.

erased

The ________ usually indicates the type of data stored in the file.

extension

In an If-Then-Else statement, the Else clause marks the beginning of the statements to be executed when the Boolean expression is ________.

false

When a program needs to save data for later use, it writes the data to a(n) ________.

file

Boolean variables are commonly used as ________, which indicate whether a specific condition exits.

flags

A(n) ________ structure is commonly known as a loop.

repetition

The ________ decision structure provides only one alternative path of execution.

single alternative

A(n) ________ file contains data that has been encoded as text, using one of the computer's encoding schemes.

text

The ________ symbol indicates that some condition must be tested in a flowchart.

diamond

The direct access file is also known as a(n) ________ access file.

random

The term ________ is used in the For loop if the counter needs to be incremented by a value other than one.

Step

The amount by which the counter variable is incremented in a For loop is known as what?

Step amount

What type of data file can be opened and viewed in an editor such as Notepad?

Text file

How many steps must be taken when a file is used by a program?

Three

How many times will the following loop iterate? For j = 1 To 5 Step 2 Display j End For

Three

In a count-controlled loop, the counter performs ________ action(s).

Three

The variable that is used to keep the running total in a loop is called a(n) ________ in programming.

accumulator

A condition is a ________ expression.

boolean

A(n) ________ expression evaluates as either true or false.

boolean

The ________ is a small holding section in memory.

buffer

When a program ________ a file, it disconnects the file from the program.

closes

When a web page is visited, the browser stores a small file on the user's computer, known as a ________.

cookie

A(n) ________-controlled loop repeats a statement or set of statements a specific number of times.

count

A count-controlled loop uses a variable known as ________ to store the number of iterations that it has performed.

counter variable

In a For loop a negative step value is used to ________ the counter variable.

decrement

A(n) ________ loop continues to repeat until the program is interrupted.

infinite

The total number of ________ of a nested loop is the product of the number of iterations of all the loops.

iterations or repetitions

In a count-controlled loop the test action compares the counter variable to the ________ value to determine if the loop iterates or terminates.

maximum

The word OutputFile indicates the ________ in which the file is used.

mode

A structure that has a loop that is inside another loop is called a(n) ________ loop

nested

The process of ________ a file creates a connection between the file and the program.

opening

An inner loop goes through all of its iterations for every single iteration of the ________ loop.

outer

The ________ file is used to describe a file that data is written to.

output

In flowcharting, the ________ symbol is used to read data from a file.

parallelogram

The Do-While loop is a(n) ________ loop.

posttest

In the ________ step the data is either written to the file or read from the file.

processing

Which operator is best to determine whether x contains a value in the range of 10 through 57?

AND

What two logical operators perform short-circuit evaluation?

AND and OR

The computer uses the ________ codes to accomplish string comparison.

ASCII

Which of the following software packages store data in files?

All of the above

Which of the following is a logical operator?

All of the above ("OR", "NOT" & "AND")

Which structure is a logical design that controls the order in which a set of statements executes?

Control

What is the terminology used when a task is temporarily interrupted as a control variable reaches a specific value?

Control break logic

________ contain information about the user's web browsing session.

Cookies

The following is an example of what type of loop? For k = 7 To maxValue

Count-controlled

Which type of data file access allows access to any piece of data in the file without reading the data that comes before it?

Direct access

The ________ loop is the best choice when you want to perform a task until a condition is true.

Do-Until

The loop that iterates as long as a condition is false and then stops when the condition becomes true is called a(n) ________ loop.

Do-Until

Which loop repeats a statement or set of statements as long as the Boolean expression is false?

Do-Until

Which of these are posttest loops?

Do-While and Do-Until

True/False: A posttest loop does not perform any iteration if the Boolean expression is false to begin with.

False

True/False: All types of data files are viewable in a text editor.

False

True/False: An If statement will produce unpredictable results if the programmer does not use proper indentations in pseudocode.

False

True/False: Data files are less and less needed in current gaming software.

False

True/False: The If-Then-Else statement should be used to write a single alternative decision structure.

False

True/False: The While loop will never execute if its condition is true to start with.

False

True/False: The data saved in a file will remain there even after the program stops running but will be wiped out when the computer is turned off.

False

True/False: The direct access file is similar to the way an MP3 player works: the player starts from the beginning.

False

True/False: The first line of the case structure starts with the word CASE followed by the test expression.

False

How many times will the following loop iterate? Set k = 1 While k < = 5 Display k End While

Infinite

What is the term used to describe a file that data is read from?

Input file

How many times will the following loop iterate? Set k = 1 While k > 5 Display k End While

No iterations

When a piece of data is written to a file, it is copied from a variable in ________ to the file.

RAM

In an input file, what maintains the location of the next item that will be read from the file?

Read position

Which flowcharting symbol is used for opening and closing files?

Rectangle

What type of operator can be used to determine whether a specific relationship exists between two values?

Relational

A loop that accumulates a total as it reads each number from a series is often said to keep a what?

Running total

________ access files are easy to work with, and you can use them to gain an understanding of basic file operations.

Sequential

Which type of data file access starts from the beginning of the file and proceeds to the end of the file?

Sequential access

True/False: A nested decision structure can be used to test more than one condition.

True

True/False: Although the sequence structure is heavily used in programming, it cannot handle every type of task.

True

True/False: The If-Then-Else statement can be used to simplify a complex nested decision structure.

True

True/False: The While and For loops are considered pretest loops because they test the condition before processing the statement(s) in the loop body.

True

True/False: The While loop is known as a pretest loop, which means it tests its condition before performing an iteration.

True

True/False: The conditions that control a loop repetition are Boolean expressions.

True

True/False: The sequential access file is similar to the way a cassette player works.

True

True/False: The use of a buffer increases the system's performance because writing data to memory is faster than writing to a disk.

True

When a program performs actions only under certain conditions, it is using a ________ structure.

decision

The statement(s) that immediately follow the ________ statement is executed if the test expression in the case structure does not match any case values.

default

The ________ symbol is used to represent a selection structure in flowcharting.

diamond

In a(n) ________ decision structure, one path is taken if a condition is true and the other path is taken if the condition is false.

dual alternative

The ________ marker indicates where the file's content ends.

end-of-file

When a program performs the task of retrieving data from a file, it is known as ________ data from/to the file.

reading

Data in a file is organized in ________, which are a complete set of data about an item.

records

When processing a long list of values with a loop, the program knows it has reached the end of the list when the ________ value is read.

sentinel

The expression with an AND operator ________ when the expression on its left is false and so it does not evaluate the expression on its right.

short circuits

In many languages the case structure is called a ________ statement.

switch

The ________ statement is commonly used in programming languages for case structure.

switch

The value of the ________ is compared with the values that follow each of the Case statements when a Select Case statement executes.

test expression

Which operator is used to determine that the operands are not exactly of the same value?

None of the above ( =!, =, ==, !)

Opening a(n) ________ file creates a file on disk and allows the program to write data to it.

Output

What type of file does the AppendMode work with?

Output file

What type of file does the AppendMode work with? Answer

Output file


Kaugnay na mga set ng pag-aaral

ASL- Greetings and some other signs

View Set

ECON 2302.1003 CHAPTER 2 OVERLOOK

View Set

INFECTION CONTROL/CHAIN OF INFECTION

View Set

Mental Health Pharmacology practice questions

View Set