Chapter 23 You can use the Substring method

subject Type Homework Help
subject Pages 4
subject Words 633
subject Authors Diane Zak

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Chapter 23: The String Section (String Manipulation)
TRUE/FALSE
1. Applications rarely need to manipulate (process) string data.
2. 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.
3. The StringLength property stores an integer that represents the number of characters contained in a
String.
4. The Trim method removes characters from the original string.
5. The Trim method returns a string that excludes any leading or trailing spaces.
6. Visual Basic provides the Replace method for replacing a sequence of characters in a string with
another sequence of characters.
7. Using the Insert method to insert a value beginning with the fifth character in a string, you use a
starting index of 5.
8. When processing the Insert method, the computer makes a temporary copy of the string in memory,
and then inserts the characters in the copy only.
9. The first character in a string has an index of 1.
10. A possible use for the Index method includes determining whether the area code “(312) appears in a
phone number.
11. The startIndex argument is not optional in the IndexOf method’s syntax.
page-pf2
12. You can use the Substring method to display only the string’s first five characters.
13. You can use the RemoveIt method to remove the dashes from a Social Security number, the leading
zeroes from a policy number, or the middle initial from a name.
14. The Like operator evaluates to True when the string matches the pattern.
MULTIPLE CHOICE
1. The number of characters contained in a string is stored in the string’s ____ property.
a.
Size
c.
Length
b.
Len
d.
StringLength
2. The syntax of the length property is ____.
a.
string.Length
c.
Length.string
b.
Length(string)
d.
string.Len
3. You can use the ____ method to remove any spaces from both the beginning and end of a string.
a.
Clean
c.
Cut
b.
CleanWhiteSpace
d.
Trim
4. The syntax for the trim method is ____.
a.
Trim.string
c.
string.TrimMethod
b.
string.Trim
d.
trim(string)
5. You insert characters using the ____ method.
a.
Insert
c.
Input
b.
InStr
d.
InsertInto
6. The syntax of the insert method is ____.
a.
string.Insert(value,startIndex)
b.
Insert(startIndex,value).string
c.
string.Insert(value).startIndex
d.
string.Insert(startIndex, value)
page-pf3
7. You can use the ____ method to search a string to determine whether it contains a specific sequence of
characters.
a.
IndexOf
c.
Location
b.
Index
d.
Locate
8. The syntax of the IndexOf method is ____.
a.
string.IndexOf(subString[, startIndex])
b.
string.IndexOf.subString
c.
subString.IndexOf(string)
d.
string.IndexOf(startIndex, subString)
9. Visual Basic provides the ____ method for accessing any number of characters contained in a string.
a.
Portion
c.
Substring
b.
PartialString
d.
PieceString
10. The syntax for the substring method is ____.
a.
Substring.string(startIndex)
b.
string.Substring(startIndex[, numCharsToAccess])
c.
string.Substring(numCharsToAccess,startIndex)
d.
string.Substring([numCharsToAccess],startIndex)
11. You can use the Remove method to remove a specified number of characters located anywhere in a
string.
a.
Erase
c.
Remove
b.
Replace
d.
Delete
12. The syntax of the Remove method is ____.
a.
Remove.string(startIndex[, numCharsToRemove])
b.
string.Remove(numCharsToAccess,startIndex)
c.
string.Remove(startIndex[, numCharsToRemove])
d.
string.Remove([numCharsToAccess],startIndex)
13. The ____ operator allows you to use pattern-matching characters to determine whether one string is
equal to another string.
a.
Similar
c.
HasSimilarity
b.
Comparable
d.
Like
14. You also can include a range of values in a character list by using a(n) ____ to separate the lowest
value in the range from the highest value in the range.
a.
hyphen
c.
equal sign
b.
apostrophe
d.
plus sign
page-pf4

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.