Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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'?

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

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

2
0
4
5
3

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 )

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions