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
Tfuuvj vjiibjoon Ghosh kpj
Nookie1986 [14]

Answer: A

Explanation: For any formal document you need your major points.

5 0
2 years ago
Read 2 more answers
Suppose you use Batch Gradient Descent to train a neural network and you plot the training error at every epoch. If you notice t
Phantasy [73]

Answer:

The answer is "using validation error".

Explanation:

The validation error is used to response the test for one of the queries is activated to the participant, which may not properly answer the question. These errors go up continuously after each time, the processing rate is too high and also the method is different.  

  • These errors are also unless to increase when they are actually in the problem.  
  • The training level will be that, if the learning error may not increase when the model overrides the learning set and you should stop practicing.
6 0
2 years ago
Write a function: function solution(N); that, given a positive integer N, prints the consecutive numbers from 1 to N, each on a
koban [17]

Answer:

<em>The program written in Python is as follows:</em>

def solution(N):

     concat = ""

     for i in range(1,N+1):

           if not(i%2 == 0 or i%3 ==0 or i%5 == 0):

                 print(str(i))

           else:

                 if i%2 == 0:

                       concat= concat+"Codility"

                 if i%3 == 0:

                       concat= concat+"Testers"

                 if i%5 == 0:

                       concat= concat+"Coders"

                 print(concat)

                 concat = ""

N = int(input("Enter a positive integer: "))

solution(N)

Explanation:

This line declares the function

def solution(N):

This line initializes a variable named concat to an empty string

     concat = ""

This line iterates from 1 to the input integer

     for i in range(1,N+1):

<em>This line checks if the current number of iteration is divisible by 2,3 or 5, if no, the number is printed</em>

           if not(i%2 == 0 or i%3 ==0 or i%5 == 0):

                 print(str(i))

<em>If otherwise</em>

           else:

<em>This lines checks if current number is divisible by 2; if yes the string "Codility" is concatenated to string concat</em>

                 if i%2 == 0:

                       concat= concat+"Codility"

<em>This lines checks if current number is divisible by 3; if yes the string "Testers" is concatenated to string concat</em>

<em>                 </em> if i%3 == 0:

                       concat= concat+"Testers"

<em>This lines checks if current number is divisible by 2; if yes the string "Coders" is concatenated to string concat</em>

                 if i%5 == 0:

                       concat= concat+"Coders"

<em>The concatenated string is printed using this line</em>

                 print(concat)

This variable concat is intialized back to an empty string

                 concat = ""

The main method starts here

N = int(input("Enter a positive integer: "))

This line calls the defined function solution

solution(N)

6 0
3 years ago
Pleaseee need help ASAP!!<br><br> Will mark BRAINLIEST!! :)
torisob [31]

Answer:

The correct option is Option B

Explanation:

We need to find examples of client-side code.

Client Side code: The part of code, that doesn't require server for performing specific task

SO, The correct option is Option B

Prompt for special characters in user name

Reason: We can use alert to generate prompt using JavaScript or through validation and it can be done on client side.

All other options, we need to hit the server to perform the task, So they are not client-side code.

6 0
2 years ago
Need help asap<br> give the correct answer!!
blagie [28]
It’s either b or c, but my final answer would be C
4 0
2 years ago
Read 2 more answers
Other questions:
  • What is a quick way to close the header or footer view in a microsoft word document?
    12·1 answer
  • What are three reasons teens might start drinking alcohol??
    7·2 answers
  • List the names of 3 computer scientists
    6·2 answers
  • What part of the code is a signal for the function to execute and pass back a value?
    11·2 answers
  • "The ____________________ function is a logical function that returns a TRUE value if any of the logical conditions are true and
    14·1 answer
  • In the well-known ____________________ attack, an attacker monitors (or sniffs) packets from the network, modifies them, and ins
    9·1 answer
  • adding ______around calculations indicates which calculations should be performed first before following the typical order of op
    6·1 answer
  • What does a page break do?
    13·1 answer
  • In terms of CPU scheduling metrics, __________ is the time at which the job completes minus the time at which the job arrived in
    10·1 answer
  • 3. Special keys labelled Fl to F12.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!