Question: Question 17 Assume that the following code has been executed (same for Questions 17 thru 20) : HashMap places = new HashMap (); places.put( origin,
Question 17
Assume that the following code has been executed (same for Questions 17 thru 20):
HashMapplaces = new HashMap (); places.put( "origin", new Point() ); places.put( "east", new Point( 100, 0 ) ); places.put( "south", new Point( 0, -100 ) ); places.put( "northwest", new Point( -100, 100 ) ); places.put( "east", new Point( 200, 0 ) );
What value is returned by the following method call? places.size()
| 1 |
| 4 |
| 0 |
| 5 |
Question 18
Assume that the following code has been executed (same for Questions 17 thru 20):
HashMapplaces = new HashMap (); places.put( "origin", new Point() ); places.put( "east", new Point( 100, 0 ) ); places.put( "south", new Point( 0, -100 ) ); places.put( "northwest", new Point( -100, 100 ) ); places.put( "east", new Point( 200, 0 ) );
What value is returned by the following method call?
places.get( "south" )
| a Point object located at (100.0, 0.0) |
| null |
| a Point object located at (0.0, -100.0) |
| a Point object located at (0.0, 0.0) |
Question 19
Assume that the following code has been executed (same for Questions 17 thru 20):
HashMapplaces = new HashMap (); places.put( "origin", new Point() ); places.put( "east", new Point( 100, 0 ) ); places.put( "south", new Point( 0, -100 ) ); places.put( "northwest", new Point( -100, 100 ) ); places.put( "east", new Point( 200, 0 ) );
What value is returned by the following method call? places.get( "east" )
| a Point object located at (100.0, 0.0) |
| null |
| a Point object located at (200.0, 0.0) |
| a Point object located at (0.0, 0.0) |
Question 20
Assume that the following code has been executed (same for Questions 17 thru 20):
HashMapplaces = new HashMap (); places.put( "origin", new Point() ); places.put( "east", new Point( 100, 0 ) ); places.put( "south", new Point( 0, -100 ) ); places.put( "northwest", new Point( -100, 100 ) ); places.put( "east", new Point( 200, 0 ) );
What value is returned by the following method call? places.get( "north" )
| a Point object located at (0.0, 0.0) |
| a Point object located at (-100.0, 100.0) |
| a Point object located at (100.0, 0.0) |
| a Point object located at (0.0, 100.0) |
| null |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
