Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Programming with Microsoft Visual Basic 2015
Quiz 8: String Manipulation
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 41
Essay
Write the Visual Basic statement that uses the Contains method to determine whether the strEmployeeCode variable contains the string "NC" (entered in uppercase). Assign the method's return value to a Boolean variable named blnIsNC .
Question 42
Essay
Write the Visual Basic statement that inserts "RVI" at the beginning of the string in the following strPolicyNum and assigns it to the strPolicyNum variable. strPolicyNum = "576892"
Question 43
Multiple Choice
Case-Based Critical Thinking Questions 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 HR department has decided to change the Finance department number from 04 to 09. Which of the following statements correctly changes the contents of the strEmpCode ?
Question 44
Essay
Describe four of the six menu standards that should be followed when including a menu in an application.
Question 45
Essay
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.
Question 46
Essay
What is the difference between a menu item's access key and shortcut key?
Question 47
Essay
Problems - Correcting Logic and Code Errors 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 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
Question 48
Essay
Write the condition that evaluates to True when a dash (-) appears anywhere within the strItemNum variable.
Question 49
Multiple Choice
Case-Based Critical Thinking Questions 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. Each employee is assigned an employee code, such as F01234, which is stored in the strEmpCode variable. The first character is a letter for employment status (F for Full-time, P for Part-time) . The next two characters are numbers representing the employee's department number. The last three characters are numbers representing a unique value for each individual employee. Which of the following statements assigns the employee's department to the strDept variable?
Question 50
Essay
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.
Question 51
Multiple Choice
Case-Based Critical Thinking Questions 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?
Question 52
Essay
The strPhone variable contains a 10-digit phone number. If the string stored in the strPhone variable begins with the "336" area code, display the phone number in the lblPhone control's Text property. Use the StartsWith method.
Question 53
Essay
Problems - Correcting Logic and Code Errors 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
Question 54
Essay
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"
Question 55
Essay
Write a Visual Basic statement that will access each character in the strNumber variable to determine if the variable contains a comma and then removes any comma that is found.
Question 56
Essay
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.
Question 57
Essay
The strCityState variable contains a string that ends with a two-digit state abbreviation. Write the statements that determine whether the string stored in the strCityState variable ends with "NY". If it does, assign the string "New York order" to the lblState control's Text property. Use the EndsWith method.
Question 58
Essay
The strCityState variable contains the string "AtlantaGA". Write the Visual Basic statements that assign the string "Atlanta" from the strCityState variable to the strCity variable, and assign the string "GA" to the strState variable.