Exam 8: String Manipulation
Exam 1: An Introduction to Visual Basic 201544 Questions
Exam 2: Designing Applications60 Questions
Exam 3: Using Variables and Constants60 Questions
Exam 4: The Selection Structure60 Questions
Exam 5: More on the Selection Structure58 Questions
Exam 6: The Repetition Structure60 Questions
Exam 7: Sub and Function Procedures60 Questions
Exam 8: String Manipulation60 Questions
Exam 9: Arrays60 Questions
Exam 10: Structures and Sequential Access Files60 Questions
Exam 11: Classes and Objects60 Questions
Exam 12: Web Applications60 Questions
Exam 13: Working With Access Databases and Linq60 Questions
Exam 14: Access Databases and SQL60 Questions
Select questions type
The Trim method is used to remove characters only from the end of a string.
(True/False)
4.9/5
(31)
Each menu element is considered a(n)____ and has a set of properties associated with it.
(Multiple Choice)
4.9/5
(43)
Which of the following shortcut keys should not be used in Windows applications that have an EDIT menu for menu items not on the EDIT menu?
(Multiple Choice)
4.9/5
(37)
Assume that the value of the string message is "Happy New Year".What value would message.IndexOf("New")yield?
(Multiple Choice)
5.0/5
(36)
A literal type character forces a literal constant to assume a data type other than the one its form indicates.
(True/False)
4.7/5
(37)
Case 1 - Human Resources Application
An application used by the Human Resources (HR) department needs to be improved. You need to use various string manipulation properties and methods to ensure all data entered by a user is accurate and stored correctly.
-The application needs to process benefits for full-time employees only.Which of the following statements determines whether the strEmpCode variable contains an employee code for a full-time employee?
(Multiple Choice)
4.9/5
(31)
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
-Private Sub btnDisplay_Click(ByVal sender As Object,ByVal e As System.EventArgs)Handles btnDisplay.Click
' displays a pay rate based on an employee's code
' Full Time employee pay rate is 11.50.Part Time
' employee pay rate for those working more than 30 hours
' is 10.50,otherwise it is 9.50
Dim strEmpCode As String
Dim decPayRate As Integer
strCode = txtEmpCode.Text.Snip
' validate the employee code
If strEmpCode = "FT##" Then
decPayRate = 11.50
ElseIf strEmpCode Like "PT30##" Then
decPayRate = 9.50
Else
decPayRate = 10.50
End If
' display pay rate
lblPayRate.Text = decPayRate.ToString("N2")
End Sub
(Essay)
4.8/5
(30)
What is the difference between a menu item's access key and shortcut key?
(Essay)
4.8/5
(38)
If an application expects the user to enter a seven-digit phone number or a five-digit ZIP code,the application's code should verify that the user entered the required number of characters.
(True/False)
4.8/5
(39)
Write the Visual Basic statements needed to format decNetPay with two decimal places,pad the formatted variable with asterisks until its length is 12,and then insert a dollar sign ($)as the first character.The result is assigned to the strNetPayFormat variable.
(Short Answer)
4.7/5
(30)
How many characters will be removed from the string below? Dim myString as string = "ABCDEFGH"
MyString = myString.Remove(2,3)
(Multiple Choice)
4.8/5
(35)
Write the Visual Basic statement to assign the number of characters in the txtSSN control's Text property to the intSSNNumChar variable.
(Short Answer)
4.8/5
(34)
The strSerialNum variable contains the string "DRY259614".Write the Visual Basic statement that assigns the string "259614" from the strSerialNum variable to the strProductCode variable.
(Short Answer)
4.8/5
(31)
In Visual Basic 2015,you use a(n)____ to include one or more menus in an application.
(Multiple Choice)
4.7/5
(37)
The ____ allows you to use pattern-matching characters to determine whether one string is equal to another string.
(Multiple Choice)
4.7/5
(33)
Programmers use the ____ property of the menu element to refer to the menu element in code.
(Multiple Choice)
4.8/5
(34)
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
-Private Sub btnDisplay_Click(ByVal sender As Object,ByVal e As System.EventArgs)Handles btnDisplay.Click
' displays type of vehicle for the code entered by user
Const strLENGTH_MSG As String = "The code must contain four characters."
Const strTYPE_MSG As String = "The last character in the code must be C,T,or V."
Dim strCode As String
Dim strLastChar As String
strCode = txtCode.Text.ToLower
' determine whether code contains exactly 4 characters
If strCode.Chars < 4 Then
lblType.Text = String.Empty
MessageBox.Show(strLENGTH_MSG,"Code",
MessageBoxButtons.OK,
MessageBoxIcon.Information)
Else
' determine whether the last character is valid
strLastChar = strCode.Substring(4)
Select Case strCode
Case "C"
lblType.Text = "Car"
Case "T"
lblType.Text = "Truck"
Case "V"
lblType.Text = "Van"
Case Else
lblType.Text = String.Empty
MessageBox.Show(strType_MSG,"Type",
MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If
End If
End Sub
(Essay)
4.8/5
(33)
Write a Visual Basic statement that removes the last four digits of the credit card number and assigns it to the strCCLastFour variable.
strCCNum = "4456778996352852"
(Short Answer)
4.8/5
(38)
Describe four of the six menu standards that should be followed when including a menu in an application.
(Essay)
4.8/5
(36)
The txtGrade control contains the string "95%".Write the Visual Basic statement to remove the percent sign from the txtGrade control as well as convert the contents of the control to a Decimal number.Assign the result to the decGrade variable.Use the TrimEnd method.
(Short Answer)
4.9/5
(31)
Showing 21 - 40 of 60
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)