Which of these construct a DataInputStream instance?     Mark for Review
(1) Points
                   
           
    New dataInputStream(new FileInputStream("java.txt")); (*)
   
           
    New dataInputStream(new writer("java.txt"));
   
           
    New dataInputStream(new InputStream("java.txt"));
   
           
    New dataInputStream("java.txt");
   
           
    New dataInputStream(new file("java.txt"));
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 4.
   
                   
        2.     The Files class can perform which of the following functions?     Mark for Review
(1) Points
                   
           
    Works across disk volumes
   
           
    Navigates the file system
   
           
    Works with relative paths
   
           
    Creates files (*)
   
           
    Works with absolute paths
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 4.
   
                   
        3.     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
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 4.
   
                   
        4.     The java.io package has problems with no support for symbolic links.
True or false?     Mark for Review
(1) Points
                   
           
    True (*)
   
           
    False
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 4.
   
                   
        5.     This is correct syntax for catching an exception:
try(inputStream = "missingfile.txt");
catch(exception e);
True or false?     Mark for Review
(1) Points
                   
           
    True
   
           
    False (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
6.     What is one step you must do to create your own exception?     Mark for Review
(1) Points
                   
           
    Exceptions cannot be created. They are only built in to Java.
   
           
    Declare the primitive data type Exception.
   
           
    Create a new class that extends Exception. (*)
   
           
    Create a new class that implements Exception.
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                   
        7.     Which of the following is the correct way to throw cumstom ServerException?     Mark for Review
(1) Points
                   
           
    throw ServerException
   
           
    raise ServerException
   
           
    throws ServerException
   
           
    throw new ServerException() (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                   
        8.     What is the definition of a logic error?     Mark for Review
(1) Points
                   
           
    Bugs in code that make your program run different than expected (*)
   
           
    Something that causes your computer to crash.
   
           
    Computer malfunction that makes your code run incorrectly.
   
           
    Wrong syntax that will be caught at compile time.
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                   
        9.     Multiple catch statements can be used for a single try statement.
True or false?     Mark for Review
(1) Points
                   
           
    True (*)
   
           
    False
   
                   
               
[Correct]         Correct
   
                   
        10.     Which three types of objects can be thrown using a throw statement? (Choose Three)     Mark for Review
(1) Points
                   
            (Choose all correct answers)    
                   
           
    Error (*)
   
           
    Object
   
           
    Event
   
           
    Exception (*)
   
           
    Throwable (*)
   
                   
               
[Correct]         Correct

11.     What is the result from creating the following try-catch block?

1.try {

2.} catch (Exception e) {
   
3.} catch (ArithmeticException a) {
   
4.}     Mark for Review
(1) Points
                   
           
    Compile fails at Line 3 (*)
   
           
    Compile fails at Line 2
   
           
    The code compiles
   
           
    Compile fails at Line 1
   
                   
               
[Correct]         Correct
   
                   
        12.     The System.out is what type of stream?     Mark for Review
(1) Points
                   
           
    A PrintStream (*)
   
           
    A Reader stream
   
           
    A BufferedReader stream
   
           
    A BufferedWriter stream
   
           
    An OutputStream
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 5.
   
                   
        13.     When you delete files, directories, or links with the delete(Path p) method which of the following exceptions can occur (Choose all that apply).     Mark for Review
(1) Points
                   
            (Choose all correct answers)    
                   
           
    NoSuchFileException (*)
   
           
    DirectoryNotEmptyException (*)
   
           
    No exception is thrown
   
           
    IOException (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 5.
   
                   
        14.     File permissions are the same across all of the different operating systems.     Mark for Review
(1) Points
                   
           
    True
   
           
    False (*)
   
                   
               
[Correct]         Correct
   
                   
        15.     The Files class lets you check for file properties.
True or false?     Mark for Review
(1) Points
                   
           
    True (*)
   
           
    False
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 5.

Komentar

Postingan populer dari blog ini