Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN: 9781337102124
Author: Diane Zak
Publisher: Cengage Learning
Expert Solution & Answer
Book Icon
Chapter 8, Problem 9RQ
Program Description Answer

All of the given loops can be used to assign the number 1 to each element in an “intCounters” array.

Hence, the correct answer is option “D”.

Blurred answer
Students have asked these similar questions
The intCounters array contains five elements. Which of the following assigns the number 1 to each element? a. For intSub As Integer = 0 To 4 intCounters(intSub) = 1 Next intSub b. Dim intSub As Integer Do While intSub < 5 intCounters(intSub) = 1 intSub += 1 Loop c. For intSub As Integer = 1 To 5 intCounters(intSub - 1) = 1 Next intSub d. All of the above.
The intNums array is declared as follows: Dim intNums() As Integer = {10, 5, 7, 2}. Which of the following blocks of code correctly calculates the average value stored in the array? The intTotal variable contains the number 0 before the loop is processed. a. For Each intX As Integer In intNums intTotal += intX Next intX dblAvg = intTotal / intNums.Length b. For Each intX As Integer In intNums intTotal += intNums(intX) Next intX dblAvg = intTotal / intX c. For Each intX As Integer In intNums intTotal += intNums(intX) intX += 1 Next intX dblAvg = intTotal / intX d. None of the above.
The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. Which of the following loops will correctly multiply each element by 2? The intSub variable contains the number 0 before the loop is processed. a. Do While intSub <= 4 intSub *= 2 Loop b. Do While intSub <= 4 intSales *= 2 intSub += 1 Loop c. Do While intSub < 5 intSales(intSub) *= 2 intSub += 1 Loop d. None of the above.
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning