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
Write a 2 paragraph on an African American who has become successful in IT. Need help asap can’t think of anything
Katen [24]

Answer:

wait you need 2 paragraphs on an african american that became sucessful in what? please clear this up so that i can help you

Explanation:

5 0
3 years ago
Briley has all the hardware she needs to construct a fully functional personal computer. She connects the various components and
ikadub [295]

Answer:

System software.      

Explanation:

The system software is the software which has system need to running Without the system software the computer system will not start and work simply means to interact with the computer system we need system software.  

  • Briley needs system software to connects the different parts and input-output devices, and it provides the ensuring that the computer system has a power supply available.
  • So without the System software, Briley will not interact with the computer system.
6 0
3 years ago
The n modifier after the tilde forces the index variable to expand only to the ______
KATRIN_1 [288]

Answer: filename and extension.

Explanation:

Suppose we have %~nxa, where we have two modifiers n and x, and a single variable a.

So, the n modifier after the tilde forces the index variable to expand only to the  filename(by the n modifier) and the extension(by the x modifier).

It produces the filename and extension instead of the full path.

5 0
3 years ago
What’s good and bad about having social media?
Leona [35]
Something good about it is that you can express yourself and make friends or goals for yourself. Bad because you can get hated on, friends can leave you, you can get exposed, or you can get hacked or scammed
6 0
3 years ago
Read 2 more answers
How many transponders are contained within a typical satellite?
Ilia_Sergeevich [38]

Answer:

d.

24 to 32

Explanation:

Satellite programmers broadcast, signals to the satellite which they own or lease the channel space from. Uplinked signals sent by the programmers are received by the transponder located on satellite. It is a device which receives signals and transmits them back to Earth after converting the signals to frequency which could be received by the ground-based antenna. <u>There are typically 24 to 32 transponders on a satellite. </u>

8 0
3 years ago
Other questions:
  • if the president goes for vice president after his 2 term and the present president dies is the old president the president agai
    8·2 answers
  • In internet terminology, what is the term, .com, called?
    12·2 answers
  • Write a program that asks the user to input four numbers (one at a time). After the four numbers have been supplied, it should t
    6·1 answer
  • Apple was a pioneer in user interface development, introducing the _____, complete with mouse and screen icons, in the early 198
    7·1 answer
  • A provides an easy way for workers to interact with their computers
    9·1 answer
  • Which of the following goals is likely to require funding? Check all that apply.
    6·2 answers
  • Original Problem statement from the Text: A retail company must file a monthly sales tax report listing the sales for the month
    7·1 answer
  • What takes information entered into a given system and sends it automatically to all upstream systems and processes?
    6·2 answers
  • Question #1 Mutiple Select Which features are important when you plan a program? Select 4 options. Knowing what you want the pro
    5·1 answer
  • Another term for the plot structure of the hero journey
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!