CS 159 Exam 2

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

A reasonable effort should be made to convert most while loops into for loops

False

Declaration and definition of an array will include a default initialization of all elements

False

Each switch case label is the keyword case followed by a constant expression inside single quotes

False

If the number of values provided for initialization of an array is less than the size of the array then the remaining elements have no known value

False

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

False

In order for two, or more, repetitive processes to be considered nested they must appear in the same user-defined function

False

In this course you will be expected to validate for the input of both the range of acceptable values and the correct data type

False

It is always a logical error to associate two switch case labels with a common set of actions

False

Iterative solutions are always better than recursive ones

False

The address operator is not necessary in a scanf to accept input for an individual array element when using the indexing technique

False

The following expression is used to generate a positive integer value in the range from x to y (inclusive), rand( ) % (y - x) + x

False

The gcc compiler as used on Vocareum this semester will permit a variable to be declared and initialized in the first expression of a for loop

False

The maximum number of actions that can be associated with a switch case label is one

False

The number of times the update action is executed is equal to the number of times the loop control expression is evaluated in a for loop

False

The only way to complement a NOT operator is with another NOT operator

False

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

False

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

False

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

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 iteration is one execution of all statements found inside the body of a loop

True

An iterative solution involved the use of a loop to solve a repetition problem

True

Array declarations will determine the type, name, and size of the array

True

Arrays must be declared and defined before they can be used

True

Associated with a case label is zero or more executable statements

True

Complementing a condition is one way to potentially remove negative logic from an expression

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

For a value to be potentially used as an index it must be an integral value or an expression that evaluates to such

True

In a fixed-length array the size of the array is known when the program is written

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

In an else-if the if condition is evaluated first and additional else-if conditions are evaluated until a condition is found to be true

True

Input validation is an example of an event-controlled problem

True

It is expected for many cases that the code for the validation of input be found in the same function that contains the prompt for input and scanf statement

True

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

True

It is possible to indicate on a structure chart when a user-defined is called from within a section construct

True

It is possible to update/change/alter the loop control variable of a for loop inside of its body

True

Negative logic refers to any expression that begins with a NOT operator or that contains multiple NOT operators within

True

No two switch case labels can represent the same constant expression value

True

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

True

Only the statements associated with the first true condition are executed in a multiway else-if construct

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

Selection by itself is insufficient for input validation because it provides only a finite number of opportunities for the user to input valid data

True

Similar to their required use in the if construct it is a course standard to always make use of { and } with all looping constructs

True

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

True

The break statement results in the control of the program exiting the switch statement

True

The case label represents an integral type value that is a possible result of the control expression

True

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

True

The condition that determines whether the task to repeat is finished is known as the loop control expression

True

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

True

The control expression that follows the keyword switch may be a character expression

True

The course standards limit the use of the break statement to only switch statements

True

The do-while loop will terminate with a semicolon after its loop control expression

True

The else does not have a condition associated with it

True

The else is executed only when all previously evaluated conditions are false

True

The first random number generated is based on a seed, either the default provided by the system or one specified by the programmer

True

The index value represents an offset from the beginning of the array to the element being referenced

True

The initialization of the loop control variable must take place outside the body of 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 name of an array is a reference to the address of where it begins inside the memory of the computer

True

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

True

The random number function returns an integer between 0 and RAND_MAX, which is defined in the stdlib.h library as the largest number that rand can generate

True

The srand function creates the starting seed for a number series based on the value it receives

True

The srand function must be called only once for each random number series

True

The switch construct can only be used when the selection condition reduces to an integral expression

True

The while loop requires the use of parentheses around the loop control expression

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

To generate a random integer in a range x to y, we must first scale the number and then, if x is greater than 0, shift the number within the range

True

When accessing an array element the C language does not check whether the index is within the boundary of an array

True

When the selection is based on a range of values, or the condition is not integral, we use the else-if for our multiway selection needs

True

When the statements associated with one case have been executed the program flow continues with the statements for the next case

True

When writing a selection construct the most probable conditions should come before those that occur less frequently

True

While each call to the rand function returns the next integer in the series, the srand function is a void function

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


संबंधित स्टडी सेट्स

HW11: Homework - Ch. 11: Costs and Profit Maximization Under Competition

View Set

ATI PN Pharmacology Proctored Exam Review, ati proctor med surg, ATI

View Set

(Ch. 2) Texas Principles of Real Estate Part 2

View Set

Criminal procedure MBE questions

View Set

Documentation and Interprofessional Communication

View Set

World History II - Semester Exam Review

View Set

Ch. 1 Diversity Amid Globalization Practice Test

View Set