Section 3 Quiz 1
Section 3 Quiz 1
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
1
2 or more (*)
None
Correct
Correct
Recursive Case
Convergence Case
Basic Case
Base Case (*)
None of the above
Correct
Correct
5. Which of the following methods can be used to replace a segment in a string with a
new string? Mark for Review
(1) Points
Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
6. Identify the method, of those listed below, that is not available to both StringBuilders
and Strings? Mark for Review
(1) Points
length()
charAt(int index)
delete(int start, int end) (*)
indexOf(String str)
Correct
7. Using the FOR loop method of incrementing through a String is beneficial if you desire
to: (Choose Three) Mark for Review
(1) Points
Read the String backwards (from last element to first element). (*)
Parse the String. (*)
Search for a specific character or String inside of the String. (*)
You don't use a FOR loop with Strings
Correct
9. Which of the following methods for the String class take a regular expression as a
parameter and returns true if the string matches the expression? Mark for Review
(1) Points
compareTo(String regex)
equals(String regex)
equalsIgnoreCase(String regex)
matches(String regex) (*)
Correct
10. Consider that you are making a calendar and decide to write a segment of code that
returns true if the string month is April, May, June, or July. Which code segment Mark for Review
correctly implements use of regular expressions to complete this task? (1) Points
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
True (*)
False
Correct
12. The following code correctly initializes a pattern with the regular expression "[0-
9]{2}/[0-9]{2}/[0-9]{2}". Mark for Review
(1) Points
Pattern dateP = Pattern.compile("[0-9]{2}/[0-9]{2}/[0-9]{2}");
True or false?
True (*)
False
Correct
13. Which of the following does not correctly match the regular expression symbol to its
proper function? Mark for Review
(1) Points
"{x}" means there must be x occurrences of the preceding character in the string
to be a match.
"?" means there may be zero or one occurrences of the preceding character in
the string to be a match.
"+" means there may be zero or more occurrences of the preceding character in
the string to be a match. (*)
"{x,}" means there may be x or more occurrences of the preceeding character in
the string to be a match.
"{x,y}" means there may be between x and y occurrences of the preceding
character in the string to be a match.
Correct
Correct
Correct