CS 159 (Lab 9)

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/16

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

17 Terms

1
New cards

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

True

2
New cards

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

3
New cards

All while loops can be converted into for loops that abide by course standards.

False

4
New cards

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

5
New cards

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

6
New cards

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

False

7
New cards

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

True

8
New cards

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

True

9
New cards

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

False (i goes 7 times)

10
New cards

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

expressions.

False

11
New cards

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

True

12
New cards

The condition in a recursive function when which the recursive function calls stop is

known as the base case.

True

13
New cards

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

True

14
New cards

A large number of recursive function calls may result in a crash due to running out of

memory.

True

15
New cards

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

True

16
New cards

Recursive solutions may involve heavy use of the limited resources of the computer

because they involve a potentially large number of function calls.

True

17
New cards

Iterative solutions are always better than recursive ones.

False