1.
In a
                  Mark for Review
  project,              (1) Points
  2 of the
  classes
  must
  contain a
  main
  method.
  True or
  False?
                  True
                  False (*)
                                         Correct
        2. A workspace can not have more than one stored projects.
                                                                              Mark for Review
           True or false?
                                                                                    (1) Points
                  True
                  False (*)
                                         Correct
        3. What is the purpose of the Eclipse Editor Area and Views?
                                                                              Mark for Review
                                                                                    (1) Points
              (Choose all correct answers)
                  To choose the file system location to delete a file.
                  To navigate a hierarchy of information. (*)
                  To modify elements. (*)
                                         Correct
        4. The following defines a package keyword:
                                                                              Mark for Review
                                                                                    (1) Points
                  Precedes the name of the class.
                  Provides the compiler information that identifies
                  outside classes used within the current class.
                  Defines where this class lives relative to other classes,
                  and provides a level of access control. (*)
                                         Correct
         5. When importing another package into a class you must
                                                                          Mark for Review
            import only the package classes that will be called and not         (1) Points
            the entire package. True or false?
                   True
                   False (*)
                                          Correct
6.When
                     Mark for Review
  importing
                           (1) Points
  another
  package
  into a class
  you must
  import the
  entire
  package as
  well as the
  package
  classes
  that will
  be called.
  True or
  False?
                     True
                     False (*)
                                           Correct
           7. The following defines a class keyword:
                                                                          Mark for Review
                                                                                (1) Points
                     Precedes the name of the class. (*)
                     Provides the compiler information that identifies
                     outside classes used within the current class.
                     Defines where this class lives relative to other
                     classes, and provides a level of access control.
                                           Correct
           8. What is the result when the following code segment is
                                                                          Mark for Review
              compiled and executed?                                            (1) Points
                 int x = 22, y = 10;
                 double p = Math.sqrt( ( x + y ) /2);
                 System.out.println(p);
                 4.0 is displayed (*)
                 5.656854249492381 is displayed
                 Syntax error "sqrt(double) in java.lang.Math cannot
                 be applied to int"
                 ClassCastException
                 2.2 is displayed
                                      Correct
          9. Which line of Java code assigns the value of 5 raised to
                                                                        Mark for Review
             the power of 8 to a?                                             (1) Points
                 double a=pow(8,5);
                 double a=15^8;
                 int a=Math.pow(5,8);
                 int a=Math.pow(8,5);
                 double a=Math.pow(5,8); (*)
                                      Correct
         10. Which of the following is the name of a Java primitive
                                                                        Mark for Review
             data type?                                                       (1) Points
                 Object
                 Rectangle
                 String
                 int (*)
                                      Incorrect. Refer to Section 4
                                      Lesson 3.
 1Given
                  Mark for
1.the
                  Review
  followin
                (1) Points
  g
  declarati
  on:
  int
  z=5,m=
  6;
 Which
 line of
 Java
 code
 properly
 casts
one type
into
another
without
data
loss?
            double x=(double)z/m; (*)
            double x=z/m;
            double x=(double)(z/m);
            double x= double z/m;
                             Correct
    12. Write a declaration statement that will hold a number like 2.541.
                                                                              Mark for
                                                                              Review
                                                                            (1) Points
            int number;
            float number; (*)
            boolean number;
            char number;
                             Correct
    13. What is printed by the following code segment?
                                                                              Mark for
                                                                              Review
                                                                            (1) Points
            \\
            \\\\\\\\\\\\\\
            \\\\
            \\\\\\\ (*)
                             Correct
    14. What will the following code segment output?
                                                                              Mark for
        String s="\\\\\\\\";
                                                                              Review
        System.out.println(s);
                                                                            (1) Points
            \\\\ (*)
                 \\\\\\\\
                 "\\\\\"
                 \\
                                  Correct
        15. What will the following code segment output?
                                                                                          Mark for
                                                                                          Review
            String s="\\\n\"\n\\\n\"";
                                                                                        (1) Points
            System.out.println(s);
                 ""\
                 ""
                 \
                 ""
                 \
                 "
                 \
                 " (*)
                 \" \"
                 "
                 \
                 "
                 \
                 "
                 "
                                  Correct
1 The
               Mark for
. followi
          Review
  ng
          (1) Points
  define
  s an
  import
  keywo
  rd:
             Defines where this class lives relative to other classes, and provides a
             level of access control.
             Provides the compiler information that identifies outside classes used
             within the current class. (*)
             Precedes the name of the class.
                            Correct
2.   Which of the two diagrams below illustrate the general form of a Java
                                                                                  Mark for
     program?
                                                                             Review
                                                                             (1) Points
         Example A
         Example B (*)
                         Correct
3.   The following defines a class keyword:
                                                                                         Mark for
                                                                                    Review
                                                                                    (1) Points
         Precedes the name of the class. (*)
         Provides the compiler information that identifies outside classes used
         within the current class.
         Defines where this class lives relative to other classes, and provides a
         level of access control.
                        Correct
4.   The following defines an import keyword:
                                                                                         Mark for
                                                                                    Review
                                                                                    (1) Points
         Precedes the name of the class.
         Provides the compiler information that identifies outside classes used
         within the current class. (*)
         Defines where this class lives relative to other classes, and provides a
         level of access control.
                        Correct
5.   What is the output of the following lines of code?
                                                                                         Mark for
                                                                                    Review
     int j=7,k=5,m=8,result;
                                                                                    (1) Points
     result=j-k%3*m;
     System.out.println(result);
         16
         -9 (*)
             0
                              Correct
           Correct
   8. Which of the following is not a legal name for a variable?
                                                                                         Mark for Review
                                                                                              (1) Points
           zero
           2bad (*)
           theLastValueButONe
           year2000
           Correct
   9. A local variable has precedence over a global variable in a Java method. True or
      false?                                                                             Mark for Review
                                                                                              (1) Points
           True (*)
           False
           Correct
  10.Given the code
                                                                                         Mark for Review
      String s1 = "abcdef";                                                                   (1) Points
      String s2 = "abcdef";
      String s3 = new String(s1);
      Which of the following would equate to false?
           s3 == s1 (*)
           s1 = s2
           s1 == s2
           s3.equals(s1)
           s1.equals(s2)
           Correct
11.The ==
                 Mark for
   operator
            Review
   can be
            (1) Points
   used to
   compare
two String
objects.
The result
is always
true if the
two
strings are
have the
exact
same
characters
in each
position
of the
String.
True or
false?
              True
              False (*)
                                   Correct
   12.    Consider the following code snippet
                                                      Mark for Review
                                                 (1) Points
          String forest = new String("Black");
          System.out.println(forest.length());
          What is printed?
              Black
              Forest
              5 (*)
                                   Correct
13.   Multiple windows are used when more than one file is open in
                                                                                Mark for Review
      the edit area. True or False?
                                                                           (1) Points
          True
          False (*)
                               Correct
14.   The ______________ is the location into which you will store and
                                                                                Mark for Review
      save your files.
                                                                           (1) Points
          Perspective
          Workspace (*)
          Editor
          None of the above
                               Correct
15.   In a project, 2 of the classes must contain a main method. True or
                                                                                Mark for Review
      False?
                                                                           (1) Points
          True
          False (*)
                               Correct