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
zimovet [89]
2 years ago
9

Assume that you have an ArrayList variable named a containing 4 elements, and an object named element that is the correct type t

o be stored in the ArrayList.
Which of these statements adds the object to the end of the collection?1. a[3] = element;
2. a.add(element;
3. a[4] = element;
4. a.add(element);
Computers and Technology
1 answer:
jonny [76]2 years ago
7 0

Answer:

Option (4) is the correct answer.

Explanation:

In Java programming language ,array collection starts from 0 index location and ends in a size-1 index location. So to access the last elements the user needs to use a[Size-1] statement. so to modify the value of the last location of the array the user needs to use "a[size-1]= element;".

But when the user wants to add some new value to the end of the array list collection then he needs to use the statement--

a.add(element); //where add is a function, element is a value and a is a array list object.

Another option is invalid because--

  • Option 1 is not the correct because "a[3]=element;" modify the value of the 3rd element of the array.
  • Option 2 gives a compile-time error because add functions bracts are not closed.
  • Option 3 gives the error because a[4] gives the location of the 5th element of the array but the above question says that a is defined with 4 elements.
You might be interested in
Jeanne writes a song, and Raul wants to perform
Goryan [66]
B) ask jeanne for permission
6 0
3 years ago
Read 2 more answers
Which is an example of intrinsic motivation?
kkurt [141]

Answer: allowing time to do an after-school activity once studying is done

Explanation: Motivation could be explained as any event, factors or circumstances which increases an individual's willingness, zeal or strength to do something. Motivation could also be inform of incentive or reward which one stands to gain when a certain assignment or mission is accomplished.

However, Intrinsic motivation refers to a class of motivation which are triggered naturally. When a motivation is intrinsic, there is no usually no obvious and or external source of motivation, incentive or reward attached to one's quest of doing something. In the scenario above, all other options except allowing time to do an after-school activity once studying is done have a lucid external incentive which the individual stands or aims to achieve by studying.

5 0
3 years ago
Read 2 more answers
An embedded os must be developed specifically for use with embedded systems. true or false?
adoni [48]
<span>An embedded os must be developed specifically for use with embedded systems. true or false?  The answer is False.</span>
8 0
3 years ago
Which type of graph or chart will you use to show changes in data points?
likoan [24]
You would use a line graph because, line graphs show you the slope. The slope represents a change in data.
6 0
3 years ago
A case competitions database:You work for a firm that has decided to sponsor case competitions between teams of college business
Strike441 [17]

Answer:

We will ned (4) four tables.

Explanation:

For the given scenario we will have to build a relational database. The database will have four tables i.e. Competation, Collage, Team and student.

For each table the database fields are mention below. Note that foreign keys are mentioned in itallic.

Competition:

Competition_ID, Competition_Name, Competition_Data, Competition_Name _of_Branch, <em>College_ID</em>

<em />

Collage:

Collage_ID, Collage_Name, Collage_Contact, Collage_address

Team:

Name, Color, <em>Team_ID, College_ID, Competition_ID</em>

<em />

College:

Student_ID, First_Name, Last_Name, Date_of_Birth, Major, Expected_Gradiuation_Date, <em>Collage_ID, Team_ID, Competation_ID</em>

3 0
3 years ago
Other questions:
  • What is AI and its necessary types?
    6·1 answer
  • If the physical memory size is doubled without changing any of its other parameters, the number of entries in the page table
    5·1 answer
  • Hosts A and B are communicating over a TCP connection, and Host B has already received from A all bytes up through byte 126. Sup
    10·1 answer
  • What is the difference between line art and continuous tone copy?
    14·1 answer
  • What is the purpose of the "time-to-live" (TTL) field of the IPv4 packet? a. ensures that the packet remains in the network long
    6·1 answer
  • Write a C++ program that determines if an integer is a multiple of 7. The program should prompt the user to enter and integer, d
    13·1 answer
  • What is the second step when designing an algorithm?
    12·2 answers
  • Anyone on ps4 willing to trade me a fennec or McClaren on rocket league?
    6·2 answers
  • EASY What does the Backspace key do?
    6·1 answer
  • Who is the best nfl team in your mind
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!