First midterm review
Make sure you can answer all the Review Questions at the end of Chapters 1-4!
Sample questions:
- When is public static void main(String[]) executed?
- What are the three Java statements we have encountered so far?
- Explain the cookies and cookie-cutter metaphor.
- What is the actor metaphor?
- How do you instantiate an object of type Foo?
- What are the three types we have used so far?
- How do you send information to a method?
- Where is information stored?
- How do you declare a variable?
- How can you change the value of a variable?
- What do the following acronyms mean?
- GUI
- IDE
- API
- JDK
- CPU
- RAM, ROM
- JVM
- RGB
- What method is invoked when a user pushes a Button named Foo?
- What message do you send to a TextField to set its text?
- What message do you send to a TextField to get its text?
- How can you convert:
- int to String
- String to int
- What is
Graphics?
- Shortest user defined Foo class
-
Write the simplest (i.e. shortest) possible class named Foo.
- What class does your Foo class extend?
- What can your Foo class do?
- What variables does your Foo class have?
- What does "Foo" mean?
- What is
public String toString() for?
- What is
public void paint(Graphics) for?
- Graphics
- Where is (0,0?
- What are the parameters for drawOval?
- Write a message to draw a circle with radius 100, centered at (100,100).
- How do you set the color of a Graphics?
- Write a line of code to set the Color of a Graphics named g, to a very light grey
- Programming Exercises from C4
- Write the pubic void paint(Graphics) method for Circle.
- Write the accessors for Circle.
- Write the Circle class.
- Write the FilledCircle class.
- Write a Target class that is displayed as alternating red and white bands of color. Hint;
draw the biggest fillOval first and work in.
More questions... added 9/19...
- What are 5 problem solving techniques covered so far?
- What are two techniques for software reuse?
- Why is programming so difficult when you first start?
- What does cognitive overhead have to do with programming?
- Files and disks
- What is stored in files?
- What is the point of directories?
- How do directories differ from ordinary files?
- What is the name of the root of your home drive?
- What are c:\, e:\, h:\?
- Why is a disk called a disk?
- Hardware and software
- What is the difference between hardware and software?
- When you write a Java program, are you creating hardward or software?
- Can software act like hardware? If not, explain why; if so, give an example.
- Can hardware act like software? If not, explain why; if so, give an example.
- Why is reliable, inexpensive software so difficult to make? How does object oriented
programming address this issue?
- What is the difference between education and accreditation?
- How has computing changed our culture?
- How will computing change our lives in the future?
- Types
- What are the types we have used so far in Java?
- How do you convert a String to and int?
- How do you convert an int to a String?
- What is the value of: "I love " + 17?
- What is the value of: 17+"I love "?
- What is a null pointer exception? Write code to cause one.
- You have created a MyFrame class that extends java.awt.frame; but! when
you run your program nothing shows up. What are three reasons that this could be?
- Syntax and Semantics
- What does syntax mean?
- What does semantics mean?
- Why is syntax important to programming?
- What is the form of a message statement?
- What is the form of a return statement?
- What is the form of an assignment statement?
- What is the form of a variable declaration?
- What is the form of a method declaration?
- What is the form of a method heading?
- What is the form of a method body?
- Write a complete Account class including variables for name and
balance, accessors therefor and a withdraw(int) method.
- Assume you have a working Circle class with standard accessors. Write a shrink() method
for it which will reduce the radius by 1 pixel.
- Assume you have a working FilledCircle class that extends Circle (above). Write a grow() method
for it which will double the radius.