Final Exam Java
Final Exam Java
What
class is Mark for
the Review
split() (1) Points
method
a
member
of?
Parse
StringBuilder
Array
String (*)
Correct
2. Which of the following are true about parsing a String?(Choose Three)
Mark for Review
(1) Points
Correct
91227
9120423 (*)
Compile fails.
23
91204
Correct
4. Using the FOR loop method of incrementing through a String is beneficial if you
desire to: (Choose Three) Mark for Review
(1) Points
Correct
Correct
Section 3
(Answer all questions in this section)
6. 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
7. Which statement added at line one allows the code to compile and run?
Mark for Review
//line one (1) Points
public class Test (
public static void main (String[] args) {
java.io.PrintWriter out = new java.io.PrintWriter
(new java.io.OutputStreamWriter (System.out), true);
System.out.println("Java");
}
}
Correct
Correct
True (*)
False
Correct
10. Assertions are boolean statements to test and debug your programs.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
Section 3
(Answer all questions in this section)
11. What is one step you must do to create your own exception?
Mark for Review
(1) Points
Correct
True
False (*)
Correct
True
False (*)
Correct
Section 3
(Answer all questions in this section)
Correct
Correct
19. 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
Correct
Section 3
(Answer all questions in this section)
21. 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
Correct
22. Consider designing a program that organizes your contacts alphabetically by last
name, then by first name. Oddly, all of your contacts' first and last names are Mark for Review
exactly five letters long. (1) Points
Correct
23. Which of the following correctly initializes a Matcher m for Pattern p and String str?
Mark for Review
(1) Points
Correct
Correct
25. One benefit to using groups with regular expressions is that you can segment a
matching string and recall the segments (or groups) later in your program. Mark for Review
True or false? (1) Points
True (*)
False
Correct
Section 3
(Answer all questions in this section)
26. Which of the following does not correctly match the regular expression symbol to its
proper function? Mark for
Review
(1) Points
27. The normalize() method removes redundant name elements from a qualified path.
True or false? Mark for
Review
(1) Points
True (*)
False
Correct
28. An absolute path always starts from the drive letter or mount point.
Mark for
Review
(1) Points
True (*)
False
Correct
True
False (*)
Correct
30. The way that you read from a file has changed since the introduction of Java 7.
True or false? Mark for
Review
(1) Points
True (*)
False
Correct
Section 3
(Answer all questions in this section)
Correct
32. The java.io package has problems with no support for symbolic links.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
FilterOutputStream (*)
ObjectOutputStream
DigestOutputStream
PrintStream
OutputStream
Correct
An InputStream (*)
A PrintStream
A Reader stream
A BufferedWriter stream
A BufferedReader stream
Correct
Correct
Section 3
(Answer all questions in this section)
36. The read() method of java.io.Reader class lets you read a character at a time.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
37. The Files class provides a instance method that creates a new BufferedReader.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
True (*)
False
Correct
39. A non-linear recursive method can call how many copies of itself?
Mark for Review
(1) Points
1
2 or more (*)
None
Correct
True (*)
False
Correct
Section 3
(Answer all questions in this section)
Correct
Recursive Case
Convergence Case
Basic Case
Base Case (*)
None of the above
Correct
True
False (*)
Correct
44. Which two statements can create an instance of an array? (Choose Two)
Mark for Review
(1) Points
Section 4
(Answer all questions in this section)
45. What option do you choose from the File menu in Eclipse to start the process of
creating a runnable JAR file? Mark for Review
(1) Points
Switch Workspace
Export (*)
Import
Properties
Correct
Section 4
(Answer all questions in this section)
46. To deploy java applications you may use Java Web Start.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
True
False (*)
Correct
Correct
jar files
JNLP
JDBC (*)
Java Web Start
None of the above
Correct
50. Which of the following files are not required to be uploaded to a web server to deploy
a JWS java application/applet? Mark for Review
(1) Points
jar files
JNLP files
html files
.java files (*)
None of the above
Correct