Question
Question 100.05 pts Assume that the following code has been executed (same for Questions 7 thru 10) : ArrayList plot = new ArrayList (); Point
Question 100.05 pts
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( 5 )
5,10 |
-5,5 |
The value null is returned |
None -- the statement throws a runtime exception |
4,8 |
Flag this Question
Question 110.05 pts
Assume that the following code has been executed (same for Questions 11 thru 14):
ArrayListnums = new ArrayList (); nums.add( 12 ); nums.add( 32 ); nums.add( 15 ); nums.add( 2, 11 ); nums.add( 6 ); int s = nums.size() ; int sum = 0; Iterator it = nums.iterator(); while( it.hasNext() ) { int n = it.next(); if ( n % 2 == 1 ) sum = sum + n; } nums.remove( 0 );
What is the value of the variable 's'?
5 |
6 |
7 |
2 |
4 |
Flag this Question
Question 120.05 pts
Assume that the following code has been executed (same for Questions 11 thru 14):
ArrayListnums = new ArrayList (); nums.add( 12 ); nums.add( 32 ); nums.add( 15 ); nums.add( 2, 11 ); nums.add( 6 ); int s = nums.size(); int sum = 0; Iterator it = nums.iterator(); while( it.hasNext() ) { int n = it.next(); if ( n % 2 == 1 ) sum = sum + n; } nums.remove( 0 );
What is the value of the variable 'sum'?
78 |
76 |
15 |
26 |
50 |
Flag this Question
Question 130.05 pts
Assume that the following code has been executed (same for Questions 11 thru 14):
ArrayListnums = new ArrayList (); nums.add( 12 ); nums.add( 32 ); nums.add( 15 ); nums.add( 2, 11 ); nums.add( 6 ); int s = nums.size(); int sum = 0; Iterator it = nums.iterator(); while( it.hasNext() ) { int n = it.next(); if ( n % 2 == 1 ) sum = sum + n; } nums.remove( 0 );
How many elements remain on the list when the code is finished executing?
6 |
5 |
1 |
7 |
4 |
Flag this Question
Question 140.05 pts
Assume that the following code has been executed (same for Questions 11 thru 14):
ArrayListnums = new ArrayList (); nums.add( 12 ); nums.add( 32 ); nums.add( 15 ); nums.add( 2, 11 ); nums.add( 6 ); int s = nums.size(); int sum = 0; Iterator it = nums.iterator(); while( it.hasNext() ) { int n = it.next(); if ( n % 2 == 1 ) sum = sum + n; } nums.remove( 0 );
What is the value of the first element remaining on the list?
6 |
32 |
11 |
12 |
15 |
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