Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java question 1. name and briefly describe three possible error scenarios that could exist when a program writes , or attempts to write , data

Java question

1. name and briefly describe three possible error scenarios that could exist when a program writes , or attempts to write , data to a file.

2.

Rewrite the following if statement, using a switch statement. selection - scanner.nextlnto:

if (selection - - 0)

System.out.println(Magenta):

else if (selection - - 1)

System.out.println(Cyan):

else if (selection - - 2)

System.out.println(Red"):

else

System.out.println(Invalid selection)

3.

What will be the value of sum after the following nested loop is executed? sum = 0; j = 0;

do {

j++;

for(int i =5; j ; i--);

} } while (i < 5);

j =5; while (i !- j)

sum + = j; j--;

}

i++

}

A) 50 B) 55 C) 60 D) 65

4.

What will be the output from the following code? class Q2Main { public static void main( String[] args) { QuestionTwo q2; q2 - new QuestionTwo() q2.init(): q2.incremento(); q2.incremento(); System.out.println( q2.getCounto());

}

}

class QuestionTwo { private int count: public void initl () { count - 1;

}

public void increment( count - count + 1;

}

public int getCountO return count;

}

}

A) 1 B) 2 C)3 D) 4 E) 5

5.

What is the problem with the following code? for (int i = 10; i > 0; i++)

{

int x = 0; int y = O; int a = 1; int b =1; x = y; a = b;

}

A)The for loop never gets executed. B) The program flow forms an endless loop. C) The i variable is never initialized. D) No problem exists in the code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

What were the issues and solutions proposed by each team?

Answered: 1 week ago

Question

Were all members comfortable brainstorming in front of each other?

Answered: 1 week ago

Question

5. What information would the team members need?

Answered: 1 week ago