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
Given the following word addresses: 3, 180, 43, 2,191, 88, 190, 14, 181, 44, 186, 253
professor190 [17]

Answer:

A. index bits = 2, tag bits = 2, block offset bits = 1, it is a miss.

B. index bits = 2, tag bits = 1, block offset bits = 0, it is a hit

C. the miss rate is 0

Explanation:

a. number of blocks = 12

number of blocks per set = 3

number of set = number of blocks / number of blocks per set = 12/3 = 4

word size = 24

block size = 2

the block offset = log_{2} block size

   = log_{2} 2 = 1

the index bits = log_{2} number of set = log_{2} 4 = 2

the tag bits = (log_{2} word size) - offset - index = (log_{2} 24) -2 - 1 = 5 -2 - 1 = 2

b. word size = 8

block size = 1

the block offset = log_{2} block size

   = log_{2} 1 = 0

the index bits = log_{2} number of set = log_{2} 4 = 2

the tag bits = (log_{2} word size) - offset - index = (log_{2} 8) -2 - 1 = 3 - 0- 2= 1

7 0
3 years ago
What is the bleed space in a design?
pav-90 [236]

Answer:

The bleed is the part on the side of a document that gives the printer a small amount of space to account for movement of the paper, and design inconsistencies. Artwork and background colors often extend into the bleed area. After trimming, the bleed ensures that no unprinted edges occur in the final trimmed document.

Explanation:

8 0
3 years ago
What is it called when a user makes a typing error when entering a url that takes him to an imposter website?
Shtirlitz [24]
It’s called a typo squatting
6 0
3 years ago
HackerCards is a trendy new card game. Each type of HackerCard has a distinct ID number greater than or equal to 1, and the cost
joja [24]

Answer:

I don't know if this is right output is {1,3}

Explanation:

5 0
3 years ago
In Microsoft word you can access the blank command from the mini toolbar
Softa [21]
Your answer would be:
<span>
In Microsoft Word you can access the </span><span>insert citation command from the mini toolbar.</span>
3 0
4 years ago
Other questions:
  • Once Raul selects a technology solution, he has completed the process. <br> a. True<br> b. False
    13·2 answers
  • To share a document in my online electronic journal, I should select the option to _____.
    14·1 answer
  • What effect does screen resolution have on how graphics are displayed?
    7·1 answer
  • Match the expenses to their respective categories.
    6·2 answers
  • 4. How could you apply some of the ideas, principles, or structures of coding to fields of study, industries, or tasks outside o
    8·1 answer
  • Consider a hypothetical hard drive that has 400,000 cylinders, 8 heads, and 128 sectors per track. Demonstrate, in writing, how
    9·1 answer
  • Given the following class: Create a class MyGenerator that can be used in the below main method.
    8·1 answer
  • Your computer science teacher asks you to sample a black and white image that is 4” x 6”. How would you sample the image to prov
    10·1 answer
  • 1. What is the difference between the wireless network that you provide to your customers versus the wireless network that you w
    5·1 answer
  • Function of Ribbon in Access 2010​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!