subject

Consider the following statement, which is intended to create an ArrayList named a to store only elements of type Thing. Assume that the Thing class has been properly defined and includes a no-parameter constructor. ArrayList a = /* missing code */;
Which of the following can be used to replace /* missing code */ so that the statement works as intended?
a. new Thing().
b. new ArrayList().
c. new ArrayList(Thing).
d. new ArrayList().
e. new ArrayList<>(Thing).
2. Consider the following statement, which is intended to create an ArrayList named numbers that can be used to store Integer values. ArrayList numbers = /* missing code */;Which of the following can be used to replace /* missing code */ so that the statement works as intended?new ArrayList()new ArrayListnew ArrayList()A. III only.
B. I and II only. C. I and III only. D. II and III only. E. I, II, and III.3. Consider the following statement, which is intended to create an ArrayList named arrList to store elements only of type String./* missing code */ = new ArrayList();Which of the following can be used to replace /* missing code */ so that the statement works as intended?A. ArrayList arrList().B. ArrayList arrList.
C. ArrayList<> arrList.
D. ArrayList arrList.
E. ArrayList arrList.4. Consider the following code segment. ArrayList nums = new ArrayList<>();nums. add(3);nums. add(2);nums. add(1);nums. add(0);nums. add(0, 4);nums. set(3, 2);nums. remove(3);nums. add(2, 0);Which of the following represents the contents of nums after the code segment has been executed?A. [2, 4, 3, 2, 0].B. [3, 2, 0, 1, 0].C. [4, 2, 0, 2, 0].D. [4, 3, 0, 2, 0].E. [4, 3, 0, 3, 0].5. Consider the following code segment. ArrayList syllables = new ArrayList();syllables. add("LA");syllables. add(0, "DI");syllables. set(1, "TU");syllables. add("DA");syllables. add(2, syllables. get(0));syllables. remove(1);System. out. println(syllables. toString());What is printed as a result of executing the code segment?A. [DI, DA, DI].
B. [DI, DI, DA].C. [LA, LA, DA].
D. [TU, DI, DA].E. [TU, TU, DA].6. Consider the following code segment. ArrayList vals = new ArrayList();vals. add(vals. size(), vals. size());vals. add(vals. size() - 1, vals. size() + 1);vals. add(vals. size() - 2, vals. size() + 2);System. out. println(vals. toString());What is printed as a result of executing the code segment?A. [0, 1, 2].B. [0, 2, 4].C. [1, 2, 3].D. [2, 1, 0].E. [4, 2, 0].

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. andy received a potentially infected email that was advertising products. andy is at risk of which type of security threat? a. spoofing b. sniffing c. spamming d. phishing e. typo-squatting
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
How many points do i need before i can send a chat
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
Write the pseudo code for this problem based on what you learned from the video. the purpose is to design a modular program that asks the user to enter a distance in kilometers, and then converts that distance to miles. the conversion formula is as follows: miles = kilometers x 0.6214
Answers: 3
question
Computers and Technology, 24.06.2019 12:00
An npn transistor is correctly biased and turned on if the a. base is negative. b. collector is negative. c. collector is positive with respect to the emitter and negative with respect to the base. d. collector is the most positive lead followed by the base.
Answers: 1
You know the right answer?
Consider the following statement, which is intended to create an ArrayList named a to store only ele...
Questions
question
Mathematics, 31.05.2020 09:57
question
English, 31.05.2020 09:57
question
Mathematics, 31.05.2020 09:57
question
English, 31.05.2020 09:57
question
Mathematics, 31.05.2020 09:57
question
Mathematics, 31.05.2020 09:57
Questions on the website: 13722362