EBK 3N3-EBK: PROGRAMMING W/MICROSOFT VI
EBK 3N3-EBK: PROGRAMMING W/MICROSOFT VI
8th Edition
ISBN: 9780176920159
Author: ZAK
Publisher: VST
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 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 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, intSub, and dblAvg variables contain the number 0 before the loop is processed. a. Do While intSub < 4 intNums(intSub) = intTotal + intTotal intSub += 1 Loop dblAvg = intTotal / intSub b. Do While intSub < 4 intTotal += intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / intSub c. Do While intSub < 4 intTotal += intNums(intSub) intSub += 1 Loop dblAvg = intTotal / intSub – 1 d. Do While intSub < 4 intTotal = intTotal + intNums(intSub) intSub = intSub + 1 Loop dblAvg = intTotal / (intSub – 1)
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.
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