New Semester
Started
Get
50% OFF
Study Help!
--h --m --s
Claim Now
Question Answers
Textbooks
Find textbooks, questions and answers
Oops, something went wrong!
Change your search query and then try again
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Tutors
Online Tutors
Find a Tutor
Hire a Tutor
Become a Tutor
AI Tutor
AI Study Planner
NEW
Sell Books
Search
Search
Sign In
Register
study help
computer science
programming with microsoft visual basic 2015
Programming With Microsoft Visual Basic 2012 6th Edition Diane Zak - Solutions
7. What will the code in Review Question 5’s answer b assign to the dblAvg variable?a. 0b. 5c. 6d. 8
6. What will the code in Review Question 5’s answer a assign to the dblAvg variable?a. 0b. 5c. 6d. 8
5. 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
4. The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. Which of the following loops will correctly add 100 to each array element? The intSub variable contains the number 0 before the loop is processed.a. Do While intSub
3. The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. The statement intSales(3) = intSales(3) + 10 will .a. replace the 500 amount with 10b. replace the 500 amount with 510c. replace the 900 amount with 10d. replace the 900 amount with 910
2. The strItems array is declared as follows: Dim strItems(20) As String. The intSub variable keeps track of the array subscripts and is initialized to 0. Which of the following Do clauses will process the loop instructions for each element in the array?a. Do While intSub > 20b. Do While intSub <
1. Which of the following declares a five-element one-dimensional array?a. Dim dblAmounts(4) As Doubleb. Dim dblAmounts(5) As Doublec. Dim dblAmounts(4) As Double ={3.55, 6.70, 8, 4, 2.34}d. both a and c
5. Which of the following returns the Boolean value True when the strPetName variable contains the string “Micki”?a. strPetName.Contains("k")b. strPetName Like "M*"c. strPetName.Substring(2, 1) = "c"d. all of the above
4. The strItem variable contains uppercase letters only. Which of the following determines whether the variable contains either the word “SHIRT” or the word “SKIRT”?a. If strItem Like "S[HK]IRT" Thenb. If strItem Like "S[H-K]IRT" Thenc. If strItem = "S[HK]IRT" Thend. If strItem = "SHIRT"
3. If the strWord variable contains the string “Irene Turner”, what value will the strWord.Contains("t") method return?a. Trueb. Falsec. 6d. 7
2. Which of the following changes the contents of the strName variable from Tam to Tammy?a. strName = strName.Append(4, "my")b. strName = strName.Append(3, "my")c. strName = strName.Insert(4, "my")d. strName = strName.Insert(3, "my")
1. The strName variable contains 10 characters. Which of the following For clauses will access each character contained in the variable, character by character?a. For intIndex As Integer = 0 To 10b. For intIndex As Integer = 1 To 10c. For intIndex As Integer = 0 To strName.Length – 1d. For
5. Which property determines whether a control is available to the user during run time?a. Availableb. Enabledc. Unavailabled. Disabled 6. Explain the difference between a menu item’s access key and its shortcut keys.
4. Which of the following is false?a. Menu titles should be one word only.b. Each menu title should have a unique access key.c. You should assign shortcut keys to commonly used menu titles.d. Menu items should be entered using book title capitalization.
3. Which of the following allows the user to access a menu item without opening the menu?a. an access keyb. a menu keyc. shortcut keysd. none of the above
2. The underlined letter in a menu element’s caption is called .a. an access keyb. a menu keyc. a shortcut keyd. none of the above
1. The horizontal line in a menu is called .a. a menu barb. a separator barc. an item separatord. none of the above
7. Write the Visual Basic statement that uses the Contains method to determine whether the strAddress variable contains the string “Jefferson Street” (entered in uppercase, lowercase, or a combination of uppercase and lowercase). Assign the method’s return value to a Boolean variable named
6. The strAmount variable contains the string “3,123,560”. Write the Visual Basic statements to change the contents of the variable to “3123560”; use the Remove method.
5. Write the Visual Basic statements to accomplish the following tasks:a. Display in the lblSize control the number of characters contained in the strMsg variable.b. Remove the leading and trailing spaces from the strCity variable.c. Use the Insert and Remove methods to change the contents of the
4. The strPartNum variable contains the string “456ANK6”. Write a Visual Basic statement that assigns the string “6ANK” from the strPartNum variable to the strCode variable.
3. Using the Insert and Remove methods, write the Visual Basic statements to change the contents of the strWord variable from “door” to “floor”.
2. Write a Visual Basic statement that uses the Insert method to change the contents of the strWord variable from “In” to “Indiana”.
1. Write a Visual Basic statement that removes the leading and trailing spaces from the txtAddress control.
15. If the strAddress variable contains the string “34 Elm Street”, what will the strAddress.IndexOf("Elm", 4) method return?a. –1b. 3c. 4d. False
14. If the strAddress variable contains the string “123 Maple Street”, what will the strAddress.IndexOf("Maple") method return?a. –1b. 4c. 5d. True
13. The strAmount variable contains the string “300.89”. Which of the following statements changes the contents of the variable to “300.89!!!!”?a. strAmount = strAmount.PadLeft(4, "!"c)b. strAmount = strAmount.PadRight(4, "!"c)c. strAmount = strAmount.PadRight(10, "!"c)d. none of the above
12. If the strName variable contains the string “Sydney Hart”, which of the following changes the contents of the variable to “Sydney D. Hart”?a. strName = strName.Insert(6, "D. ")b. strName = strName.Insert(7, "D. ")c. strName = strName.Insert(7, " D.")d. both a and c
11. If the strMsg variable contains the string “Today is Monday”, which of the following assigns the number 9 to the intNum variable?a. intNum = strMsg.Substring(0, "M")b. intNum = strMsg.Contains("M")c. intNum = strMsg.IndexOf("M")d. intNum = strMsg.IndexOf(0, "M")
10. Which of the following changes the contents of the strCityState variable from Austin Texas to Austin, Texas?a. strCityState = strCityState.Insert(6, ",")b. strCityState = strCityState.Insert(7, ",")c. strCityState = strCityState.Insert(8, ",")d. none of the above
9. Which of the following expressions evaluates to True when the strPart variable contains the string “123X45”?a. strPart Like "999[A-Z]99"b. strPart Like "######"c. strPart Like "###[A-Z]##"d. none of the above
8. If the strWord variable contains the string “chimes”, which of the following statements assigns the fourth character in the variable to the strLetter variable?a. strLetter = strWord.Substring(3)b. strLetter = strWord.Substring(3, 1)c. strLetter = strWord(4).Substringd. none of the above
7. If the strName variable contains the string “George Washington”, what value will the strName.IndexOf("Washington") method return?a. –1b. 0c. 7d. 8
6. Which of the following statements changes the contents of the strWord variable from“sting” to “string”?a. strWord = strWord.AddTo(2, "r")b. strWord = strWord.Insert(2, "r")c. strWord = strWord.Insert(3, "r")d. strWord = strWord.Insert(3, "r"c)
5. Which of the following methods can be used to determine whether the strAmount variable contains the dollar sign?a. blnResult = strAmount.Contains("$")b. intResult = strAmount.IndexOf("$")c. intResult = strAmount.IndexOf("$", 0)d. all of the above
4. Which of the following statements changes the contents of the strZip variable from 60521 to 60561?a. strZip = strZip.Insert(3, "6")strZip = strZip.Remove(4, 1)b. strZip = strZip.Insert(4, "6")strZip = strZip.Remove(3, 1)c. strZip = strZip.Remove(3, 1)strZip = strZip.Insert(3, "6")d. all of the
3. The strWord variable contains the string “Chairs”. Which of the following statements changes the contents of the variable to “Chair”?a. strWord = strWord.Remove(5)b. strWord = strWord.Remove(6, 1)c. strWord = strWord.Trim(5)d. strWord = strWord.Trim(6)
2. Which of the following statements assigns the first three characters in the strPart variable to the strCode variable?a. strCode = strPart.Assign(0, 3)b. strCode = strPart.Assign(3, 1)c. strCode = strPart.Sub(0, 3)d. strCode = strPart.Substring(0, 3)
1. The txtCity control contains the word “London” followed by two spaces. Which of the following statements removes the two spaces from the control’s contents?a. txtCity.Text = txtCity.Trimb. txtCity.Text = Trim(txtCity.Text)c. txtCity.Text = txtCity.Text.Trimd. none of the above
4. Which of the following rounds the contents of the dblNum variable to three decimal places?a. Math.Round(3, dblNum)b. Math.Round(dblNum, 3)c. Round.Math(dblNum, 3)d. Round.Math(3, dblNum)
3. Which of the following statements prevents a form from being closed?a. e.Cancel = Falseb. e.Cancel = Truec. e.Close = Falsed. sender.Close = False
2. A form’s event is triggered when the computer processes the Me.Close() statement.a. Closeb. Closingc. FormClosed. FormClosing
1. A form’s event is triggered when you click the Close button on its title bar.a. Closeb. CloseFormc. FormClosed. FormClosing
5. The event occurs when the user either types a value in the text portion of a combo box or selects a different item in the list portion.a. ChangedItemb. ChangedValuec. SelectedItemChangedd. TextChanged
4. The item that appears in the text portion of a combo box is stored in which property?a. SelectedTextb. SelectedValuec. Textd. TextItem
3. Which of the following selects the Cat item, which appears third in the cboAnimal control?a. cboAnimal.SelectedIndex = 2b. cboAnimal.SelectedItem = "Cat"c. cboAnimal.Text = "Cat"d. all of the above
2. The items in a combo box belong to which collection?a. Itemsb. Listc. ListBoxd. Values
1. Which property is used to specify a combo box’s style?a. ComboBoxStyleb. DropDownStylec. DropStyled. Style
5. Write the code for a function that receives a copy of the value stored in an Integer variable. The function should divide the value by 2 and then return the result, which may contain a decimal place. Name the function GetQuotient. Then write an appropriate statement to invoke the function,
4. Write the code for a Sub procedure that receives three Double variables: the first two by value and the last one by reference. The procedure should divide the first variable by the second variable and then store the result in the third variable. Name the procedure CalcQuotient.
3. Write the code for a function named GetCountry. The function should prompt the user to enter the name of a country and then return the user’s response. Then write a statement to invoke the GetCountry function. Display the function’s return value in a message box.
2. Write the code for a Sub procedure named GetCountry. The procedure should prompt the user to enter the name of a country, storing the user’s response in its strName parameter. Then write a statement to invoke the procedure, passing it the strCountry variable.
1. Write the code for a Sub procedure that receives a Double number passed to it.The procedure should divide the number by 2 and then display the result in the lblNum control. Name the procedure DivideByTwo. Then write a statement to invoke the procedure, passing it the number 87.8.
18. Explain the difference between a Sub procedure and a Function procedure.19. Explain the difference between passing a variable by value and passing it by reference.20. Explain the difference between invoking a Sub procedure and invoking a function.
17. Which of the following statements invokes the GetDiscount function, passing it the contents of two Decimal variables named decSales and decRate? The statement should assign the function’s return value to the decDiscount variable.a. decDiscount = Call GetDiscount(decSales, decRate)b. Call
16. The memory locations listed in the parameterList in a procedure header have procedure scope and are removed from the computer’s internal memory when the procedure ends.a. Trueb. False
15. Which of the following statements should you use to call the GetEndingInventory procedure described in Review Question 14?a. Call GetEndingInventory(intBegin, intSales, intPurchases, intEnding)b. Call GetEndingInventory(ByVal intBegin, ByVal intSales, ByVal intPurchases, ByRef intEnding)c. Call
14. A Sub procedure named GetEndingInventory is passed four Integer variables named intBegin, intSales, intPurchases, and intEnding. The procedure should calculate the ending inventory using the beginning inventory, sales, and purchase amounts passed to the procedure. The result should be stored in
13. Which of the following is false?a. When you pass a variable by reference, the receiving procedure can change its contents.b. To pass a variable by reference in Visual Basic, you include the ByRef keyword before the variable’s name in the Call statement.c. When you pass a variable by value,
12. If the statement Call CalcNet(decNetPay) passes the variable’s address, the variable is said to be passed .a. by addressb. by contentc. by referenced. by value
11. Which of the following is a valid header for a procedure that is passed the number 15?a. Private Function GetTax(ByVal intRate As Integer) As Decimalb. Private Function GetTax(ByAdd intRate As Integer) As Decimalc. Private Sub CalcTax(ByVal intRate As Integer)d. both a and c
10. Which of the following is a valid header for a procedure that receives the address of a Decimal variable followed by an integer?a. Private Sub GetFee(ByVal decX As Decimal, ByAdd intY As Integer)b. Private Sub GetFee(decX As Decimal, intY As Integer)c. Private Sub GetFee(ByRef decX As Decimal,
9. Which of the following instructs a function to return the contents of the dblBonus variable?a. Return dblBonusb. Return ByVal dblBonusc. Send dblBonusd. SendBack dblBonus
8. Which of the following is false?a. The order of the arguments listed in the Call statement should agree with the order of the parameters listed in the receiving procedure’s header.b. The data type of each argument in the Call statement should match the data type of its corresponding parameter
7. Which of the following is a valid header for a procedure that receives an integer followed by a number with a decimal place?a. Private Sub GetFee(intBase As Integer, decRate As Decimal)b. Private Sub GetFee(ByRef intBase As Integer, ByRef decRate As Decimal)c. Private Sub GetFee(ByVal intBase As
6. Which of the following is a valid header for a procedure that receives a copy of the value stored in a String variable?a. Private Sub DisplayName(ByContents strName As String)b. Private Sub DisplayName(ByValue strName As String)c. Private Sub DisplayName ByVal(strName As String)d. none of the
5. Which of the following statements invokes the GetArea Sub procedure, passing it two variables by value?a. Call GetArea(dblLength, dblWidth)b. Call GetArea(ByVal dblLength, ByVal dblWidth)c. Invoke GetArea(dblLength, dblWidth)d. GetArea(dblLength, dblWidth) As Double
4. To determine whether a variable is being passed to a procedure by value or by reference, you will need to examine .a. the Call statementb. the procedure headerc. the statements entered in the procedured. either a or b
3. Each memory location listed in the parameterList in the procedure header is referred to as .a. an addressb. a constraintc. a parameterd. a value
2. The items listed in the Call statement are referred to as .a. argumentsb. parametersc. passersd. none of the above
1. Which of the following is false?a. A function can return only one value to the statement that invoked it.b. A Sub procedure can accept only one item of data passed to it.c. The parameterList in a procedure header is optional.d. At times, a memory location inside the computer’s internal memory
5. The event occurs when the user selects a different item in a list box.a. SelectionChangedb. SelectedItemChangedc. SelectedValueChangedd. none of the above
4. Which of the following statements selects the “Horse” item, which appears third in the lstAnimal control?a. lstAnimal.SelectedIndex = 2b. lstAnimal.SelectedIndex = 3c. lstAnimal.SelectedItem = 2d. lstAnimal.SelectedItem = 3
3. Which of the following properties stores the index of the item selected in a list box?a. Indexb. SelectedIndexc. Selectiond. SelectionIndex
2. The items in a list box belong to the collection.a. Itemsb. Listc. ListItemsd. Values
1. Which of the following methods is used to add items to a list box?a. Addb. AddListc. Itemd. ItemAdd
3. Which of the following statements pauses program execution for 1 second?a. System.Threading.Thread.Pause(1000)b. System.Threading.Thread.Pause(1)c. System.Threading.Thread.Sleep(1000)d. System.Threading.Thread.Sleep(100)
2. What will the following code display in the lblSum control?Dim intSum As Integer Dim intY As Integer Do While intY < 3 For intX As Integer = 1 To 4 intSum = intSum + intX Next intX intY = intY + 1 Loop lblSum.Text = Convert.ToString(intSum)a. 5b. 8c. 15d. 30
1. What will the following code display in the lblAsterisks control? For intX As Integer = 1 To 2 For intY As Integer = 1 To 3 1blAsterisks.Text = 1blAsterisks.Text & "*" Next intY 1blAsterisks.Text = 1blAsterisks.Text & Control Chars.NewLine Next intX a. b. C. " d.
20. What will the following code display?Dim intTotal As Integer = 1 Do MessageBox.Show(intTotal.ToString)intTotal = intTotal + 2 Loop Until intTotal >= 3
19. What will the following code display?Dim intTotal As Integer Do While intTotal
18. Write a For…Next statement that calculates and displays the squares of the even numbers from 2 through 26. Display the results in the lblNums control. Display each number on a separate line in the control.
17. Write a For…Next statement that displays the numbers from 9 through 81, in increments of 9, in the lblNums control. Display each number on a separate line in the control.
16. Write the Visual Basic code that corresponds to the flowchart shown in Figure 6-36.Display the calculated results on separate lines in the lblCount control. start initialize counter to 15 T display counter counter
15. Change the pretest loop from Exercise 13 to a posttest loop. Add another button to the interface used in Exercise 14. Enter your code from this exercise in the button’s Click event procedure. Save the solution and then start and test the application. Close the Code Editor window and then
14. Rewrite the pretest loop from Exercise 13 using the Do…Loop statement. Add another button to the interface created in Exercise 13. Enter your code from this exercise in the button’s Click event procedure. Save the solution and then start and test the application.Close the Code Editor window
13. Write the Visual Basic code for a pretest loop that uses an Integer variable named intOdd to display the odd integers from 7 through 19 in the lblOddNums control.Use the For…Next statement. Display each number on a separate line in the control.Now create a Visual Basic Windows application to
12. Modify Solution 2 shown earlier in Figure 6-3. The solution should now keep track of the number of times Isis’s laser beam missed the spider. After saying “You are safe now.The spider is dead”, Isis should say one of the following: “I got him immediately.”, “I missed him one
11. Write a Visual Basic assignment statement that subtracts the contents of the decReturns variable from the contents of the decSales accumulator variable.
10. Write a Visual Basic assignment statement that updates the intTotal counter variable by –3.
9. Figure 6-35 shows a problem specification, two illustrations, and two solutions containing loops.a. Will both loops work when Sherri is one or more steps away from the fountain, as shown in Illustration A? If not, why not?b. Will both loops work when Sherri is directly in front of the fountain,
8. Write a Visual Basic assignment statement that updates the decTotal accumulator variable by the value stored in the decSales variable.
7. Write a Visual Basic assignment statement that updates the intTotal counter variable by 2.
6. What will the following code display in message boxes?Dim intX As Integer Do MessageBox.Show(intX.ToString)intX = intX + 1 Loop Until intX > 4
5. What will the following code display in message boxes?Dim intX As Integer Do While intX < 4 MessageBox.Show(intX.ToString)intX += 1 Loop
4. Write a Visual Basic Do clause that processes the loop instructions as long as the value in the strState variable is not “Finished” (in any case). Use the While keyword. Now rewrite the Do clause using the Until keyword.
3. Write a Visual Basic Loop clause that processes the loop instructions as long as the value in the strAnswer variable is either Y or y. Use the While keyword. Now rewrite the Loop clause using the Until keyword.
2. Write a Visual Basic Do clause that stops the loop when the value in the intQuantity variable is less than or equal to the value in the intOrdered variable. Use the Until keyword. Now rewrite the Do clause using the While keyword.
1. Write a Visual Basic Do clause that processes the loop instructions as long as the value in the intTotal variable is greater than the number 0. Use the While keyword. Now rewrite the Do clause using the Until keyword.
15. The loop controlled by the correct For clause from Review Question 14 will end when the intX variable contains the number .a. 100b. 111c. 101d. 110
Showing 900 - 1000
of 1847
First
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Last
Step by Step Answers