Question
Question 5 In this declaration: ArrayList polygon; what is the data type of the variable 'polygon'? ArrayList ArrayList Point None of the above Array Question
Question 5
In this declaration: ArrayList
ArrayList |
ArrayList |
Point |
None of the above |
Array |
Question 6
If this method call: myList.size() returns the value 7, what is the range of legal values allowed for the variable x in the following method call? myList.get( x )
x may be any int value |
1 thru 7 |
0 thru 7 |
0 thru 6 |
Question 7
Assume that the following code has been executed (same for Questions 7 thru 10):
ArrayListplot = new ArrayList (); Point p = new Point( 12, 16 ); plot.add( p ); plot.add( new Point( 0, 0 ) ); plot.add( new Point( 4, 8 ) ); plot.add( 2, new Point( 5, 10 ) ); p = plot.get( 0 ); p = plot.remove( 1 ); plot.add( new Point( -5, 5 ) );
What value is returned by the following expression? plot.size()
2 |
0 |
4 |
5 |
3 |
Question 8
Assume that the following code has been executed (same for Questions 7 thru 10):
ArrayListplot = new ArrayList (); Point p = new Point( 12, 16 ); plot.add( p ); plot.add( new Point( 0, 0 ) ); plot.add( new Point( 4, 8 ) ); plot.add( 2, new Point( 5, 10 ) ); p = plot.get( 0 ); p = plot.remove( 1 ); plot.add( new Point( -5, 5 ) );
Which Point is returned by the following expression? plot.get( 1 )
0,0 |
4,8 |
5,10 |
12,16 |
None -- the statement throws a runtime exception |
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