Test for WC.Java

Assigned Subject Number:   

 

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

 

1.         This program is able to:

            A)        Count ONLY the number of words in a document.

            B)        Count ONLY the number of words and lines in a document.

            C)        Count ONLY the number of characters, words, and lines in a document.

            D)        Count ONLY the number of spaces, words, and lines in a document.

            E)        Count ONLY the number of characters and words in a document.

 

2.         What are the possible inputs for the program?

            A)        ONLY the input stream.

            B)        ONLY a single file.

            C)        A single file or the input stream.

            D)        Multiple files or the input stream.

            E)        Single or Multiple files.

 

3.         What are the available command line options?

            A)        There are NONE.

            B)        bytes, chars, lines, words.

            C)        chars, lines, words.

            D)        chars, lines.

            E)        lines ONLY.

 

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

            A)        To preprocess and make sure the file being processed is valid.

            B)        To perform the counting functions of the program on a given file.

            C)        To output the results of the program to a file.

            D)        To ask the user for a file name to process.

            E)        This method does not exist.

 

5.         What is the purpose of the “pad” method?

            A)        To remove white space in the counting of characters.

            B)        To align the numerical outputs of the program.

            C)        To insert a tab character at the beginning of the file being processed.

            D)        To replace space characters with tab characters in a file.

            E)        This method does not exist.

 

6.         What exception does the method “wc” throw?

            A)        ParseException.

            B)        PrinterException.

            C)        IOException.

            D)        NullPointerException.

            E)        The method does not throw any exceptions.

 

7.         What object is used to assist in the counting functions of the program?

            A)        StreamTokenizer.

            B)        StringTokenizer.

            C)        FileParser.

            D)        StringBuffer.

            E)        None of the above.

 

8.         In the method “start”, which variable represents the number of files inputted on the command line?

            A)        argc

            B)        number_files

            C)        optind

            D)        filecount

            E)        nfiles

 

9.         What are the possible cases within the switch statement inside the method “decodeSwitch”?

            A)        ‘w’ and ‘l’

            B)        ‘b’ and ‘l’

            C)        ‘b’, ‘w’, and ‘l’

            D)        ‘c’, ‘w’, and ‘l’

            E)        ‘c’, ‘w’, and ‘p’

 

10.       This program contains how many constructors?

            A)        0

            B)        1

            C)        2

            D)        3

            E)        4