1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nadya [2.5K]
3 years ago
15

Consider the following code segment: ArrayList bulbs = new ArrayList(); bulbs.add(new Light()); bulbs.remove(0); bulbs.add(new L

ight()); Light b = new Light(); bulbs.add(1, b); bulbs.add(new Light()); bulbs.remove(0); bulbs.add(new Light()); bulbs.remove(2); bulbs.add(new Light()); bulbs.add(1, new Light()); After running the code, what is the size of bulbs?
Computers and Technology
2 answers:
mezya [45]3 years ago
6 0

Answer:

4

Explanation:

ArrayList bulbs = new ArrayList();

bulbs.add(new Light()); // bulbs array length equal to 1

bulbs.remove(0); // bulbs array length equal to 0

bulbs.add(new Light()); // bulbs array length equal to 1

Light b = new Light();

bulbs.add(1, b); // bulbs array length equal to 2

bulbs.add(new Light()); // bulbs array length equal to 3

bulbs.remove(0); // bulbs array length equal to 2

bulbs.add(new Light()); // bulbs array length equal to 3

bulbs.remove(2); // bulbs array length equal to 2

bulbs.add(new Light()); // bulbs array length equal to 3

bulbs.add(1, new Light()); // bulbs array length equal to 4

Scrat [10]3 years ago
4 0
To answer this, lets run through the code:

<span>ArrayList bulbs = new ArrayList(); //create a new empty list

bulbs.add(new Light()); //size of bulbs  = 1

bulbs.remove(0); //remove item at index 0. size of bulbs = 0

bulbs.add(new Light()); // size of bulbs = 1

Light b = new Light();
bulbs.add(1, b); // size of bulbs = 2

bulbs.add(new Light()); //size of bulbs = 3

bulbs.remove(0); //remove bulb at index 0. Size of bulbs = 2

bulbs.add(new Light()); size of bulbs = 3

bulbs.remove(2); //remove bulb at index 2. size of bulbs = 2

bulbs.add(new Light()); //size of bulbs = 3

bulbs.add(1, new Light()); //inserted at position 1. size of bulbs = 4

The final answer. Size of bulbs = 4.</span>
You might be interested in
Annalise received financial aid offers from two universities. Financial Analysis for Option A Costs per Year Financial Aid Packa
lara31 [8.8K]

Answer:

Option S will save her $15500

Explanation:

Room and board, someone is provided a sum of money in return for labor. The government does not ask for this money to be returned. This is earned by the student. Also, work-study is being given to the student, the fund in return of certainly part-time employment job which he/she does in free time. And hence it is clear from the above study that, A will save $15500, and hence this is the right answer as others are taken by the universities. And also B is saving $13000, and this is not an option given.

7 0
3 years ago
Read 2 more answers
Using a combination of symmetric and asymmetric key encryption, Sofia sent a report to her home office in Indiana. She received
photoshop1234 [79]

Group of answer choices.

A) the public key had been compromised.

B) the private key had been compromised.

C) the symmetric encryption key had been compromised.

D) the asymmetric encryption key had been compromised.

Answer:

C) the symmetric encryption key had been compromised.

Explanation:

Cyber security can be defined as preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.

In Cyber security, encryption is a form of cryptography and typically involves the process of converting or encoding informations in plaintext into a code, known as a ciphertext.

Typically, an information or data that has been encrypted can only be accessed and deciphered by an authorized user.

Some examples of encryption algorithms are 3DES, AES, RC4, RC5, and RSA.

Email encryption is the encryption and authentication of an email to protect the message therein from being read by any person other than the intended recipients. Thus, it protects the email from hacking or invasion by a third party.

Basically, when the message is signed with the sender's private key, the receiver can verify its authenticity using the sender's public key.

Also, encrypting the email message with the receiver's public key provides confidentiality.

In this scenario, the most likely explanation for this result is that the symmetric encryption key had been compromised.

3 0
3 years ago
What are some limitations when it comes to testing and ensuring program quality? List at
DedPeter [7]

Answer:

the two limitation i can think about is the efficiency like if there are bugs or glitches or if it can get broken into and the second one is if it is running the correct program or not a lot of people deal with this problem.

Explanation: personally these are the two i can come up with at the moment

4 0
2 years ago
Ang Kabihasnang ito ay umusbong sa rehiyon ng Timog Mexico
Westkost [7]

Answer:

nahh I'm still in disbelieve

8 0
3 years ago
TOT al<br>Name TWO examples of these settings and utilities. (2)​
natulia [17]

Answer:

A program that performs a very specific task, usually related to managing system resources.

Explanation:

Compression utilities software.

Backup utilities software.

Disk defragmentation utilities software.

Text editor.

Application software.

The General purpose Application software.

5 0
3 years ago
Other questions:
  • One reason for using social media is to develop social and professional contacts. True or False?
    9·1 answer
  • A short circuit locator should be periodically run along the cords used in a shop to check for shorts and open circuits. A.)True
    12·2 answers
  • Where does communication take place?
    12·1 answer
  • When choosing a new computer to buy, you need to be aware of what operating it uses.
    12·1 answer
  • 2.1. The stream cipher described in Definition 2.1.1 can easily be generalized to work in alphabets other than the binary one. F
    10·1 answer
  • Which two programming languages require the program to be converted into executable code using a compiler? (Choose two.)
    5·1 answer
  • The ____ data source class that reduce your need for accessing individual Data Provider class when you are connecting to an Acce
    15·1 answer
  • Spoderman memes<br> im scared-
    15·2 answers
  • It is where the home tab is located where you can view all the all the formatting purpose <br>​
    11·1 answer
  • You can use _____ to track the state of each user in the application.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!