Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER

Q: According to the syllabus/class policy, check all of the following that are good ways to watch the videos
- Watch the video while taking notes
- Watch the video while watching TV
- Trying to create the program described in the video while watching
- Watch the videos while sending text messages.
A: Watch the video while taking notes; Trying to create the program described in the video while watching

Q: According to the syllabus/class policy, which statements are true about late assignments. (Check all that apply)
- No assignment can be turned in after the due date.
- All assignments should be turned in after the due date.
- Assignments turned in after the due date will have a lateness deduction.
- There are 3 "free passes" which can be used to wipe out lateness deductions
A: Assignments turned in after the due date will have a lateness deduction.

Q: According to the syllabus/class policy, which statements are true about late assignments. (Check all that apply)
- If an assignment is late 1 day the lateness penalty is 25%
- If an assignment is late 2 days the lateness penalty is 27%
- If an assignment is late 2 days the lateness penalty is 25%
- If an assignment is late 7 days the lateness penalty is 40%
- If an assignment is late 25 days the lateness penalty is 40%
- If an assignment is late 35 days the lateness penalty is 50%
A: If an assignment is late 1 day the lateness penalty is 25%; If an assignment is late 2 days the lateness penalty is 25%; If an assignment is late 7 days the lateness penalty is 40%; If an assignment is late 25 days the lateness penalty is 40%

Q: If something bad happens such that I am late on an assignment, which of the following actions can be taken?
- Ask to use of of my "Free Passes" to waive the lateness penalty.
- Get a an appropriate note (such as a note from the doctor) to document the problem and bring it to the instructor.
- Enter into the assignment comments a description of the problem and turn in the assignment once it is completed. Get caught up as soon as possible. Come see the instructor on the last day of classes.
- Request an extension of the deadline. The instructor can usually give out one extension.
A: Enter into the assignment comments a description of the problem and turn in the assignment once it is completed. Get caught up as soon as possible. Come see the instructor on the last day of classes.

Q: According to the "Getting Help" button in blackboard, what are the good options available for getting help. (Check all that apply)
- Come to one of the MM sections or any available office hours
- Come to one of the "On Campus Group Study Sessions"
- Post a question on a class discussion board and hope to get an answer from a fellow student.
- Looking for a completed solution posted on the discussion board.
A: Come to one of the MM sections or any available office hours; Come to one of the "On Campus Group Study Sessions"; Post a question on a class discussion board and hope to get an answer from a fellow student.

Q: Which of the following are true about email. (Check all that apply)
- Class emails will automatically come to your Student email address, so it is good to monitor this on a regular basis.
- Blackboard knows your personal non-student email addresses and that is where you will receive class emails
- Sending an email to the teacher is the best way to get help. This should be done immediately whenever I am stuck on anything.
- It is a good idea to send an email to the teacher when I want to schedule a Go-to Meeting.
A: Class emails will automatically come to your Student email address, so it is good to monitor this on a regular basis.; It is a good idea to send an email to the teacher when I want to schedule a Go-to Meeting.

Q: Check all of the possible times to have a "Go-to Meeting"
- During any available office hour. Calling the posted "office phone number" will allow me to request the "go-to meeting".
- During an on Campus Group study session
- In the morning when Clem plays Raquetball
- During an MM section meeting.
- Anytime, because clicking on the provided link will alert the teacher to your need.
A: During any available office hour. Calling the posted "office phone number" will allow me to request the "go-to meeting".; During an MM section meeting.

Q: Which of the following is true about Class Participation (Check all that apply).
- For each assignment, I must make a post of 1 question AND 1 answer AND 1 discovery AND 1 set of lecture notes
- Just posting 1 question on the discussion board will satisfy my Class participation requirement.
- Just posting 1 answer on the discussion board will satisfy my Class participation requirement.
- Just posting 1 Discovery on the discussion board will satisfy my Class participation requirement.
- Just posting 1 set of lecture notes on the discussion board will satisfy my Class participation requirement.
- Just posting a copy of my completed assignment on the discussion board will satisfy my Class participation requirement.
A: Just posting 1 question on the discussion board will satisfy my Class participation requirement.; Just posting 1 answer on the discussion board will satisfy my Class participation requirement.; Just posting 1 Discovery on the discussion board will satisfy my Class participation requirement.; Just posting 1 set of lecture notes on the discussion board will satisfy my Class participation requirement.

Q: According to the syllabus/class policy, it is OK to team up with another student and turn in the same code for an assignment as long as we indicate this in the Student comments section.
- True
- False
A: False

Q: According to the syllabus/class policy, if I am stuck on an assignment, I can ONLY get help from the Group study facilitator or the teacher.

Another student can't help me with my problem.
- True
- False
A: False

Q: Good reasons to show up to a Mixed Mode class session. Check all that apply.
- I can watch video lectures with "Ear buds" and ask questions whenever something needs clarification.
- I can work on assignments and get timely help when I am stuck
- I can use the WCC computers to do my Facebook
- I will improve my grade because of the "MM bribe formula"
- Programming requires consistent practice. Coming to an MM class section gives me an opportunity to practice my programming skills by working on my assignments.
A: I can watch video lectures with "Ear buds" and ask questions whenever something needs clarification.; I can work on assignments and get timely help when I am stuck; I will improve my grade because of the "MM bribe formula"; Programming requires consistent practice. Coming to an MM class section gives me an opportunity to practice my programming skills by working on my assignments.

Q: When I take a test and I am allowed to access the web, then this means that I can do the following: (Check all that apply)
- I can access the Class web site(Course Content), and any links found in the class web site
- I can post a question on "Stack-Overflow" to get assistance
- I can post my completed solution on a "Web Test Bank"
- I can post my completed solution on the Discussion board associated with the class
A: I can access the Class web site(Course Content), and any links found in the class web site

Q: Which of the following is true about Mixed Mode (MM) and Distance Learning(DL) (Check all that apply)
- A DL student is not allowed in an MM section.
- A DL student can attend any MM section listed in the "Getting Help" button in Blackboard.
- MM students can show up in any MM section listed in the "Getting Help" button in Blackboard .... including the MM sections related to other classes. i.e. a cps161 student can attend an MM cps261 class.
- If an MM student gets 80% on all of his work and fails to show up to some of his MM sections, his grade will be lower than 80%.
- An MM or DL student who gets 80% on all his work will get a higher grade by attending some of the MM sections.
A: A DL student can attend any MM section listed in the "Getting Help" button in Blackboard.; MM students can show up in any MM section listed in the "Getting Help" button in Blackboard .... including the MM sections related to other classes. i.e. a cps161 student can attend an MM cps261 class.; An MM or DL student who gets 80% on all his work will get a higher grade by attending some of the MM sections.

Q: Good reasons for attending MM class meetings (Check all that apply)
- You will get answers to the tests and to hear the extra lectures that are not online.
- Provide a regular class time to make progress for those students who would otherwise procrastinate and put things off to the last minute.
- Find a job in the industry
- To do your facebook
- To allow you to pair up with another student and do the work as a group project.
- To earn MM-bribe points and to have an opportunity to ask questions as needed
A: Provide a regular class time to make progress for those students who would otherwise procrastinate and put things off to the last minute.; To earn MM-bribe points and to have an opportunity to ask questions as needed

Q: Class Participation: (check all that apply)
- To get credit for class participation, you will need to post a Question AND an Answer AND a sharing.
- A single question will give you your credit for Class Participation
- You can get credit for Class Participation by posting on the "Questions for the Instructor" discussion board.
- The Sharing discussion board can be used for sharing your phone number and address so you can meet new friends. This will count as "Class Participation".
- You can get emails when some one answers your question if you use the blackboard subscribe feature.
- You don't have to worry about the subject line because the default blackboard subject line provides the information we need.
A: A single question will give you your credit for Class Participation; You can get emails when some one answers your question if you use the blackboard subscribe feature.

Q: Group Study questions: (check all that apply)
- The instructor will be present at group study
- A trained facilitator will be present at a group study
- Group study is scheduled in class rooms that have computers.
- You can do "goto meetings" with the instructor during group study sessions
A: A trained facilitator will be present at a group study; Group study is scheduled in class rooms that have computers.

Q: Goto-meeting questions: (check all that apply)
- You can have a goto meeting anytime
- If a student calls the instructor on his office phone number during office hours, he can usually do an on the spot goto-meeting.
- Using "goto meeting", a  student can be at home and show the problem on his computer with an instructor who happens to be on campus.
- To schedule a goto meeting, a student should send an email request to the instructor for the goto meeting.
A: If a student calls the instructor on his office phone number during office hours, he can usually do an on the spot goto-meeting.; Using "goto meeting", a  student can be at home and show the problem on his computer with an instructor who happens to be on campus.; To schedule a goto meeting, a student should send an email request to the instructor for the goto meeting.

Q: Some of the course lectures are only available by attending the Mixed Mode section
- True
- False
A: False

Q: This class is the easiest class at Washtenaw Community College.
- True
- False
A: False

Q: If you are having trouble getting your program to work, the class policy recommends doing which of the following:

(check all that apply)
- Sending an email to the instructor as soon as you are stuck.
- Coming to one of the instructor's office hours.
- Calling the instructor on his office phone during an office hour.  Often it is possible to remotely debug the problem using "goto meeting".
- Coming to any of the Mixed Mode (MM) sections that the instructor has scheduled even if the meeting is for a different class than the class the student is signed up for.  Distance Learning (DL) students can also take this approach.
- Coming to a Group study session and getting help from a trained facilitator or another student in group study.
- Requesting  a "goto meeting" with the instructor during one of the  Mixed Mode (MM) sessions.  The request is done by sending an email to the instructor early enough such that the instructor sees the request before the scheduled class.
- Posting a question on one of the "Class Participation" discussion boards and hoping to get an answer from a fellow student.  It would be helpful to subscribe to the question so you will know when someone might be answering the question.
A: Coming to one of the instructor's office hours.; Calling the instructor on his office phone during an office hour.  Often it is possible to remotely debug the problem using "goto meeting".; Coming to any of the Mixed Mode (MM) sections that the instructor has scheduled even if the meeting is for a different class than the class the student is signed up for.  Distance Learning (DL) students can also take this approach.; Coming to a Group study session and getting help from a trained facilitator or another student in group study.; Requesting  a "goto meeting" with the instructor during one of the  Mixed Mode (MM) sessions.  The request is done by sending an email to the instructor early enough such that the instructor sees the request before the scheduled class.; Posting a question on one of the "Class Participation" discussion boards and hoping to get an answer from a fellow student.  It would be helpful to subscribe to the question so you will know when someone might be answering the question.

Q: Click here to see the Exceptions Shared Example

What is the output if the user enters in:
0
- NullPointer
- RuntimeException
- Array
- Exception
A: RuntimeException

Q: Click here to see the Exceptions Shared Example

What is the output if the user enters in:
1
- NullPointer
- RuntimeException
- Array
- Exception
A: Array

Q: Click here to see the Exceptions Shared Example

What is the output if the user enters in:
2
- NullPointer
- RuntimeException
- Array
- Exception
A: NullPointer

Q: Click here to see the Exceptions Shared Example

What is the output if the user enters in:
3

Assume there is no file named non_existent_file
- NullPointer
- RuntimeException
- Array
- Exception
A: Exception

Q: Click here to see the Exceptions Shared Example

What is the output if the user enters in:
4
- NullPointer
- RuntimeException
- Array
- Exception
A: RuntimeException

Q: Click here to see the Exceptions Shared Example

What is the output if the user enters in:
5
- NullPointer
- RuntimeException
- Array
- Exception
A: Exception

Q: If you add the following statement to your code:

addMouseListener( xclass );

What must be true about xclass
- xclass will extend the class MouseListener
- xclass will contain all of the methods defined in the MouseListener interface.
- xclass will be an inner class.
- xclass will contain a MouseListener class inside of it.
A: xclass will contain all of the methods defined in the MouseListener interface.

Q: If you add the following statement to your code:

addMouseListener( xclass );

Which options are possible for xclass ....

check all that apply
- xclass can be an instance of a class which extends MouseAdapter and xclass can override any of the methods in the MouseListener interface.
- If the class that this code lives in implements MouseListener, then xclass can be replaced with the java keyword "this".
- xclass can be an instance of an anonymous class which implements MouseListener
- xclass can be an instance of a class which extends the abstract class MouseListener
A: xclass can be an instance of a class which extends MouseAdapter and xclass can override any of the methods in the MouseListener interface.; If the class that this code lives in implements MouseListener, then xclass can be replaced with the java keyword "this".; xclass can be an instance of an anonymous class which implements MouseListener

Q: In the code below, we get a compile error at line 25.

Pick the code which replaces line 25 and fixes this compile error and uses the MyMouseHandler class to process Mouse Clicks.
- this.addMouseListener();
- MyMouseHandler mmh = new MyMouseHandler();
mmh.addMouseListener();
- addMouseListener( new MyMouseHandler());
- addMouseListener(this.JFrame);
A: addMouseListener( new MyMouseHandler());

Q: Pick the proper completion for the following:

You want to know when the mouse was moved or dragged. You will need some class which _______________.
- extends the MouseDraggedAbstract class
- implements the MouseDragged interface
- implements the MouseMotionListener interface
- contains the mouseDrag_or_Move routine.
A: implements the MouseMotionListener interface

Q: In the following code, someone commented out line 18

What are the consequences of having this line commented out?
- A compile error will result once Eclipse discovers that it has a class that implements MouseListener, but this class is never passed to the system.
- A runtime exception will occur when we exit the constructor, because the system will detect an unconnected MouseListener
- The System will throw an "Unhandled Mouse Click" exception when it discovers that the MouseListener is never connected.
- No Compile error or runtime error. However, when our code executes we will not be informed of Mouse clicks.
A: No Compile error or runtime error. However, when our code executes we will not be informed of Mouse clicks.

Q: Which of the following is true about the following code
- A compile error at line 11 will occur because doit needs to surround the throw statement with try-catch logic, or change it's declaration to:
void doit throws MyError1
- The program will run and generate the output "MyError1"
- The program will run and generate the output "RuntimeException"
- The program will run and generate the output "Exception"
- The program aborts with an exception
A: The program will run and generate the output "MyError1"

Q: Which of the following is true about the following code
- A compile error at line 11 will occur because doit needs to surround the throw statement with try-catch logic, or change it's declaration to:
void doit throws MyError1
- The program will run and generate the output "MyError1"
- The program will run and generate the output "RuntimeException"
- The program will run and generate the output "Exception"
- The program aborts with an exception
A: A compile error at line 11 will occur because doit needs to surround the throw statement with try-catch logic, or change it's declaration to:
void doit throws MyError1

Q: Which of the following is NOT an advantage of exception handling?
- Exception handling improves code organization by separating a method's error handling code from the body of the method.
- Exception handling allows a method to defer the handling of its errors to a previously called method.
- Exception handling improves an application's performance.
- Exception handling allows similar errors to be handled by a single handler.
A: Exception handling improves an application's performance.

Q: Which statement is true about the following code
- A compile error occurs because we need to surround line 10 with try-catch logic to catch a "FileNotFoundException"
- If the file abc.txt exists, this code will read the first line of text into the variable "s"
- If the file abc.txt exists, this code will read the first string found on the line into the variable "s"
- A compile error occurs because this code cannot throw an "IOException"
A: If the file abc.txt exists, this code will read the first line of text into the variable "s"

Q: Which statement is true about the following code
- This will not compile unless the Data class implements the FileWriteable interface
- This code will not compile unless we catch the "FileNotFoundException"
- There is a compile error because ObjectOutputStream does not have a constructor which takes a FileOutputStream as it's only parameter.
- A Binary file with the name of file.dat will be created that contains the binary contents of the array "arr"
- A compile error occurs because the Data class does not implement the methods in the Serializable interface
A: A Binary file with the name of file.dat will be created that contains the binary contents of the array "arr"

Q: On line 6, what happens if you remove the "implements Serializable"

The new line 6 would just be:
class Data
- This will not compile unless the Data class implements the FileWriteable interface
- This code will not compile unless we catch the "FileNotFoundException"
- There is a compile error because ObjectOutputStream does not have a constructor which takes a FileOutputStream as it's only parameter.
- A Binary file with the name of file.dat will be created that contains the binary contents of the array "arr"
- The ObjectOutputStream cannot be written because Data does not implement Serializable. An exception occurs instead.
A: The ObjectOutputStream cannot be written because Data does not implement Serializable. An exception occurs instead.

Q: Which of the following classes allow you to delete a file?
- FileOutputStream
- FileInputStream
- File
- FilterInputStream
- DataOutputStream
- RandomAccessFile
A: File

Q: This low level abstract class is used for writing a stream of "char"s
- OutputStream
- WriteStream
- Writer
- Output
A: Writer

Q: This class provides buffering for OutputStreams. This class has a lot of overloaded methods named either print or println.
- PrintStream
- WriteStream
- Writer
- FileStream
A: PrintStream

Q: this is a Java language keyword that allows you to launch or initiate an exception
- throws
- makeException
- throw
- catch
A: throw

Q: This interface contains no methods. However, implementing this interface in a class makes it possible to write the class to an ObjectOutputStream.
- Writeable
- Comparable
- Streamable
- Serializable
A: Serializable

Q: You can write binary class instances to this Output buffering class.
- OutputStream
- ObjectOutputStream
- FileOutputStream
- PrintStream
A: ObjectOutputStream

Q: Calling this method on a thread will allow the thread to begin executing.
- begin
- execute
- start
- runThread
A: start

Q: This class is used to create a buffering class for the Reader class. This class contains a method called readLine.
- Reader
- BufferedReader
- BufferedInputStream
- ObjectInputStream
A: BufferedReader

Q: this method needs to be implemented if your class implements the Runnable interface.
- execute
- sleep
- start
- run
A: run

Q: Most of the exceptions related to Input/Output are derived from this exception.
- FileNotFoundException
- IOException
- RuntimeException
- EofException
A: IOException

Q: Implementing this interface makes it possible for a class to have a child process associated with it.
- Executable
- Thread
- Runnable
- Serializable
A: Runnable

Q: This class can be constructed to create an OutputStream class that is associated with a file open for writing
- FileOutputStream
- FileWriter
- OutputStream
- File
A: FileOutputStream

Q: This class can be constructed to create a Writer class that is associated with a file open for writing
- FileOutputStream
- FileWriter
- OutputStream
- File
A: FileWriter

Q: This low level abstract class is used for writing a stream of bytes
- Stream
- Writer
- Output
- OutputStream
A: OutputStream

Q: This class can be constructed to create an InputStream class that is associated with a file open for reading.
- Stream
- FileReader
- FileInputStream
- Input
A: FileInputStream

Q: This class has methods that allow you to create directories, delete files, and rename files.
- FileSystem
- Directory
- fileSystem
- File
A: File

Q: This class can be constructed to create a Reader class that is associated with a file open for reading.
- FileReader
- FileInputStream
- File
- Reader
A: FileReader

Q: This low level abstract class is used for reading a stream of "char"s
- FileReader
- Reader
- FileInputStream
- InputStream
A: Reader

Q: This kind of class cannot be constructed. However, classes derived from this class can be constructed if they override the appropriate methods.
- Implementable class
- Object
- Abstract class
- Serializable
A: Abstract class

Q: You can read binary class instances from this Input buffering class.
- InputStream
- FileInputStream
- ObjectInputStream
- DataInputStream
A: ObjectInputStream

Q: This low level abstract class is used for reading a stream of bytes
- InputStream
- Reader
- FileInputStream
- ObjectInputStream
A: InputStream

Q: All Exceptions derived from this class are considered "Unchecked" and the compiler will not force you to write an special code to deal with this Exception.
- RuntimeException
- Exception
- Throwable
- ArithmeticException
A: RuntimeException

Q: this method in the Thread class is used when a thread wants to suspend itself for a specified period of time.
- run
- start
- sleep
- wait
A: sleep

Q: All Exception classes and the Error class are derived from this class
- Exception
- RuntimeException
- Throwable
- Serializable
A: Throwable

Q: this class is needed to create a child process.
- Child
- Task
- Thread
- Start
A: Thread

Q: This class implements a GUI button
- button
- GuiButton
- JButton
- JPushButton
A: JButton

Q: An instance of this class is passed to the paint method. This class has many methods related to drawing.
- Object
- Event
- Canvas
- Graphics
A: Graphics

Q: This interface is useful for identifying the location of where the user does a mouse click
- MouseEvent
- MouseListener
- MouseClick
- MousePressed
A: MouseListener

Q: This method is in the Graphics class and is useful for displaying text on a screen
- drawString
- text
- displayString
- drawListener
A: drawString

Q: this method is part of the KeyListener interface
- nextKey
- typed
- keyInput
- keyTyped
A: keyTyped

Q: this class is useful for changing the size and style of the text drawn with method drawString method.
- Text
- Display
- Font
- TypeFont
A: Font

Q: This abstract class provides the foundation for many other Java GUI classes like JButton, JTextArea
- JObject
- JComponent
- GuiObject
- JGraphics
A: JComponent

Q: This method in the Graphics class can be used to draw a circle
- drawCircle
- drawOval
- drawRound
- paintOval
A: drawOval

Q: this method is defined in the ActionListener interface.
- actionPerformed
- action
- actionEvent
- event
A: actionPerformed

Q: The _____________ contains a Java package which deals with Graphical user interfaces. The _________ uses the platform code (i.e. specific to PC, Mac, Linux) to implement components like buttons, drop down boxes, etc.

Pick the appropriate term to fill in the above blanks.
- Abstract Windowing Toolkit
- Swing software
- Drawing Toolkit
- Bios
A: Abstract Windowing Toolkit

Q: this class has methods that can provide information about a keystroke entered by the user.
- KeyStroke
- Event
- NextLine
- KeyEvent
A: KeyEvent

Q: this method returns the width and height of your JFrame
- getSize
- getHeight
- getWidth
- getScreenSize
A: getSize

Q: This interface is useful for finding out when a user clicks a button, or hits the Enter key in a JTextField class.
- EnterListener
- ActionListener
- TouchListener
- ClickListener
A: ActionListener

Q: This Java package deals with Graphical user interfaces. The original approach used platform specific code for drawing objects, but this package provided a more consistent Java approach to implementing components like buttons, drop down boxes, etc.
- awt
- swing
- java_graphics
- graphics
A: swing

Q: This class provides useful information about a particular font. For example the height size of the font can be obtained from this class.
- FontMetrics
- FontInfo
- FontSizes
- FontInformation
A: FontMetrics

Q: This method in the Graphics class can be used to draw a rectangle.
- rectangle
- drawRectangle
- drawRect
- quadralateral
A: drawRect

Q: one of the methods in the MouseListener interface
- mouseDragged
- mousePressed
- mouseMotion
- mouseEvent
A: mousePressed

Q: this method allows us to specify a class which implements the ActionListener interface.
- addActionListener
- actionListener
- add
- addListener
A: addActionListener

Q: This method is called to inform the JVM(Java Virtual Machine) that you would like your paint routine called again.
- onDraw
- paint
- invalidate
- repaint
A: repaint

Q: This interface is useful for collecting the user's keystrokes
- Scanner
- nextLine
- KeyListener
- InputListener
A: KeyListener

Q: The following block of code creates a Thread using a Runnable target:

Runnable target = new MyRunnable();
Thread myThread = new Thread (target);

Which of the following classes can be used to create the target, so that the preceding code compiles correctly?
- public class MyRunnable extends Runnable{
public void run(){ /* Some Code */}
}
- public class MyRunnable extends Object {
public void run() {/* Some Code */}
}
- public class MyRunnable implements Runnable{
public void run() {/* Some Code */}
}
- public class MyRunnable implements Thread{
public void run(){/* Some Code */}
}
A: public class MyRunnable implements Runnable{
public void run() {/* Some Code */}
}

Q: Which of the following methods is defined by the Runnable interface?
- start()
- stop()
- resume()
- run()
- sleep()
A: run()

Q: This is a class which implements the LayoutManager interface and has a philosophy of placing components in rows and columns on the screen where the cell size is the same for all components.
- ScreenGridLayout
- TableLayout
- JPanel
- GridLayout
A: GridLayout

Q: This is a class is a Container for other Components.
- JPanel
- ObjectContainer
- Package
- PackageContainer
A: JPanel

Q: This is a class which implements the LayoutManager interface and has a philosophy of placing components left to right. When it runs out of room, it starts a new "row" of components.
- StreamLayout
- RowLayout
- FlowLayout
- InputStream
A: FlowLayout

Q: This is a class which implements the LayoutManager interface and has a philosophy of placing components into optional regions. These regions are often labeled North, South, Center, etc.
- ToolBarLayout
- BorderLayout
- RegionLayout
- Regions
A: BorderLayout

Q: This method allows a Container to associate itself with a class which implements the LayoutManger interface
- setLayout
- addLayout
- layout
- add
A: setLayout

Q: This is an interface that is used for classes which are interested in managing the location and sizes of all of the components in a container.
- ComponentManager
- ComponenentListener
- LayoutManager
- LayoutListener
A: LayoutManager

Q: Pick the proper completion for the following:

You want to know when the mouse was moved or dragged. You will need some class which _______________.
- extends the MouseDraggedAbstract class
- implements the MouseDragged interface
- implements the MouseMotionListener interface
- If you have the MouseListener interface implemented in a class, just override this class and add the MouseDragged and MouseMoved routines.
A: implements the MouseMotionListener interface

Q: Which line has an error in it (Check all that apply ... there is more than 1 line that needs to be checked)?
- Line 7
- Line 8
- Line 10
- Line 11
- There are no errors
A: Line 10; Line 11

Q: There is a run time error on which line Number?
- No Errors
- Line 7
- Line 8
- Line 9
- Line 10
A: Line 10

Q: We want to sort the list object. Which of the following statements will do a sort if we add the input after the line
//Sort list
- Collections.sort((List)list);
- list.sort((ArrayList)list);
- Collection.sort((ArrayList)list);
- You must change something in lines 5 through 7
A: Collections.sort((List)list);

Q: What is the output of the above program
- A run time exception will occur during the run of this program
- 21
- 212
- The compiler will generate errors on lines 20, 21, 22
A: 212

Q: Which of the following is true?
- list will be properly sorted
- an exception will be thrown when it is discovered that the Data class does not have an equals routine
- an exception will be thrown when it is discovered that the Data class does not implement the Comparable interface
- an exception will be thrown when it is discovered that the Data class is not derived from the compareTo class
- A compile error occurs because the Collections sort routine wants a List class not an ArrayList class.
A: an exception will be thrown when it is discovered that the Data class does not implement the Comparable interface

Q: Which of the following interfaces form the framework for a
nonduplicating, unsorted, unordered collection ?
- List
- Map
- Set
- Collection
A: Set

Q: Which of the following interfaces form the framework for an
unsorted, unordered data structure that uses keys to access elements?
- List
- Map
- Set
- Collection
A: Map

Q: Which of the following interfaces form the framework for a sorted data structure that uses keys to access elements?
- SortedSet
- SortedDataStructure
- Set
- SortedMap
A: SortedMap

Q: Which of the following interfaces works well for a data structure that can be used for a queue?
- Set
- Collection
- List
- Map
A: List

- This code could create an output of
23
- This code could create an output of
233
- Because we are working with a Set class, an exception will occur on the second occurrence of:
list.add( new Data(3));
- Set classes don't have Iterators, so this program
will generate an exception when the Iterator is created.
A: This code could create an output of
23

Q: You are storing data objects in a HashSet.
Which methods must be properly implemented in your
data objects (Check all that apply)
- compareTo (implementing the Comparable interface)
- equals
- cloneable
- clone
- sort
- hashCode
A: equals; hashCode

Q: You are storing data objects in a TreeSet.
Which methods should be properly implemented in your
data objects (Check all that apply pick 2).
- compareTo (implementing the Comparable interface)
- equals
- cloneable
- clone
- sort
- hashCode
A: compareTo (implementing the Comparable interface); equals

Q: Which data structures would be helpful for creating a stack type of data structure
- HashMap
- TreeSet
- ArrayList
- HashSet
A: ArrayList

Q: Which of the following statements is true?
- The output is:
233
- The output is:
23
- We shouldn't be using an Iterator here. TreeSet does not have an appropriate Iterator.
- The second call to:
list.add( "3");

will generate an exception because a Set class only allows one instance of the same object.
A: The output is:
23

- The output will be:
MI OH
- The output will be:
Lansing Columbus
- The output will be:
MI=Lansing OH=Columbus
- A compile error occurs on the iterator call
(line number 11)
A: A compile error occurs on the iterator call
(line number 11)

Q: Why does it NOT make sense to have an ActionAdapter class?
- Because ActionEvent is a low-level event.
- Because ActionListener is rarely used by developers.
- Because the ActionListener interface defines only one method.
- Because ActionListener serves only as a base interface for the other AWT listener interfaces and should not be implemented directly.
A: Because the ActionListener interface defines only one method.

Q: Which of the following is true about this program?
- When you click on the "X" box in the upper right corner, the program says Goodbye.
- It is illegal to create a private class derived from WindowAdapter.
- It won't compile because the code doesn't implement the other
WindowListener methods (i.e. WindowOpened, WindowActivated, etc.)
- When you click on the "X" box in the upper right corner, the program throws a "Not Implemented" exception because not all WindowListener methods have been implemented.
A: When you click on the "X" box in the upper right corner, the program says Goodbye.

Q: As part of your GUI design, you want to have a dialog that contains 5 buttons arranged vertically. These buttons must take up all of the space provided by the container of the dialog. These buttons are allowed to vary in size but must be the same size as each other no matter how the dialog is resized. What strategy would be the best to use?
- null (no Layout Manager). Use Set Bounds to position the buttons in the proper locations.
- Create a FlowLayout instance and pass that instance to the setLayout() method of the dialog's container. Then add each of the 5 buttons in turn to that container by calling the add(Component c) method for that container.
- Create a BorderLayout instance and pass that instance to the setLayout() method of the dialog's container. Then add each of the 5 buttons in turn to that container by calling the add(Component c) method for that container.
- Create a GridLayout instance using the constructor GridLayout(5,1) and pass that instance to the setLayout() method of the dialog's container. Then add each of the 5 buttons in turn to that container by calling the add(Component c) method for that container.
A: Create a GridLayout instance using the constructor GridLayout(5,1) and pass that instance to the setLayout() method of the dialog's container. Then add each of the 5 buttons in turn to that container by calling the add(Component c) method for that container.

Q: This class allows a Thread to bind to a TCP/IP port number and receive connect requests from clients who desire the service provided with this application
- TcpIp
- InetAddr
- Socket
- ServerSocket
A: ServerSocket

Q: If an exception is derived from this class, then the compiler won't force you to check for these exceptions.
- Exception
- RuntimeException
- Throwable
- CheckedException
A: RuntimeException

Q: This I/O class allows you to write Class Objects to it that implement the Serializable interface.
- DataOutputStream
- PrintStream
- BufferedOutputStream
- ObjectOutputStream
A: ObjectOutputStream

Q: This class is useful for a Client that wants to connect to a TCP/IP service.
- Socket
- Connection
- ObjectOutputStream
- OutputStream
A: Socket

Q: This class allows you to read objects from an I/O stream. All objects read must implement the Serializable interface.
- DataInputStream
- Scanner
- ObjectInputStream
- BufferedInputStream
A: ObjectInputStream

Q: You would call this method inside a synchronized method when you can't progress until something else happens.
By making this call you can suspend execution until the desired operation occurs.
- notify
- wait
- sleep
- run
A: wait

Q: The method is called to wake up ONE thread waiting for some event.
- start
- schedule
- run
- notify
A: notify

Q: This method is called to wake up ALL threads waiting for some event.
- notifyall
- notify
- synchronized
- wait
A: notifyall

Q: Placing this Java reserved word on a method allows us to properly deal with problems that occur when 2 threads simultaneously access a method in an object.
- transient
- protected
- synchronized
- volatile
A: synchronized

Q: Which of the following is true about the Model View Controller (MVC) programming pattern:
- In the Networked games demo'ed in this class(i.e. TicTacToe, RockPaperScissors, etc.), the same class was used for the View and the Controller of the MVC (Model View Controller) programming pattern.
- In the Networked games demo'ed in this class(i.e. TicTacToe, RockPaperScissors, etc.), the "MyGame" class contained the Model in the MVC programming pattern.
- In the Networked games demo'ed in this class(i.e. TicTacToe, RockPaperScissors, etc.), the "MyGame" class contained the View in the MVC programming pattern.
- In the Networked games demo'ed in this class(i.e. TicTacToe, RockPaperScissors, etc.), the "MyUserInterface" class contained the Model in the MVC programming pattern.
A: In the Networked games demo'ed in this class(i.e. TicTacToe, RockPaperScissors, etc.), the same class was used for the View and the Controller of the MVC (Model View Controller) programming pattern.; In the Networked games demo'ed in this class(i.e. TicTacToe, RockPaperScissors, etc.), the "MyGame" class contained the Model in the MVC programming pattern.

Q: Which of the following is true about the Model View Controller(MVC) pattern:
- Updating the Screen is done in the Controller portion.
- Updating the Screen is done in the Model portion
- Updating the Screen is done in the View portion
- Updating the Screen can be done in either the Controller, View, or the Model.
A: Updating the Screen is done in the View portion

Q: If you are trying to create a Networked game you are likely to need a Thread to create effects like bouncing balls (i.e. Quick-Click game example).  Where in the MVC (Model View Controller) pattern would you likely place the code that contains this Thread.
- View
- Model
- Controller
- The Thread would work equally well in either of the MVC locations (i.e. View, Controller or Model).
A: Model

Q: Using the ServerSocket class, and the Socket class you can do which of the following:
- You can reliably send and receive information using TCP/IP.
- Create Threads that solve the "Dining Philosophers" problem
- You can provide the foundation for implementing protocols like Http, FTP, or even Rock Paper Scissors.
- You can open up files that live on your hard drive.
A: You can reliably send and receive information using TCP/IP.; You can provide the foundation for implementing protocols like Http, FTP, or even Rock Paper Scissors.

Q: In this course we have shown that ServerSockets are useful for providing Server code for protocol handlers like Http, Rock-Paper-Scissors, etc..  If you were to write a protocol handler and you were using the ServerSocket class, what is the method you would call to wait for an incoming connection to your protocol hander?
- wait
- accept
- read
- readLine
A: accept

Q: Which Input/Output classes could be used by a Protocol Handler (i.e. Http,  Rock-Paper-Scissors, FTP,gameNet, etc. ) could be used to send and receive data using Sockets (check all that apply):
- Scanner
- PrintStream
- ObjectInputStream
- ObjectOutputStream
A: Scanner; PrintStream; ObjectInputStream; ObjectOutputStream

Q: In the Networked Game Project (JH7), which of the following are good ideas:
- Create your game first to get a prototype running.

Then figure out what is required in gameNet and adapt your code to match the gameNet interface.
- Static variables are helpful because they simplify the hard work of using objects.
- Defining the MyGameInput, MyGameOutput, MyGame classes as Serializable classes.
- If you have a user interface that includes buttons, it simplifies things if you can define your JButton classes in the Model so multiple clients can have the same view of the buttons.
A: Defining the MyGameInput, MyGameOutput, MyGame classes as Serializable classes.