Quiz Number 8 Answers

SWE 432, Fall 2008
October 27


  1. Consider the following four class declarations. Note that Q, R and S are all in package P, but T and U are not.
    
    //----------------------------    |    //----------------------------
    package P;                        |    package P;
    public class Q                    |    public class R extends Q {...}
    {                                 |    //----------------------------
       public    int f;               |    package P;
       private   int g;               |    public class S {...}
       protected int h;               |    //----------------------------
                 int i;               |    public class T extends Q {...}
    }                                 |    //----------------------------
    //---------------------------     |    public class U {...}
                                      |    //----------------------------
    
    
    1. List all classes that can access variable f.
      Q, R, S, T, U
    2. List all classes that can access variable g.
      Q
    3. List all classes that can access variable h.
      Q, R, S, T
    4. List all classes that can access variable i.
      Q, R, S
  2. What language was Java originally based on?
    1. C++
    2. C
    3. C#
    4. Objective C
    5. Ada
    6. Pascal
    7. Perl
    8. JavaScript
    Objective C
Quiz Back to schedule page
Prev  Next