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
Assoli18 [71]
3 years ago
12

Write a short program that uses a for loop to populate an array. The array can store up to 10 integers. Modify the code slightly

to create a bug that would prevent the code from compiling or even better from running correctly. Be sure to describe what the code is designed to do. Monitor the post to comment when other students work to repair your code.
Computers and Technology
1 answer:
mr Goodwill [35]3 years ago
8 0

Answer:

  1. public class num16 {
  2.    public static void main(String[] args) {
  3.        //This code is designed to create and populate an array with
  4.        //Ten Integer values
  5.        Scanner in = new Scanner(System.in);
  6.        //Create the array
  7.        int [] intArray = new int [10];
  8.        //populating the array
  9.        for(int i =0; i<=10; i++){
  10.            System.out.print("Enter the elements: ");
  11.            intArray[i]= in.nextInt();
  12.        }
  13.        //Print the Values in the array
  14.        System.out.println(Arrays.toString(intArray));
  15.    }
  16. }

Explanation:

  • The above code looks like it will run successfully and give desired output.
  • But a bug has been introduced on line 9. This will lead to an exception called ArrayIndexOutOfBoundsException.
  • The reason for this is since the array is of length 10, creating a for loop from 0-10 will amount to 11 values, and the attempt to access index 10 for the eleventh element will be illegal
  • One way to fix this bug is to change the for statement to start at 1.
You might be interested in
List and describe with details at least three approaches to selecting processes from priority-based multi-level queues.
garik1379 [7]

Based on the information given, it is important to give higher priority to the queue that contains the high priority thread.

<h3></h3><h3>What is the Important Fact?</h3>
  • A lot of interrupts can take place at any time, and due to that, they cannot always be ignored as  the part of code affected by interrupts need to be guarded from constant use.
  • So, the load-balancing requirements for keeping about the same number of threads would need to be taken or retained and the important case of top priority thread would also be kept.
  • An  priority-based scheduling algorithm can handle this situation if one run queue had all high-priority threads and a second queue had all low-priority threads because if giving greater priority to the two queue that has the national priority comment section as well as, so, first method is the thread in all of the queue.
  • Multi-level queue scheduling algorithm is used in scenarios where the processes can be classified into groups based on property like process type, CPU time, IO access, memory size, etc. One general classification of the processes is foreground processes and background processes.

To learn more about multi-level refer to:

brainly.com/question/16902508

#SPJ4

6 0
1 year ago
I think it is a or c is it right?
LUCKY_DIMON [66]
C
She is emailing her boss that something is wrong.
4 0
3 years ago
Question # 4
natka813 [3]

Answer:

class

Explanation:

edg2020

4 0
3 years ago
Yesterday you installed a new game on your computer. When you ran the computer, you noticed that the application was running ver
7nadin3 [17]

Answer

The program is either unable to compute the call to check your disk space or:

You have multiple disk drives and specified a drive that is different than the one you are seeing with 250 GB.

It could also be that your RAM is insufficient for running this game.

Most likely it is your RAM specifications because of the game running slow.

The game updated its debug logs or error lists and pulled from that list when it was opened and displayed that error message.

Explanation:

4 0
3 years ago
This is used to copy information from cell to cell in the spread sheet
Kryger [21]

Answer:

D. Fill handle

Explanation:

Required

Which can be used to copy from cell to cell

(a); Means the current cell being selected in the spreadsheet program

(b): Used to fit all columns in the spreadsheet program. Usually, the columns are fitted based on their width.

(c): The vertical and horizontal lines that separate cells.

(d): This is used to copy from one cell to another, especially adjacent cells.

5 0
3 years ago
Other questions:
  • Los antivirus no son infalibles y en ocasiones pueden darnos :
    10·1 answer
  • Which organization has published more than 300 web standards
    7·1 answer
  • If some alveoli cease to act in gas exchange ( due to alveolar collapse or obstruction by mucus, for example), the ___ is added
    13·1 answer
  • An AM index between 0 and 1 indicates what? a. the AM signal is very small and will not be detected by the receiver b. distortio
    12·1 answer
  • Knowledge management software helps companies preserve the knowledge gained through the use of information so that future users
    15·2 answers
  • Find products that satisfy BOTH conditions below:______
    6·1 answer
  • Which army regulation would be referenced if you want to properly mark removable ais storage media?
    6·1 answer
  • Which of these is an example of collective voice?
    8·2 answers
  • What network problems can be solved on your<br> end?
    13·2 answers
  • A(n) ____ is a live internet presentation that supports interactive communications between the presenter and the audience.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!