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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started