Computers and Technology

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].

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:00, lizzyhearts
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print?
Answers: 1
image
Computers and Technology, 23.06.2019 19:30, carcon2019
Amitha writes up a one-page summary of a novel during her summer internship at a publishing company. when she reads over the page, she realizes she used the word “foreshadow” seven times, and she would like to reduce the repetition. which tool would best amitha solve this problem?
Answers: 3
image
Computers and Technology, 24.06.2019 16:30, laureanogabriel
What is the item which could be matched with a statement below? software installed on a computer that produces pop-up ads using your browser an example of social engineering malware loads itself before the os boot is complete type of spyware that tracks your keystrokes, including passwords windows key + l the practice of tricking people into giving out private information or allowing unsafe programs into the network or computer when someone who is unauthorized follows the employee through a secured entrance to a room or building a type of malware that tricks you into opening it by substituting itself for a legitimate program a computer that has been hacked, and the hacker is using the computer to run repetitive software in the background without the user's knowledge an infestation designed to copy itself repeatedly to memory, on drive space, or on a network
Answers: 1
image
Computers and Technology, 24.06.2019 22:10, jsjsjsskakwkowwj
Function name: poly parameters: int returns: int description: a polynomial of degree n with coefficients a0,a1,a2,a3, . . ,an is the function p(x) = a0+a1x+a2x2+a3 ∗ x3+ . . +an ∗ xn this function can be evaluated at different values of x. for example, if: p(x) = 1+2x+ x2, then p(2) = 1+2 ∗ 2+22 = 9. if p(x) = 1+x2+x4, then p(2) = 21 and p(3) = 91. write a function poly() that takes as input a list of coefficients a0, a1, a2, a3, . . , an of a polynomial p(x) and a value x. the function will return poly(x), which is the value of the polynomial when evaluated at x.
Answers: 3
Do you know the correct answer?
Consider the following statement, which is intended to create an ArrayList named a to store only ele...

Questions in other subjects: