Exam 6: The Repetition Structure

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

In either pretest or posttest loops, the controlling condition is evaluated with each repetition.

(True/False)
4.9/5
(37)

Case-Based Critical Thinking Questions Case 1 - XYZ Solutions You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs. You changed the Do clause to the correct For clause in the previous problem. You also changed the Loop keyword to the Next keyword for the For...Next loop. What else needs to be changed about the Do loop?

(Multiple Choice)
4.8/5
(27)

Like the condition in a selection structure, the condition in a loop must evaluate to either True or False.

(True/False)
4.8/5
(38)

If the stepValue is omitted when coding a For...Next statement, the stepValue is ____ at execution time.

(Multiple Choice)
4.8/5
(37)

Explain the difference between using the keywords While and Until within a Do...Loop statement.

(Essay)
4.9/5
(32)

A counter is always incremented by a constant value.

(True/False)
4.8/5
(29)

Programmers use a(n) ____ when they need the computer to repeatedly process one or more program instructions until some condition is met, at which time the ____ ends.

(Multiple Choice)
4.9/5
(44)

Case-Based Critical Thinking Questions Case 1 - XYZ Solutions You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs. How many times will the message display based on the counter being initialized to 0? IntCounter = 0 Do While intCounter MessageBox.Show("OK") IntCounter = intCounter + 1 Loop

(Multiple Choice)
4.8/5
(27)

Problems - Correcting Logic and Code Errors The following sample of code contains errors. Rewrite the incorrect statements to correct all errors. An application allows the user to enter a salary amount. The application should then calculate and display the possible bonuses based on that salary, using bonus rates of 3-6% in increments of .5%. ' displays bonus amounts using rates ' of 3% - 6% in increments of .5% Dim dblSalary As Decimal Dim decBonus As Decimal TryParse(txtSalary.Text, decSalary) lblBonus.Text = String.Empty For decRate As Decimal = 0.03 To 0.06 Step 0.5 decBonus = decSalary + decRate lblBonus.Text = lblBonus.Text & decRate.ToString("P1") & " " & decBonus.ToString("C2") & ControlChars.NewLine Next decRate

(Essay)
4.8/5
(34)

'fill list boxes with values for men's pant sizes for 'pant waist and pant length For intWaist As Double = 28 to 46 lstWaist.Items(intWaist.ToString("N0")) Next intWaist SelectedItem = "28" For intLength As Integer = 26 to 36 Step .5 lstLength.Items.Add(dblLength.ToString("N1")) Next dblLength lstLength.SelectedIndex = "26"

(Essay)
4.8/5
(28)

The startValue in a For...Next loop structure may be omitted.

(True/False)
4.8/5
(40)

What is a counter-controlled loop and when is it used in a program? What statement provides the most efficient way to write a counter-controlled loop?

(Essay)
4.9/5
(40)

A(n) ____ read is used to prepare or set up a loop.

(Multiple Choice)
4.8/5
(32)

The symbol used to represent a loop condition on a flowchart is the ____ symbol.

(Multiple Choice)
5.0/5
(27)

What is a list box? Provide two of the Windows standards for its use on a form.

(Essay)
4.9/5
(36)

____ means assigning a beginning value to a counter or an accumulator.

(Multiple Choice)
4.8/5
(26)

In a For...Next statement, if stepValue is positive, then startValue must be ____ endValue for the loop instructions to be processed.

(Multiple Choice)
4.8/5
(33)

Explain the purpose of priming and update reads in a program.

(Essay)
4.9/5
(33)

Case-Based Critical Thinking Questions Case 1 - XYZ Solutions You have just started working for XYZ Solutions as a programmer. Your first assignment is to review and correct various code so that you can become familiar with the company's programs. Your supervisor wants you to change the Do...Loop in the previous problem to a For...Next loop. He also wants the message to display only three times. Which of the following For clauses should you use?

(Multiple Choice)
4.8/5
(48)

Write a pretest loop that adds together the integers 2, 4, 6, 8, 10, 12, 14, 16, 18, and 20. Use the intNum variable to keep track of the integers. Store the result in the intResult variable (which contains the number 0). Use the For...Next statement.

(Essay)
4.9/5
(31)
Showing 21 - 40 of 60
close modal

Filters

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