CS 110 Fundamentals of Computing - Sample Hour Exam 1
Professors Bolker and Rodriguez
Closed book and notes

Here are a few sample questions. Some of the questions on the exam will be just like these. Some will be different. But if you can answer all of these you can probably answer them all.

You will be given a listing for program NewShape.java, which draws some particular shape on a Screen. Some of the questions refer to that program.


  1. In this fragment of NewShape.java (with line numbers)
        39	    
        40	    
        41		
    

  2. Use the space below (ruled so that character positions are easy to identify) to show the exact, complete output from the command
    %> java NewShape
    
    	------------------------------
            |  |  |  |  |  |  |  |  |  |
            |  |  |  |  |  |  |  |  |  |
            |  |  |  |  |  |  |  |  |  |
            |  |  |  |  |  |  |  |  |  |
    

  3. What does this do on line xx of NewShape.java ?

  4. What does void mean on line xx of NewShape.java ?

  5. Describe (two) coding conventions for Java programs and show how the author of the NewShape class used those conventions.

  6. Draw a box-and-arrow picture of the NewShape object referred to by variable whatever declared and initialized on line xx of NewShape.java Be sure to show the fields of that object. Use the other side of this paper.

  7. Can two methods in the same class have the same name? Can two methods in different classes have the same name? If the answer to either question is "yes", tell how Java knows which one to use when a client sends a message with that name.

  8. A for loop question.

  9. A question about using xemacs. (You should be able to answer this one even if you are using some other development environment at home.)