Exam 5: Looping

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What are the block of statements that are executed in a loop considered to be part of?

Free
(Multiple Choice)
4.8/5
(41)
Correct Answer:
Verified

A

What is a garbage value in the C# programming language?

Free
(Multiple Choice)
4.7/5
(32)
Correct Answer:
Verified

A

Why is it important to initialize an accumulator variable?

Free
(Essay)
4.8/5
(35)
Correct Answer:
Verified

Assume you have an accumulator variable called total.It is very important that total is initialized to 0.When it is not, the program will not compile.When total is not initialized, it might hold any value.The value could be 0 by chance, but it also could be any other value that happens to be located at the memory address of total.An unknown value is known as garbage.The C# compiler prevents you from seeing an incorrect total by requiring you to provide a starting value; C# will not use the garbage value that happens to be stored at an uninitialized memory location.

When using nested loops, what loop is contained entirely within an outer loop?

(Multiple Choice)
4.7/5
(35)

A value such as a 'Y' or 'N' that must be supplied in order to stop a loop is known as what type of value?

(Multiple Choice)
4.9/5
(37)

Write two code segments that print the integers 1 through 10.One segment should use a while loop and the other should use a for loop.

(Essay)
4.9/5
(38)

Statements in a while loop or for loop body can be blocked.Write a for loop that displays Hello and Goodbye four times each using a blocked loop body.

(Essay)
5.0/5
(35)

You are writing a program that defines a variable within a loop, and then tries to use that variable outside the loop.However, the program does not run as intended.What is the issue?

(Multiple Choice)
4.9/5
(32)

A loop that is controlled by user input rather than altered by arithmetic is known as what type of loop?

(Multiple Choice)
4.8/5
(32)

What keyword(s) should you use to initiate a for-loop in C#?

(Multiple Choice)
4.7/5
(31)

When writing a while loop, how can you ensure that it will end correctly?

(Essay)
4.8/5
(33)

Loops that are controlled by reducing a variable are utilizing what type of loop control variable?

(Multiple Choice)
4.8/5
(32)

Why do event-driven GUI programs sometimes require fewer coded loops than their counterpart console applications?

(Multiple Choice)
4.8/5
(37)

Suppose a loop should execute while x is less than the sum of two integers, a and b.The loop could be written as: while(x < a + b) // loop body Although this code fragment will run, it is not particularly efficient.In what way is it inefficient, and how could you improve the loop's performance?

(Essay)
4.8/5
(40)

A bug has resulted in your program executing an infinite loop.What key can be pressed in conjunction with the C or Break (Pause) key to escape the loop?

(Multiple Choice)
4.9/5
(37)

What is any single execution of a loop referred to as?

(Multiple Choice)
4.8/5
(49)

Totals that are summed one at a time in a loop are known as what type of totals?

(Multiple Choice)
4.9/5
(38)

When a loop might execute many times, it becomes increasingly important to consider the number of evaluations that take place.How can considering the order of evaluation of short-circuit operators affect the performance of a loop?

(Essay)
4.8/5
(33)

When using a nested loop, what should always be thought of as the all-encompassing loop?

(Multiple Choice)
4.8/5
(36)

What type of loop checks a Boolean expression at the "top" of the loop before the body has a chance to execute?

(Multiple Choice)
4.9/5
(36)
Showing 1 - 20 of 40
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)