Computer Programming 1 Essential Standard 5.05 Apply Looping Structures Name 5.05 Check Your Understanding Description Instructions Take until you get at least a 90. Make certain you understand the information. Modify Add Question Here Question 1 Multiple Choice 1 points Modify Remove Question Given the following statements, how many times will the body of the Do...Loop execute? Dim intNum As Integer = 0 Do intNum = intNum + 1 Loop While intNum < 5 Answer 0 5 4 infinite Add Question Here Question 2 Multiple Choice 1 points Modify Remove Question Which function is used to convert an entry from an input box to an Integer? Answer Convert.ToDouble() Convert.ToInteger() Convert.ToInt32() Convert.ToInt() Add Question Here Question 3 Multiple Choice 1 points Modify Remove Question Which statement correctly updates the accumulator intSum (syntax)? Answer intSum = Accumulator(intSum) intSum = intNum + intSum intSum = intSum + intNum intSum = intNum+ intNum Add Question Here Multiple Choice 1 points Modify Remove Question Given the following statements, how many message boxes will be displayed? Dim intNum As Integer For intNum = 1 To 10 MessageBox.Show(intNum.ToString()) Next intNum Answer 11 0 10 9 Add Question Here Question 5 Multiple Choice 1 points Modify Remove Question Given the following statements, what is the value of intNum after the last loop iteration? Dim intNum As Integer For intNum = 1 To 5 MessageBox.Show(intNum.ToString()) Next intNum Answer 1 5 6 0 Add Question Here Question 6 Multiple Choice 1 points Modify Remove Question Which of the following statements about an accumulator is false? Answer An accumulator is a value that is incremented by a changing value. An accumulator is a value that is incremented by the same value. A variable that can be used for a running total. An accumulator can be updated using input from the user. Add Question Here Question 7 Multiple Choice 1 points Modify Remove Question What is an iteration? Answer The execution of the loop one time. Using an accumulator infinite loop A running total Add Question Here Question 8 Multiple Choice 1 points Modify Remove Question Which loop is a posttest loop? Answer Do While...Loop Do ...Loop While All are posttest loops. For Next Add Question Here Question 9 Multiple Choice 1 points Modify Remove Question Given the following statements, how many times will the body of the Do...Loop execute? Dim intNum As Integer = 0 Do While intNum < 20 intNum = intNum - 2 Loop Answer 1 10 infinite 0 Add Question Here Question 10 Multiple Choice 1 points Modify Remove Question Which code segment correctly checks to see if input was entered before looping? Answer Do While (strEntered <> Nothing) Loop Do Loop While (strEntered <> Nothing) Do While (strEntered = Nothing) Loop Do Loop While (strEntered = Nothing) Add Question Here Question 11 Multiple Choice 1 points Modify Remove Question Which code segment would correctly check that input was entered between 1 and 10, inclusive? Answer Do strNumInput = InputBox("Enter a number between 1 and 10 inclusive") intEntered = Convert.ToInt16(strNumInput ) Loop While (intEntered < 1 Or intEntered > 10) Do strNumInput = InputBox("Enter a number between 1 and 10 inclusive") intEntered = Convert.ToInt16(strNumInput ) Loop While (intEntered > 1 Or intEntered < 10) Do strNumInput = InputBox("Enter a number between 1 and 10 inclusive") intEntered = Convert.ToInt16(strNumInput ) Loop While (intEntered < 1 And intEntered > 10) Do strNumInput = InputBox("Enter a number between 1 and 10 inclusive") intEntered = Convert.ToInt16(strNumInput ) Loop While (intEntered > 1 And intEntered < 10) Add Question Here Question 12 Multiple Choice 1 points Modify Remove Question Which of the following code segments would NOT count backwards from 5 to 1? Answer For intNum As Integer = 0 To 5 Step 1 Next intNum For intNum As Integer = 10 To 5 Step -1 Next intNum Dim intNum As Intger = 5 Do intNum -=1 Loop While intNum > 0 Dim intNum As Intger = 5 Do While intNum > 0 intNum -=1 Loop Add Question Here Question 13 Multiple Choice 1 points Modify Remove Question What is the result of the following code? Dim x As Integer = 100 Do While (x <= 100) x -= 1 Loop Answer An infinite loop The loop does not execute. The loop repeats until x = 0. The loop repeats until x = -1. Add Question Here Question 14 Multiple Choice 1 points Modify Remove Question What is a condition used to signify that a loop should stop executing? Answer Sentinel Iteration Decision Structure Looping Structure Add Question Here Question 15 Multiple Choice 1 points Modify Remove Question Which statement will correctly get input from a user using an InputBox? Answer strInput = InputBox("Enter something", "Input Example") intInput = InputBox("Enter something", "Input Example") strInput = InputBox() intInput = InputBox() Add Question Here Question 16 Multiple Choice 1 points Modify Remove Question When should you use an accumulator? Answer When you want to add a constant amount to the variable. When you want to add a changing amount to the variable. When you want to see how many times a loop iterates. When you want to see how many times a button is clicked. Add Question Here Question 17 Multiple Choice 1 points Modify Remove Question Which loop structure will always loop at least once? Answer Do...Loop While Do While ...Loop For Next All will loop at least once. Add Question Here Question 18 Multiple Choice 1 points Modify Remove Question Which loop will count all even numbers between 1 and 10? Answer For i As Integer = 1 To 10 Step 2 sum = sum + 1 Next i For i As Integer = 0 To 10 Step 2 sum = sum + 1 Next i For i As Integer = 1 To 10 sum = sum + 1 i=i+2 Next i For i As Integer = 1 To 10 Step 2 sum = sum + 1 i=i+2 Next i Add Question Here