1. The java.io package has problems with missing operations, like copy, move, and such.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
2. Prior to Java 7, you write to a file with a call to the BufferedWriter class's write() method. True or false? Mark for Review
(1) Points
True (*)
False
Correct
3. The way that you read from a file has changed since the introduction of Java 7. Mark for Review
(1) Points
True (*)
False
Correct
4. Which of the following is an absolute Windows path? Mark for Review
(1) Points
data
/
\Users\UserName\data
C:\Users\UserName\data (*)
/home/user/username
Correct
5. Java 7 requires you create an instance of java.io.File class. True or false? Mark for Review
(1) Points
True
False (*)
Correct
6. What two packages are available in Java to allow you to transfer data? Mark for Review
(1) Points
(Choose all correct answers)
java.input.package
java.nio.file package (*)
java.io package (*)
java.output.package
Correct
7. The java.nio.file package has improved exception handling.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
8. The normalize() method removes extraneous elements from a qualified path. True or false? Mark for Review
(1) Points
True (*)
False
Correct
9. Using the FOR loop method of incrementing through a String is beneficial if you desire to: (Choose all that apply) Mark for Review
(1) Points
(Choose all correct answers)
Parse the String. (*)
Search for a specific character or String inside of the String. (*)
You don't use a FOR loop with Strings
Read the String backwards (from last element to first element). (*)
Correct
10. Split is a method for Strings that parses a string by a specified character, or, if unspecified, by spaces, and returns the parsed elements in an array of Strings.
True or false? Mark for Review
(1) Points
True
False (*)
Correct
11. What class is the split() method a member of? Mark for Review
(1) Points
String (*)
Array
StringBuilder
Parse
Correct
12. Which of the following correctly defines a StringBuilder? Mark for Review
(1) Points
There is no such thing as a StringBuilder in Java.
A method that adds characters to a string.
A class inside the java.util.regex package.
A class that represents a string-like object. (*)
Correct
13. Identify the method, of those listed below, that is not available to both StringBuilders and Strings? Mark for Review
(1) Points
delete(int start, int end) (*)
length()
charAt(int index)
indexOf(String str)
Correct
14. Which of the following are true about parsing a String? Mark for Review
(1) Points
(Choose all correct answers)
It is possible to use the String.split() method to parse a string. (*)
It is possible to use a for loop to parse a string. (*)
It is a way of dividing a string into a set of sub-strings. (*)
It is not possible to parse a string using regular expressions.
Correct
15. Which of the following correctly initializes a StringBuilder? Mark for Review
(1) Points
StringBuilder sb = "This is my String Builder";
StringBuilder sb = StringBuilder(500);
StringBuilder sb = new StringBuilder(); (*)
None of the above.
Correct
16. Which of the following methods can be used to replace a segment in a string with a new string? Mark for Review
(1) Points
remove(String oldString, String newString)
replaceAll(String oldString, String newString) (*)
replaceAll(String newString)
substring(int start, int end, String newString)
None of the above. There is no replaceAll(String newString) method with one argument.
Correct
17. A non-linear recursive method is less expensive than a linear recursive method. True or false? Mark for Review
(1) Points
True
False (*)
Correct
18. A linear recursion requires the method to call which direction? Mark for Review
(1) Points
Forward
Backward (*)
Both forward and backward
None of the above
Correct
19. A non-linear recursive method calls how many copies of itself in the recursive case? Mark for Review
(1) Points
0
1
2 or more (*)
Correct
20. A linear recursive method can call how many copies of itself? Mark for Review
(1) Points
1 (*)
2 or more
None
Correct
21. Forward thinking helps when creating linear recursive methods. True or false? Mark for Review
(1) Points
True
False (*)
Correct
22. Which of the following correctly defines Pattern? Mark for Review
(1) Points
A method of dividing a string into a set of sub-strings.
A class in the java.util.regex package that stores the format of a regular expression. (*)
A regular expression symbol that represents any character.
A class in the java.util.regex package that stores matches.
Correct
23. Which of the following correctly defines a repetition operator? Mark for Review
(1) Points
A symbol that represents any character in regular expressions.
A method that returns the number of occurrences of the specified character.
Any symbol in regular expressions that indicates the number of occurrences a specified character appears in a matching string. (*)
None of the above.
Correct
24. Square brackets are a representation for any character in regular expressions "[ ]".
True or false? Mark for Review
(1) Points
True
False (*)
Correct
25. What is the correct explanation of when this code will return true?
return str.matches(".*[0-9]{6}.*"); Mark for Review
(1) Points
Any time that str contains two dots.
Any time that str contains a sequence of 6 digits. (*)
Any time that str has between zero and nine characters followed by a 6.
Any time str contains a 6.
Always.
Correct
26. 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
matches(String regex) (*)
compareTo(String regex)
equalsIgnoreCase(String regex)
equals(String regex)
Correct
27. The following code correctly initializes a pattern with the regular expression "[0-9]{2}/[0-9]{2}/[0-9]{2}".
Pattern dateP = Pattern.compile("[0-9]{2}/[0-9]{2}/[0-9]{2}");
True or false? Mark for Review
(1) Points
True (*)
False
Correct
28. 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
29. In a regular expression, {x} and {x,} represent the same thing, that the preceding character may occur x or more times to create a match.
True or false? Mark for Review
(1) Points
True
False (*)
Correct
30. Assertions are optional ways to catch logic errors in code.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
31. What is exception handling? Mark for Review
(1) Points
An error that occurs against the flow of your program.
When a file fails to open.
If your program exits before you expect it to.
A consistent way of handling various errors. (*)
Correct
32. Methods can not throw exceptions.
True or false? Mark for Review
(1) Points
True
False (*)
Correct
33. When will a finally statement be executed? Mark for Review
(1) Points
Only if an exception is not thrown.
Only if an exception is thrown.
Always; no matter if an exception is thrown or not. (*)
Only if multiple exceptions are caught and thrown.
Never; it is there for visual purposes.
Correct
34. The finally clause only executes when an exception is not caught and thrown.
True or false? Mark for Review
(1) Points
True
False (*)
Correct
35. Assertions are boolean statements to test and debug your programs.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
36. What symbol is used to separate multiple exceptions in one catch statement? Mark for Review
(1) Points
None, multiple exceptions can't be handled in one catch statement.
A single bar: | (*)
&&
(==) (equals equals)
Correct
37. Multiple catch statements can be used for a single try statement.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
38. The Files class provides a instance method that creates a new BufferedReader.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
39. Which of the following static methods is not provided by the Files class to check file properties or duplication? Mark for Review
(1) Points
Files.isWritable(Path p);
Files.isArchived(Path p); (*)
Files.isHidden(Path p);
Files.isReadable(Path p);
Correct
40. The read() method lets you read a character at a time. True or false? Mark for Review
(1) Points
True (*)
False
Correct
41. The Paths class provides a static get() method to find a valid Path.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
42. The System.err writes standard output to the console.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
43. An ObjectInputStream lets you read a serialized object. True or false? Mark for Review
(1) Points
True
False (*)
Correct
44. A serialized class implements which interface? Mark for Review
(1) Points
Serializer
Serializable (*)
Serializing
Serialized
SerializedObject
Correct
45. The Files class lets you check for file properties. True or false? Mark for Review
(1) Points
True (*)
False
Correct
46. Which of the following is an attribute of a two tier architecture application? Mark for Review
(1) Points
An application of that has a client and server only. (*)
A complex application that includes a client, a server and database.
An application of that runs on a single computer.
None of the above.
Correct
47. Which of the following files are not required to be uploaded to a web server to deploy a java application/applet? Mark for Review
(1) Points
jar files
JNLP files
html files
.java files (*)
None of the above
Correct
48. Which of the following is an attribute of a three tier architecture application? Mark for Review
(1) Points
an application of that has a client and server only
a complex application that includes a client, a server and database (*)
an application of that runs on a single computer
None of the above
Correct
49. An example of two tier architecture would be a client application working with a server application.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
50. How would you make an instance of Car in a class that did import the vehicle package below?
Mark for Review
(1) Points
Car c = new Car(); (*)
vehicle.Car c=new Car();
vehicle.Car c=new vehicle.Car();
vehicle.Car c=new vehicle();
None of the above
Correct
0 komentar:
Posting Komentar