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 polygon; what is the data type of the variable 'polygon'?
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 )
Question 7
Assume that the following code has been executed (same for Questions 7 thru 10):
ArrayList plot = 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()
Question 8
Assume that the following code has been executed (same for Questions 7 thru 10):
ArrayList plot = 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 )
| | None -- the statement throws a runtime exception |