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
Inessa [10]
3 years ago
11

In the following code segment, assume that the ArrayList numList has been properly declared and initialized to contain the Integ

er values [1, 2, 2, 3]. The code segment is intended to insert the Integer value val in numList so that numList will remain in ascending order. The code segment does not work as intended in all cases.
int index = 0;
while (val > numList.get(index))
{
index++;
}
numList.add(index, val);

For which of the following values of val will the code segment not work as intended?

a. 0
b. 1
c. 2
d. 3
e. 4
Computers and Technology
1 answer:
KATRIN_1 [288]3 years ago
8 0

Answer:

e. 4

Explanation:

The code segment will not work as intended if the value of the variable val is 4. This is because the while loop is comparing the value of the variable val to the value of each element within the numList. Since there is no element that is bigger than or equal to the number 4, this means that if the variable val is given the value of 4 it will become an infinite loop. This would cause the program to crash and not work as intended.

You might be interested in
What happens if none of the selector values match selector in a simple case expression in pl/sql
mixas84 [53]

Answer:

If no values in WHERE clauses match the result of the selector in the CASE clause, the sequence of statements in the ELSE clause executes. ... When the IF THEN statement has no ELSE clause and the condition is not met, PL/SQL does nothing instead raising an error.

Explanation:

6 0
3 years ago
How do we make a acount
IRISSAK [1]
Press sign up and put your information in there. Then it should automatically make your profile.
8 0
3 years ago
Read 2 more answers
Ways to ask for help effectively include
Step2247 [10]

Answer:

All of these choices

Explanation:

Clarity → the quality of being coherent and intelligible.

Sincerity → the quality of being free from pretense, deceit, or hypocrisy

Open mind → Open-mindedness is receptiveness to new ideas.

8 0
3 years ago
"Create a Matlab Scrapt that will take the a Matrix A and Matrix B (of AX=B), then calculate the Determinant of Matrix A, Invers
prohojiy [21]

Answer:

see explaination

Explanation:

function [] =

inverse(A,B)

da = det(A);

disp("The det of A is");

disp(da);

inva = inv(A);

disp("The inverse of A is");

disp(inva);

x = inva*B;

disp("The value of X is");

disp(x);

rk = rank(A);

disp("The rank of X is");

disp(rk);

Di = eig(A);

disp("The eigen values of A is");

disp(Di);

[V,Di] = eig(A);

disp("The eigen vectors of A are (Each column represents one column vector)");

disp(V);

end

A = [1,2;4,5];

B = [1,2;4,5];

inverse(A,B);

%ab = [num2str(t)," ",num2str(dx)," ",num2str(dy)];

%disp(ab);

4 0
3 years ago
The problem with the media giving equal air time to those who are __________ about the effects of media violence on violent beha
WINSTONCH [101]

The problem with the media giving equal air time to those who are <u>not worthy</u> about the effects of media violence on violent behaviour is that the public is then misled into thinking that the evidence for such effects is <u>strong and unbiased</u> than it actually is.

<u>Explanation:</u>

Media has an extensive impact on the public. Whatever they air reaches each and every citizen of the specified region through direct and indirect means.

The media should take precautions and make sure whatever they are showing is unbiased and supported by true facts, figures, and objective evidence.

5 0
3 years ago
Other questions:
  • Buildings must be wired to comply with the latest National Electrical Code to ensure that, with adequate maintenance, the instal
    11·1 answer
  • What are some consequences of internet addiction​
    9·1 answer
  • Open a command prompt on PC1. Issue the command to display the IPv6 settings. Based on the output, would you expect PC1 to be ab
    7·1 answer
  • In 2009, __________ accounted for 1,772 total fatalities. A. passengers riding with impaired drivers B. children hit by backing
    14·2 answers
  • Assuming 8-bit 2's complement notation, what is the result of subtracting 00001001 from 00001101?
    11·1 answer
  • A prefab allows you to reuse game objects over and over, while their component data remains intact. (1 point)
    14·1 answer
  • Mention the generation we have in computer​
    7·1 answer
  • How many total cells can a worksheet window contain? If columns are labelled alphabetically, what will be the label for the cell
    15·1 answer
  • I have a problem with my Nintendo DS lite does anyone know how to fix it?
    8·1 answer
  • What does business informWhat does business information management do?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!