The bounds on a string are always:
A) 1 to string.Length.
B) 0 to string.Length - 1.
C) 0 to string.Length.
D) 1 to string.Length - 1.
Points Earned: 0.0/1.0
Correct Answer(s): B
2. If an IndexOfAny method is passed an array of characters it:
A) searches for the first occurrence of any of the characters in the string
B) generates an error
C) finds the first occurrence of each letter in the string
D) will search for the first occurrence of the sequence of characters
Points Earned: 1.0/1.0
Correct Answer(s): A
3. When comparing "a" to "_" the correct result would be:
A) "_" is greater
B) there is no way to compare "_" to "a"
C) "a" is greater
D) they are equal
Points Earned: 1.0/1.0
Correct Answer(s): A
4. If an IndexOfAny method is passed a string it:
A) generates an error
B) finds the first occurrence of each letter in the string
C) will search for the first occurrence of the sequence of characters
D) searches for the first occurrence of any of the characters in the string
Points Earned: 1.0/1.0
Correct Answer(s): A
5. Class String and the Char structure are found in the:
A) System.Chars Namespace
B) System namespace
C) System.Text namespace
D) System.Strings namespace
Points Earned: 1.0/1.0
Correct Answer(s): B
6. A string literal:
A) is a sequence of characters in double quotation marks.
B) contains numbers rather than letters.
C) contains only one character.
D) contains exactly its variable name and nothing else.
Points Earned: 1.0/1.0
Correct Answer(s): A
7. To create a string literal that excludes escape sequences, use:
A) @"string"
B) $"string"
C) !"string"
D) #"string"
Points Earned: 1.0/1.0
Correct Answer(s): A
8. When using the LastIndexOf method with three arguments, the second parameter specifies:
A) the length of the substring to search
B) the string to search for
C) the ending index of the string to search
D) the starting index of the string to search
Points Earned: 1.0/1.0
Correct Answer(s): D
9. If an integer argument goes beyond the bounds of the array then:
A) a RangeException is thrown
B) an ArgumentOutOfBoundsException is thrown
C) a BoundsException is thrown
D) an ArgumentOutOfRangeException is thrown
Points Earned: 1.0/1.0
Correct Answer(s): D
10. When creating a string object, if a character array is passed as well as two integers, then the created string equals:
A) there is no such constructor
B) the characters of the array from the first value for as many characters as the second value
C) all of the characters except those from the first value to the second value
D) the characters of the array from the first value to the second value
Points Earned: 1.0/1.0
Correct Answer(s): B
11. The string method CopyTo copies a specified number of characters from a:
A) char array into a string
B) string into a char array
C) string into a int array
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): B
12. In the declaration: string color = "blue";
A) the string literal color is assigned to the string reference "blue"
B) the string reference color is assigned to the string literal "blue"
C) the string literal "blue" is assigned to the string reference color
D) None of the above
Points Earned: 1.0/1.0
Correct Answer(s): C
13. Concatenating with strings is done with:
A) method calls.
B) operator overloading.
C) operator overloading and method calls.
D) reserved words.
Points Earned: 1.0/1.0
Correct Answer(s): C
14. string indexers treat strings as:
A) a character
B) ASCII code
C) arrays of characters
D) binary code
Points Earned: 1.0/1.0
Correct Answer(s): C
15. The way to find out if two stings are equal is:
A) the Equals method
B) the CompareTo method
C) the == operator
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): D
16. Which of the following cannot be used to form a word?
A) String
B) StringBuilder
C) Regex
D) An array of Chars
E) None of the above
Points Earned: 1.0/1.0
Correct Answer(s): E
17.
What does the following code print out?
string example = "C#_Programming";
Console.Write(example.Substring( 3, 5 );
A) _Pr
B) Pro
C) _Prog
D) Progr
Points Earned: 1.0/1.0
Correct Answer(s): D
18. When two integers are passed as arguments to the Substring method, it:
A) returns as many characters as the second integer starting at the first integer
B) generates an error
C) returns as many characters as the first integer starting at the second integer
D) returns the characters from the first integer to the second
Points Earned: 1.0/1.0
Correct Answer(s): A
19. The Equals string method is used to see if:
A) the ASCII sum of the characters in both strings are the same.
B) two strings are exactly the same.
C) the two strings have the same letter in the same position anywhere in the strings.
D) two strings start with the same letter.
Points Earned: 1.0/1.0
Correct Answer(s): B
20. To make a search return between 10 and 20 results use
A) { 10, 20 }
B) ( 10, 20 )
C) [ 10, 20 ]
D) < 10, 20 >
Points Earned: 1.0/1.0
Correct Answer(s): A
21. The IsPunctuation method returns True if the Char is ____.
A) a period (.) or a comma (,)
B) a period (.), a comma (,), a !, a ?, a colon (:), or a semicolon (;)
C) all of B, including all the braces ( (, {, and [ )
D) anything that is not a letter or a white space
Points Earned: 1.0/1.0
Correct Answer(s): B
22. If a Replace method is passed ( 'M', 'm', 0, 3 ) it will:
A) replace the first letter 'M' with 'm' in the first 4 characters
B) replace the first letter 'M' with 'm' in the first 3 characters
C) replace any letter 'M' with 'm' in the first 4 characters
D) replace any letter 'M' with 'm' in the first 3 characters
Points Earned: 1.0/1.0
Correct Answer(s): D
23. To make a quantifier lazy use:
A) a ? after it
B) a ? before it
C) a % before it
D) a % after it
Points Earned: 1.0/1.0
Correct Answer(s): A
24. ToUpper( string ) is
A) a way to make the first letter of every word in a string a capital letter.
B) a syntax error.
C) a way of converting a string to all upper cases.
D) a way of making one string more important than the rest.
Points Earned: 1.0/1.0
Correct Answer(s): B
25. If two StringBuilder objects contain the same string, then
A) they represent the same location in memory
B) they are two different objects
C) if one changes, so will the other
D) None of the above
Points Earned: 1.0/1.0
Correct Answer(s): B
26. When a quantifier is greedy it:
A) returns each result in alphabetical order
B) returns half the results
C) returns the longest result possible
D) returns a random number, more than one, of results
Points Earned: 1.0/1.0
Correct Answer(s): C
27. In order to set a string to reference nothing the programmer must use:
A) string1 = '\0'
B) string1 = ''
C) string1 = null
D) string1 = ""
Points Earned: 1.0/1.0
Correct Answer(s): C
28. Which is not a StringBuilder method?
A) Insert
B) Add
C) Replace
D) ReplaceAll
E) B and D
Points Earned: 1.0/1.0
Correct Answer(s): E
29. An example of a struct is:
A) an int
B) a double
C) a char
D) a byte
E) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): E
30.
Use the snippet of code for the following question:
1. string example = "Deitel";
2. example = example + " Books";
A) This will not produce an error, and the string's value is "DeitelBooks".
B) This will not produce an error; however, line 2 will not change the string example.
C) This will produce an error
D) This will not produce an error, and the string's value is "Deitel Books".
Points Earned: 1.0/1.0
Correct Answer(s): D
31. The difference between {n} and {n,} is:
A) {n} matches exactly n occurrences
B) {n,} matches exactly n occurrences
C) {n,} generates a syntax error
D) {n} matches at least n occurrences
Points Earned: 1.0/1.0
Correct Answer(s): A
32. The proper way to convert a string to all lowercase is:
A) ToLower( string );
B) string.ToLower();
C) string.ToLower( string );
D) STRING = string;
Points Earned: 1.0/1.0
Correct Answer(s): B
33. The Split method is used to:
A) break a string into substrings, such that the substrings appear in the original string and are separated by at least one of the characters supplied
B) break a string into a character array
C) divide a string in half
D) break a string into individual characters
Points Earned: 1.0/1.0
Correct Answer(s): A
34. Class StringBuilder is used to:
A) create strings
B) manipulate strings
C) modify strings
D) All of the above
Points Earned: 1.0/1.0
Correct Answer(s): D
35. If a programmer desires to use an asterisk (*) literally in a regular expression, they use:
A) "\*"
B) "_*"
C) "/*"
D) "*"
Points Earned: 1.0/1.0
Correct Answer(s): A
36. If a number is formatted with the D3 formatter, it means that:
A) the number has to have at least 3 digits even if they are zero
B) the number has a dollar sign and is at least 3 digits long
C) creates each number in 3 dimensions
D) it is an error
Points Earned: 1.0/1.0
Correct Answer(s): A
37. Method AppendFormat allows:
A) anything added to a string.
B) numbers to be inserted in strings.
C) one string to be added to another.
D) some formatting to be made to the string.
Points Earned: 1.0/1.0
Correct Answer(s): D
38. string objects are ________ and StringBuilders are __________.
A) mutable, immutable
B) immutable, immutable
C) mutable, mutable
D) immutable, mutable
Points Earned: 1.0/1.0
Correct Answer(s): D
39. The StartsWith and EndsWith methods see if a string starts or ends with the given character or string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
40. When a backslash is found within quotes it is considered part of an escape sequence.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
41. The Unicode character set has the same characters as ASCII.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
42. Method LastIndexOf is used to find the last occurrence of given text in a string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
43. Both stings and characters should be enclosed in double quotes ("x").A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
44. Method Replace can be used to change all occurrences of a desired character to another character.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
45. The concatenating of two strings is the merging of the two strings into another string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
46. Strings are not able to be made from an array of characters.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
47. Another way to concatenate a string is to use the ampersand character (&).A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
48. There are eight different String constructors.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
49. If a method's arguments cause it to access an index of the string that is beyond its length, the program will retrieve whatever is in that memory location.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
50. The Length property returns the length of a string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
51. The Regex and Match classes are found in the System.Text namespace.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
52. Characters consist of the capital and lowercase alphabet.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
53. When using the string constructor (char, int), the character is repeated in a string as many times as specified by the integer.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
54. In order to concatenate a string with another string a programmer can use the Concat method.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
55. strings always know their size.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
56. When passed a white space, method Trim can be used to eliminate all characters from a string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
57. The IndexOf method returns the indices of all occurrences of the given string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
58. The letter 'Z' is greater than the letter 'b'.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
59. There are two substring methods that can return some of the characters of one string as an individual string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
60. The ToUpper and ToLower methods can be used to convert a string to all upper or lower case letters, respectively.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
61. The CompareTo method returns a positive number if the invoking string is less than the argument, a negative number if the invoking string is greater and a 0 if they are the same.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
62. The LastIndexOfAny method scans through the array of characters backwards.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
63. A string is less than another string if it comes before it alphabetically.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
64. To obtain a single character from a string it can be treated as though it was an array.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
65. A string is a composition of characters used as one object.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
66. When a number is passed as an argument for a string indexer it returns that many characters starting from the first.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
67. Programmers can use classes Regex and Match to find patterns in a string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
68. strings cannot be changed.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
69. The method IsWhiteSpace is only used to determine whether a character is a space or not.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
70. The ToString method is used to convert a StringBuilder into a string.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
71. When using the Replace method, the first character passed in is the letter to be replaced and the second is what it will be replaced by.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
72. Method Append is used to add the string representation of various data type values to the end of a StringBuilder.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
73. A lazy quantifier returns only the first case that matches the specifications.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
74. Replace is a method that allows the user to change any character in a StringBuilder to the given argument.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
75. Method Matches can be used to get a list of all matches with a character.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
76. Method Remove can be used to delete any part of a StringBuilder.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
77. Structs are like classes in that they encapsulate reference types.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
78. In regular expressions, a word character is considered to be any alphanumeric character.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
79. When setting the length of a StringBuilder to a length that is shorter than the current one, an ArgumentOutOfRangeException is thrown.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
80. Each StringBuilder has a limit of characters that cannot be exceeded.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
81. Method Match returns only a single match.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
82. Properties of controls need to be set at design time.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
83. Properties Length and Capacity are used to return the number of characters in the StringBuilder and the total length allowed (at that time) of the StringBuilder respectively.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
84. The char, int, and double types are all defined by structs.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
85. Method Insert can only be used on the primitive data types.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
86. When appropriate, using string objects instead of StringBuilder objects improves performance.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
87. The + character performs the same function as the asterisk *.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
88. Method AppendFormat can be used to format objects with spaces or using proper mathematical notations.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
89. When the Trim method is passed a character array it returns a string without any of the characters found within that array.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
90. Method EnsureCapacity is used to return the capacity of a StringBuilder.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
91. Method Insert can be used to insert various data types into a given position of a StringBuilder.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
92. By default all quantifiers are lazy.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
93. There are many character methods, some of which are capable of determining whether a character is a letter, a digit, a symbol, or a punctuation.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
94. Exceeding the capacity of a StringBuilder causes the program to throw an OutOfRangeException.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
95. Method Append can only be used on the primitive data types.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): False
96. The asterisk (*) can be used to match an expression zero or more times.A) True
B) False
Points Earned: 1.0/1.0
Correct Answer(s): True
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment