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 correctly implements use of regular expressions to complete this task?     Mark for Review
(1) Points
                   
           
    return month.matches("April"|"May"|"June"|"July");
   
           
    return month.substring(0,3);
   
           
    return month.compareTo("April, May, June, July");
   
           
    return month.equals("April, May, June, July");
   
           
    return month.matches("April|May|June|July"); (*)    

A regular expression is a character or a sequence of characters that represent a string or multiple strings.
True or false?     Mark for Review
(1) Points
                   
           
    True (*)
   
           
    False

1.     Methods can not throw exceptions.
True or false?     Mark for Review
(1) Points
                   
           
    True
   
           
    False (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                   
        2.     What is special about including a resource in a try statement?(Choose Two)     Mark for Review
(1) Points
                   
            (Choose all correct answers)    
                   
           
    An error will be thrown if the resources does not open. (*)
   
           
    The program will fail if the resource does not open.
   
           
    The resources will auto-close. (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                   
        3.     Which three types of objects can be thrown using a throw statement? (Choose Three)     Mark for Review
(1) Points
                   
            (Choose all correct answers)    
                   
           
    Throwable (*)
   
           
    Object
   
           
    Event
   
           
    Error (*)
   
           
    Exception (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                   
        4.     The finally clause only executes when an exception is not caught and thrown.
True or false?     Mark for Review
(1) Points
                   
           
    True
   
           
    False (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                   
        5.     What symbol(s) is used to separate multiple exceptions in one catch statement?     Mark for Review
(1) Points
                   
           
    (==) (equals equals)
   
           
    None, multiple exceptions can't be handled in one catch statement.
   
           
    &&
   
           
    A single vertical bar | (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                6.     Multiple catch statements can be used for a single try statement.
True or false?     Mark for Review
(1) Points
                   
           
    True (*)
   
           
    False
   
                   
               
[Correct]         Correct
   
                   
        7.     Why should you not use assertions to check parameters?     Mark for Review
(1) Points
                   
           
    Assertions do not work on parameters.
   
           
    It is hard to assume expected values for parameters.
   
           
    Not all methods have parameters, therefore assertions should never be used on parameters.
   
           
    Assertions can be disabled at run time which may cause unexpected results in your assertions. (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 6.
   
                   
        8.     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]         Correct
   
                   
        9.     An absolute path always starts from the drive letter or mount point.     Mark for Review
(1) Points
                   
           
    True (*)
   
           
    False
   
                   
               
[Correct]         Correct
   
                   
        10.     The Files class can perform which of the following functions?     Mark for Review
(1) Points
                   
           
    Works with relative paths
   
           
    Navigates the file system
   
           
    Works across disk volumes
   
           
    Creates files (*)
   
           
    Works with absolute paths
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 4.
11.     The java.io package has problems with no support for symbolic links.
True or false?     Mark for Review
(1) Points
                   
           
    True (*)
   
           
    False
   
                   
               
[Correct]         Correct
   
                   
        12.     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]         Correct
   
                   
        13.     Which statement determine that "java" is a directory?     Mark for Review
(1) Points
                   
           
    Boolean isDir=(new Directory("java")).exists(); (*)
   
           
    Boolean isDir=Directory.exists ("java");
   
           
    Boolean isDir=(new File("java")).isDirectory();
   
           
    Boolean isDir=(new File("java")).isDir();
   
                   
               
[Correct]         Correct
   
                   
        14.     File permissions are the same across all of the different operating systems.     Mark for Review
(1) Points
                   
           
    True
   
           
    False (*)
   
                   
               
[Incorrect]         Incorrect. Refer to Section 3 Lesson 5.
   
                   
        15.     The Files class provides a instance method that creates a new BufferedReader.
True or false?     Mark for Review
(1) Points
                   
           
    True (*)
   
           
    False
   
                   
               
[Correct]         Correct

Komentar

Postingan populer dari blog ini