Question: ITP 120 JAVA please show screenshot too 1.) What will be the value of x after the following code is executed? int first = 10;

ITP 120 JAVA

please show screenshot too

1.) What will be the value of x after the following code is executed?

int first = 10;

int second = 20;

while (first < 100) {

first += (++second) + 100;

}

System.out.println(++first % 9);

2.) What will be the values of x and y as a result of the following code?

int x = 25;

int y = 4;

x += y++;

3.) How many times will the following do-while loop be executed?

int value = 11;

do {

value += 20;

}while (value > 100);

System.out.println(value);

4.) Select only the answers that apply. Which of the following steps is normally performed by a for loop?

Choosing all answers is not the correct answer.

A. update the loop control variable during each iteration

B. terminate when the loop control variable reaches a different value for each execution

C. test the loop control variable by comparing it to a maximum value when it enters the loop the first time

D. initialize the loop control variable to a starting value

5.) Given the following code snippet:

int num = 10;

for (int i = 5; i > 0; i--) {

num = (++num) - (++num) ;

if (num == -1) {

break ;

}

}

system.out.print.ln (num) ;

a. how many times would the loop be executed?

b. What is the value of num when the loop completes execution?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!