Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

If you are trying to create a Networked game you are likely to need a Thread to

ID: 3858019 • Letter: I

Question

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.

The Thread would work equally well in either of the MVC locations (i.e. View, Controller or Model).

Model

View

Controller

3 points

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 "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 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 "MyUserInterface" class contained the Model in the MVC programming pattern.

3 points

In the Networked Game Project (JH7), which of the following are good ideas:

Defining the MyGameInput, MyGameOutput, MyGame classes as Serializable classes.

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.

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.

3 points

Using the ServerSocket class, and the Socket class you can do which of the following:

You can open up files that live on your hard drive.

You can provide the foundation for implementing protocols like Http, FTP, or even Rock Paper Scissors.

You can reliably send and receive information using TCP/IP.

Create Threads that solve the "Dining Philosophers" problem

3 points

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):

ObjectInputStream

ObjectOutputStream

Scanner

PrintStream

3 points

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

read

readLine

accept

3 points

Pick the proper completion for the following:

You want to know when the mouse was moved or dragged. You will need some class which _______________.

If you have the MouseListener interface implemented in a class, just override this class and add the MouseDragged and MouseMoved routines.

implements the MouseMotionListener interface

implements the MouseDragged interface

extends the MouseDraggedAbstract class

3 points

Which of the following interfaces form the framework for an
unsorted, unordered data structure that uses keys to access elements?

List

Map

Set

Collection

3 points

Which of the following statements is true?

The second call to:
list.add( "3");

will generate an exception because a Set class only allows one instance of the same object.

The output is:
23

The output is:
233

We shouldn't be using an Iterator here. TreeSet does not have an appropriate Iterator.

3 points

Which of the following interfaces form the framework for a sorted data structure that uses keys to access elements?

SortedMap

SortedSet

SortedDataStructure

Set

3 points

Which of the following is true?

list will be properly sorted

A compile error occurs because the Collections sort routine wants a List class not an ArrayList class.

an exception will be thrown when it is discovered that the Data class is not derived from the compareTo class

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

3 points

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

Socket

InetAddr

TcpIp

ServerSocket

3 points

Which of the following interfaces works well for a data structure that can be used for a queue?

List

Map

Collection

Set

3 points

Which of the following interfaces form the framework for a
nonduplicating, unsorted, unordered collection ?

Set

Collection

List

Map

3 points

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

You must change something in lines 5 through 7

Collection.sort((ArrayList)list);

list.sort((ArrayList)list);

Collections.sort((List)list);

The Thread would work equally well in either of the MVC locations (i.e. View, Controller or Model).

Model

View

Controller

Explanation / Answer

1.

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. The Thread would work equally well in either of the MVC locations.

Option 1 is correct.

Explanation :

Since the thread main purpose is to work equally.

In this MVC pattern the thread is used to work equally well in either of the MVC locations.

2.

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.

Option 3 is correct.

Explanation :

In the Networked games demo'ed in this class which are like TicTacToe, RockPaperScissors, etc.,

The same class was used for the View and the Controller of the MVC (Model View Controller) programming pattern.

3.

In the Networked Game Project (JH7), the following are good ideas:

Option b and c correct.

4.

Using the ServerSocket class, and the Socket class you can do You can provide the foundation for implementing protocols like Http, FTP, or even Rock Paper Scissors.

Option 2 is correct.

5.

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):

Option 1 and 2 is correct.

6.

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.

Option 1 is correct.

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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote