F Consider the code segment below and answer the questions t

F. Consider the code segment below and answer the questions that follow. Listing 3: Code Segment 1 if (bottom System out println (\"Divide by 0 error\"); 3 else if (top 0 && bottom 0) System out println 0 5 else if (top 0 && bottom. 1) System out println top) 7 else if (top 0 && bottom 1) System out. println (top) 9 else System out println (top bottom

Solution

a) If top == 0 then it is not required to check for the bottom value. If top is 0 and bottom is 5 then first check is unnecessary.

b) if top is some value and bottom is 0 then it gonna be the least number of comparisons.

c) when top > 1 and bottom > 1

 F. Consider the code segment below and answer the questions that follow. Listing 3: Code Segment 1 if (bottom System out println (\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site