Test for Head.Java

Assigned Subject Number:   

 

Instructions: Please answer the following questions to the best of your knowledge.

 

1.         What is the purpose of this program?

            A)        To output the first 10 lines of a file.

            B)        To output contents from the beginning of a file.

            C)        To remove text from the beginning of a file.

            D)        To add a header to a file.

            E)        To count the number of words at the beginning of a file.

 

2.         What are the available command line options?

            A)        bytes, lines.

            B)        lines ONLY.

            C)        bytes, lines, quiet, silent.

            D)        bytes, lines, quiet, silent, verbose.

            E)        bytes, lines, silent.

 

3.         What is the purpose of the “parseUnit” method?

            A)        To retrieve a substring of specific size from an inputted string.

            B)        To divide a given string into chunks of equal size.

            C)        To determine the sizes of the units used for parsing the file.

            D)        To check if the given string fits within the set unit size/

            E)        There is no such method.

 

4.         What is the purpose of the “close” method?

            A)        To close the program.

            B)        To close the Reader stream for the file.

            C)        To output the results and close the file.

            D)        To inform the user of termination.

            E)        None of the above.

 

5.         How is the output affected by the “quiet” command line option?

            A)        Not at all.

            B)        Only the first line of the file is outputted.

            C)        Only the result for the first file is outputted.

            D)        The filename is omitted from the output.

            E)        Does not output anything.

 

6.         What type does the method “headBytes” return?

            A)        int

            B)        String

            C)        boolean

            D)        double

            E)        void

 

7.         Within the “headBytes” and “headLines” methods, of what variable type is buffer?

            A)        char[]

            B)        String

            C)        int[]

            D)        String[]

            E)        None of the above.

 

8.         What does the class variable unitSize represent?

            A)        The number of bytes per item to be printed.

            B)        The size of the chunks to be scanned.

            C)        The amount of characters to be outputted per line.

            D)        The average size of the files.

            E)        There is no such variable.

 

9.         What do the constants MULTIPLE_FILES, ALWAYS, and NEVER represent?

            A)        The amount of lines to print.

            B)        The number of files in the input.

            C)        The number of command line options.

            D)        The order in which to print the results.

            E)        None of the above.

 

10.       This program contains how many constructors?

            A)        0

            B)        1

            C)        2

            D)        3

            E)        4