All homeworks should be turned in electronically to myCourses.
Homeworks are due by the start of class (11:40) on the due date.
Some homework questions © 2009 Pearson Education Addison-Wesley
- Compare and contrast the JDK and the JRE. [2]
- Compare and contrast compiled vs. interpreted languages. [1]
- What do comments look like in Java? [1]
- Write a minimal "Hello, World!" program in Java. [3]
- Describe the eight primitive types in Java, and say something about their
differences. [2]
- What is the difference between an expression and a statement? [1]
- The controlling expression for a switch statement includes all
of the following types except: [1]
- char
- byte
- int
- double
- A compound statement is enclosed between: [1]
- [ ]
- { }
- ( )
- < >
- The looping mechanism that always executes at least once
is the _____________ statement. [1]
- if ... else
- do ... while
- while
- for
- A variable whose meaning is confined to an object of a class
is called an [1]
- instance variable
- local variable
- global variable
- none of the above
- A variable whose meaning is confined to a method definition
is called an [1]
- instance variable
- local variable
- global variable
- none of the above
- A method's signature is composed of what elements of its
definition? [1]
- Write an if-else statement to compute the amount of shipping due on an
online sale. If the cost of the purchase is less than $20, the shipping cost
is $5.99. If the cost of the purchase over $20 and at most $65, the
shipping cost is $10.99. If the cost of the purchase is over $65, the
shipping cost is $15.99. [4]
- A programming style that uses a signal and response approach to
programming is called: [1]
- Object Oriented Programming
- Structured Programming
- Event-driven Programming
- Bottom-up Programming
- A button component should have a
registered _____________ associated with it. [1]
- pixel
- JFrame
- listener
- none of the above
- The _____________ manager places components into five regions.
[1]
- BorderLayout
- FlowLayout
- GridLayout
- AbsoluteLayout
- A _____________ is an object that is a simple container class
that groups other objects. [1]
- JPanel
- JMenu
- JButton
- JTextArea
- Explain the model-view-controller pattern when applied to
a typical GUI. [3]
- Name and describe all the classes involved with writing a
serializable object out to a file named "output.txt". [3]
- The method paint() has one parameter of type:
[1]
- Shape
- Graphics
- Image
- String
- Any change to graphics being displayed on the screen requires a call to
the ____________ method to update the graphics. [1]
- paint()
- repaint()
- update()
- all of the above
- The programming statements used to accomplish a thread's task should be
included in the method: [1]
- start()
- init()
- run()
- none of the above
- When a server executes the accept() method it:
[2]
- Blocks and waits for a connection
- Checks for a connection and if there is none it exits
- Blocks but in a new thread
- Any of the above, depending on the input parameters to accept()
- In a Swing program, the only thread that should change the GUI is the
______________ :
[2]
- main() thread
- SwingWorker thread
- GUI thread
- event dispatch thread
- What is a socket? [3]
- Compare and contrast TCP and UDP. [4]
- Describe how you would use multithreading to design a TCP server that can
handle multiple clients. [5]
- What is an Android Activity? Is it the same as an application?
Discuss the relationship between an Activity and an app. [5]
- Name and describe the three states of an Activity's lifecycle.
[6]
- Describe how to design an Android application which is
internationalization-ready (i.e., its text can be easily translated).
[5]
- Name and describe two Creational design patterns from the
"Gang of Four" (GoF) book. [4]