Chapter 6

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

All while loops should be converted into for loops

False

Iterative solutions are always better than recursive ones

False

No semi-colon is used after the loop control expression for a do while loop

False

The gcc compiler as used on the guru.itap.purdue.edu server this semester will permit a variable to be declared and initialized in the first expression of a for loop

False

The only way to stop a program caught in an infinite loop is to shut down your terminal software

False

The short-circuit method of evaluating logical expressions does not apply to loop control expressions

False

The update expression of a for loop may only make use of the addition or subtraction operator (includes ++, --, +=, -=, +, -)

False

In an event-controlled loop we know the number of times that the actions found inside the body of the loop will be executed

False (counter-controlled)

A counter controlled loop may execute a constant number of iterations

True

A limited amount of control structures are permissible in the main function to ensure that it is the main function which makes most of the function calls for a program

True

A nested loop is a repetitive process contained inside of another repetitive process

True

A repetitive function is defined as iterative whenever the definition involves only the parameters and not the function itself

True

A repetitive function is defined as recursive whenever the function appears within the definition itself

True

According to the course standards a for loop should only be used with counter-controlled processes.

True

According to the course standards if all three expressions are not needed in a for loop then you should instead make use of a while loop for your pretest looping needs

True

An infinite loop is a logical error

True

An iteration is one execution of all statements found inside of a loop

True

An iterative solution involves the use of a loop

True

An iterative solution is one that is implemented using a looping construct

True

Any statement, even another for loop, can be included in the body of a for loop

True

Control-forcing statements such as break, continue, exit, and the use of multiple return statements in a user-defined function are prohibited by course standards as mechanisms to terminate repetitive processes

True

Every recursive call must either solve part of the problem or reduce the size of the problem

True

Functions that make use of loops can vary widely in efficiency

True

If you think you need to make use of the continue statement then your algorithm may not be well structured

True

In a post-test loop the minimum number of times that the statements found inside of the loop are executed is one

True

In a pretest loop the control expression is evaluated before each iteration, including the first iteration

True

It is not recommended coding technique to update the loop control variable in the body of a for loop rather than making use of the third expression

True

It is possible for the number of times a counter-controlled loop with iterate to depend on the value of a single variable or expression

True

No semi-colon is used after the loop control expression for a while loop

True

One approach to potentially make solving problems that require nested loops easier is to separate each repetitive process into its own function

True

Recursion is a repetitive process in which a function calls itself

True

Recursion should not be used with event-controlled processes as the result may be more function calls than the memory of the computer can accommodate

True

Recursive solutions may involve heavy use of the limited resources of the computer because they involve a potentially large number of function calls

True

Recursive solutions may require heavy use of the limited resources of the computer because they involve a potentially large number of function calls

True

The ability to complement a logical expression is important because programmers often consider what must happen for a loop to terminate rather than the conditions that should keep it going

True

The action that is responsible for changing the result of the loop control expression from true to false is the loop update

True

The condition in a recursive function when which the recursive function calls stop is known as the base case

True

The condition that determines whether iteration is to continue in a loop is known as the loop control expression

True

The contents of a loop have been identified to be repeated in a program

True

The do while loop is commonly used in the process of data validation

True

The do while loop will test the loop control expression after the execution of the statements found inside the body of the loop

True

The efficiency of an algorithm is one measure to determine when one solution should be preferred to another

True

The first expression in a for loop is to initialize the loop control variable

True

The for loop is used when a loop is to be executed a known number of times

True

The for loop is usually for counter-controlled processes

True

The initialization of the loop control variable must take place outside (before) a pretest loop

True

The loop control variable is commonly a part of the loop control expression and the recipient of the loop update action

True

The number of times that the loop control expression is evaluated is one more than the number of iterations in a pretest loop

True

The second expression in a for loop is the loop control expression

True

The third expression in a for loop is the update expression that changes the loop control variable

True

The update to the loop control variable is responsible for terminating the loop because it will eventually result in the loop control expression being false

True

The work done in preparation for a loop is known as loop initialization

True

This for loop will iterate 10 times: for(i = 0; i < 10; i++)

True

This for loop will iterate 5 times: for(i = 12345; i != 0; i /= 10)

True

This for loop will iterate 6 times: for(i = 1; i <= 32; i * 2)

True

You can make use of x++, ++x, x += 1, and x = x + 1 interchangeably as the update (third) expression of a for loop to increment the loop control variable

True


Set pelajaran terkait

MGMT 320 Chapter 12 Connect Click and Drag

View Set

Positive and Negative Punishment

View Set

Chapter 18: Respiratory Disorders Questions

View Set

Drugs, Alcohol, and Tobacco- Class Notes

View Set

Astronomy: Facts on Earth and Mars

View Set