Java Quiz 2

Java Quiz 2

University

40 Qs

quiz-placeholder

Similar activities

A4ALGU CLUB EVENT QUIZ

A4ALGU CLUB EVENT QUIZ

University

40 Qs

CC103 - Week 14

CC103 - Week 14

University

40 Qs

[Sun*_Internship] Web Backend Quizzes

[Sun*_Internship] Web Backend Quizzes

University

35 Qs

Techno Excellent

Techno Excellent

University

40 Qs

Exception in Java

Exception in Java

University

41 Qs

Java Programming

Java Programming

University

40 Qs

Arrays and ArryList

Arrays and ArryList

University

40 Qs

Data Structures and Algorithms Quiz

Data Structures and Algorithms Quiz

University

40 Qs

Java Quiz 2

Java Quiz 2

Assessment

Quiz

Computers

University

Hard

Created by

Omphile Mosingathi

Used 3+ times

FREE Resource

40 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What package does ArrayList belong to?

A. java.io

B. java.util

C. java.lang

D. java.net

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary advantage of using an ArrayList over an array?

A. Fixed size

B. Dynamic size

C. Faster access

D. Less memory usage

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to add an element to an ArrayList?

A. insert()

B. append()

C. add()

D. put()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

ArrayLists cannot store primitive types directly. What should be used instead?

A. Primitive Wrappers

B. Collections

C. Arrays

D. Interfaces

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct way to create an ArrayList of integers?

A. ArrayList<int> list = new ArrayList<>();

  • B. ArrayList<Integer> list = new ArrayList<>();

C. ArrayList<Int> list = new ArrayList<>();

D. ArrayList<int[]> list = new ArrayList<>();

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you sort an ArrayList in Java?

A. Collections.sort()

B. Arrays.sort()

C. List.sort()

D. ArrayList.sort()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method is used to remove an element from an ArrayList?

A. delete()

B. remove()

C. erase()

D. cut()

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?