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
Ivan
3 years ago
11

Consider the code below. Note that the catch statements in the code are not implemented, but you will not need those details. As

sume filename is a String, x is an int, a is a double array and i is an int. Use the comments i1, i2, i3, e1, e2, e3, e4, e5 to answer the question (i for instruction, e for exception handler).
try {

BufferedReader infile = new BufferedReader(new FileReader(filename)); // i1
int x = Integer.parseInt(infile.readLine( )); // i2
a[++i] = (double) (1 / x); // i3 }
catch (FileNotFoundException ex) {...} // e1
catch (NumberFormatException ex) {...} // e2
catch (ArithmeticException ex) {...} // e3
catch (ArrayIndexOutOfBounds ex) {...} // e4
catch (IOException ex) {...} // e5
Computers and Technology
1 answer:
Dmitriy789 [7]3 years ago
6 0

Missing Part of Question

An exception raised by the instruction in i3 would be caught by the catch statement labeled?

Answer:

e3 and e4.

Explanation:

The instruction tag i3 points to the following code segment

a[++i] = (double) (1 / x); // i3

The code segment above performs arithmetic operation (double)(1/x)

And then assigns the value of the arithmetic operations to an array element a[++I]

It's possible to have one or both of the following two exceptions.

1. Error in Arithmetic Operation

2. Index of Array out of bound

These are both represented in exception tags e3 and e4

catch (ArithmeticException ex) {...} // e3

catch (ArrayIndexOutOfBounds ex) {...} // e4

Exception e3 can arise when the program try to carry out invalid arithmetic operation.

For instance, 1/0 or 0/0.

This will lead to ArithmeticException to be thrown

Exception e4 can arise when the program tries to assign values to an index that's not in an array.

Say, the total index in a given array a is 5.

The index of this array is 0 to 4; i.e. a[0] to a[4]

The moment the program tries to assign values to array element other than the ones I listed above (e.g a[5]) ArrayIndexOutOfBounds exception will be thrown

You might be interested in
Addition and subtraction are considered to be ____ operations performed by a computer.
Natali5045456 [20]

Answer:

Mathematical operations

4 0
3 years ago
1:A presentation program which is developed by Microsoft
LekaFEV [45]
Option 3: PowerPoint.
4 0
2 years ago
Read 2 more answers
Mary has cleaned her data and is ready to determine the most efficient bus route. She starts by splitting the city into four reg
igomit [66]

ANSWER:

B.

Transforming the data might help Mary notice a different pattern that makes a bigger impact on bus routes than regions of the City.

EXPLANATION:

Mary can check if there are other things or factors that might influence where the bus routes need to be prioritized. For example if the students' age is considered for the bus routes instead of regions. She can achieve this by

By Re-sorting or Transforming the data.

That is to say she will be able to find out if it is only region or if there are different patterns that makes bigger impacts on bus routes, by transforming the data.

8 0
3 years ago
Using the flowchart diagram, identify the decision point of this solution. Identify vendors. Calculate amount due. Determine dat
andreev551 [17]

Answer:

answer is "is there an early pay discount"

Explanation:

3 0
3 years ago
Read 2 more answers
What is the contents of the vector names after the following statements? vector names; names.push_back(“Ann”); names.push_back(“
SIZIF [17.4K]

Answer:

ann, cal

Explanation:

4 0
2 years ago
Other questions:
  • For local travel addresses and street names should be
    14·1 answer
  • When you save a Notepad file for the first time, you must also A. print a copy for your records. B. give it a name. C. check the
    11·1 answer
  • The Circle of Growth
    10·1 answer
  • Use fuel with the _____________ rating recommended by your vehicle manufacturer. A ) Converter B) Emission C) Exhaust D) Octane
    9·2 answers
  • EASY POINTS who is your favorite in family<br> 1. mom<br> 2. dad<br> 3. sister<br> 4. brother
    10·2 answers
  • A university with remote campuses, which all use different service providers, loses Internet connectivity across all locations.
    12·1 answer
  • Need answer ASAP
    14·1 answer
  • I dont know how to put the negative sigh on my computer
    5·2 answers
  • Assume that students in a course are required to produce a written report on an ICT-related
    14·1 answer
  • A technician wants to replace a failing power supply on a high-end gaming computer. which form factor should the technician be l
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!