JDVP Activity

JDVP Activity

12th Grade

20 Qs

quiz-placeholder

Similar activities

Basics of Data Structure

Basics of Data Structure

University

20 Qs

Data Structure Quiz-1

Data Structure Quiz-1

University

22 Qs

Basic Data Structures - Intro to CS

Basic Data Structures - Intro to CS

12th Grade

15 Qs

Arrays in Java

Arrays in Java

9th - 12th Grade

20 Qs

APCSA Arrays

APCSA Arrays

9th - 12th Grade

20 Qs

Pre - TEST

Pre - TEST

University

15 Qs

Ap computer science a

Ap computer science a

1st - 12th Grade

15 Qs

Java Arrays

Java Arrays

9th - 12th Grade

20 Qs

JDVP Activity

JDVP Activity

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Elizabeth Dumaran

Used 2+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the ArrayList nums if it is initially [5, 3, 1] and the following code is executed?

nums.add(6);

nums.add(0, 4);

nums.remove(1);

[4, 3, 1, 6]

[5, 3, 1, 6]

[4, 3, 6]

[4, 5, 3, 6]

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which statement below is the correct way to retrieve the first element in the nums ArrayList?

nums.get(0)

nums[0]

nums(0)

nums[1]

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Given the ArrayList nums with the values [3, 7, 6, 0], what code below is the proper way to change the 7 to be a 5?

nums.set(1, 5)

nums.set(7, 5)

nums.set(5, 2)

nums[2] = 5

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Given the nums ArrayList with the values [5, 4, 3, 2], what statement below removes the value 3 from the list?

nums.remove(2)

nums.remove(3)

nums.get(2) = null

nums.remove(1)

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Given the nums ArrayList with the values [1, 2, 3, 4, 6], what code below can be used to add a 5 between the 4 and 6 in the list?

nums.add(4, 5)

nums.add(5, 4)

nums.add(5, 5)

nums.add(5)

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will print when the following code executes?

ArrayList<Integer> list = new ArrayList<Integer>();

list.add(7);

list.add(8);

list.add(9);

System.out.println(list.remove(0));

7

8

9

0

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is printed?

ArrayList<Integer> alist;

alist = new ArrayList<Integer>();

alist.add(1);

alist.add(2);

alist.remove(1);

alist.add(1, 3);

alist.set(1, 4);

alist.add(5);

System.out.println(alist);

[1, 4, 5]

[1, 4, 3, 5]

[2, 4, 5]

[2, 4, 3, 5]

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?