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

The while loop is a little different from the FOR loop, because it is used to repeat the loop as long as some conditions are TRUE. A WHILE loop will repeat as long as a boolean expression evaluates to TRUE.Here’s the syntax of WHILE loops:

while (boolean expression){  

<statement>;

}

Between the parentheses are the boolean expression. If that boolean expression evaluates to TRUE, all the statements between braces {}will be executed. When } is reached, the boolean expression will be evaluated again. This will happen over and over again until the expression doesn’t evaluate to TRUE. But to make the loop stop at one point, you have to change a value in the boolean expression. Only in that way can the boolean expression go from TRUE to FALSE. Here’s an example of a WHILE loop in Structured Text:

counter = 0;

while (counter < 10){

 counter = counter + 1;

 machine_status = counter * 10;

}

If you look at the third line you will see how the loop will eventually stop repeating.  The boolean expression uses the counter variable and checks if its value is less than 10. But since the value of counter is set to 0 right before the WHILE loop, the boolean expression will be TRUE unless counter is changed. That is what’s happening in line 3. This is the first statement in the WHILE loop, and with the other statements, are executed each time the loop repeats. In the third line the value of the counter variable is increased by 1. You can say that the incremental value is 1. In the example above, the loop will repeat 10 times. When the value of count reaches 10, the boolean expression will be evaluated to FALSE (because 10 is not less than 10) and the loop will stop.

You can also use the BREAK keyword in the WHILE loop to stop repeating the loop before the boolean expression is FALSE. The syntax is an IF statement with the BREAK keyword in. Place it anywhere between braces {}.

if (boolean expression) {

 break;

}

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

A condition-controlled loop can be used to iterate the body of the loop a specific number of times

A posttest loop does not perform any iteration if the Boolean expression is false to begin with

Any loop that can be written as a Do-While loop can also be written as a While loop

In the For statement, you can only use positive integers as step values

Modules can be called from statements in the body of any loop

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

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

The While loop is known as a pretest loop, which means it tests its condition before performing an iteration

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

The conditions that control a loop repetition are Boolean expressions

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

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

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

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

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

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

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

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

When an input file is opened, the read position is initially set to the first item in the file

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

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

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

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

The term "output file" is used to describe a file that data is read from.

The sequential access file is similar to the way a cassette player works.

The programmer has the option to append data anywhere in an output file.

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

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

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

In a text file, all data is stored as a series of characters.

All types of data files are viewable in a text editor

Data files are less and less needed in current gaming software

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

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

When an input file is opened, the read position is initially set to the first item in the file

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

Each instruction written in a high-level programming language is called a statement.

Computers are designed to do just one job.

Assembly language is referred to as a low-level language because it is close to the C++ language.

A computer system consists of all of the following, except ________

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

The process known as the ________ cycle is used by the CPU to execute instructions in a program

The main reason for using secondary storage is to hold data for long periods of time, even when the power to the computer is turned off.

The instruction set for a microprocessor is unique and is typically understood only by the microprocessors of the same brand.

The ________ coding scheme contains a set of 128 numeric codes that are used to represent characters in a computer's memory.

The CPU understands instructions in machine language, which are written in binary.

RAM is a volatile memory used for temporary storage while a program is running.

Programs that use an interpreter generally execute faster than compiled programs because they are already entirely translated into machine language when executed.

Programs that make a computer useful for everyday tasks are known as ________.

Most programs written in a high-level language need to be translated into machine language.

A bit that is turned off is represented by the value -1

The smallest storage location in a computer's memory is known as a ________.

The term used for a set of rules that must be strictly followed when writing a program is ________.

What function(s) does an interpreter perform with the instructions in a high-level programming language?

Which computer language uses short words known as mnemonics for writing programs?

Which of the following devices is a computer?

Which of the following is not an example of operating system software?

A ________ structure is a set of statements that execute in the order they appear.

A named constant can be assigned a value using a Set statement

A sequence of characters that is used as data is called a string in programming.

A variable is a storage location in memory that is represented by a name and can hold different values during the execution of the program.

A(n) ________ is a name that represents a value that cannot be changed during the program's execution.

An uninitialized variable is a variable that has been declared and automatically initialized to zero.

If you mistakenly write pseudocode into an editor for an actual programming language, such as Python or Visual Basic, errors will result

Most programming languages do not automatically print spaces between multiple items that are displayed on the screen

Ovals are used as terminal symbols marking the starting and end of the pseudocode.

Programmers start writing code as the first step when they begin a new project.

Programmers use pseudocode to create "mock-ups" of programs because they do not have to worry about syntax rules.

The ________ is a diagram that graphically depicts the steps that take place in a program.

The program development cycle is made up of ________ steps that are repeated until no errors can be found in the program.

The structure of the camelCase naming convention is to write the first word of the variable name in lowercase letters and then to capitalize the first character of the second and subsequent 

The value of the expression 12 - 4 * 3 / 2 + 9 is ________.

What is another term used for "desk checking"?

What is the informal language that programmers use to create models of programs that have no syntax rules and are not meant to be compiled or executed?

What symbol is used to mark the beginning and end of a string?

Which error produces incorrect results but does not prevent the program from running?

Which of the following is not a variable data type?

A case structure is a ________ alternative decision structure.

A nested decision structure can achieve the same logic as a case structure.

A nested decision structure can be used to test more than one condition

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

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

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?

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

It is possible to write a complete program using only a decision structure.

Pseudocode could be logically incorrect if not properly indented.

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

The If-Then-Else statement should be used to write a single alternative decision structure

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

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

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

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

Which pair of loops causes a statement or set of statements to repeat as long as a condition is true? The While loop is known as a pretest loop, which means it tests its condition before performing an iteration.

What type of loop uses a Boolean expression?

The while-loop uses a boolean test expression to control the run of the body lines.

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

A condition-controlled or sentinel loop uses a true/false condition to control the number of times that it repeats.

What type of loop executes a procedure as long as the test condition is true?

A for-loop always makes sure the condition is true before running the program.

zusammenhängende Posts

Toplist

Neuester Beitrag

Stichworte