Question: Question 1 ( 2 points ) What is the value of j when the above code is done executing? Assume there are no syntax errors

Question 1(2 points)
What is the value of j when the above code is done executing?Assume there are no syntax errors and the code will compile.
int j;
int total =50;
for (j =1; j <6; j++)
total = total + j;
Question 1 options:
A)
6
B)
0
C)
1
D)
55
Question 2(2 points)
What is the value of total when the loop is done? Assume there are no syntax errors and the code will compile.
int j;
int total =50;
for (j =1; j <6; j++)
total = total + j;
Question 2 options:
A)
55
B)
65
C)
50
D)
0
Question 3(2 points)
What will be printed when the user enters 10 for x and 0 for y?Assume there are no syntax errors and the code will compile.
int x;
int y;
System.out.println("Please enter a value for x: ");
x = scan.nextInt();
System.out.println("Please enter a value for y: ");
y = scan.nextInt();
while (x > y)
{
x -=3;
System.out.print (x +"");
}
System.out.println();
Question 3 options:
A)
0369
B)
10741
C)
741
D)
741-2
Question 4(2 points)
What is the value of x when the code is done executing when the user enters 10 for x and 0 for y?Assume there are no syntax errors and the code will compile.
int x;
int y;
System.out.println("Please enter a value for x: ");
x = scan.nextInt();
System.out.println("Please enter a value for y: ");
y = scan.nextInt();
while (x > y)
{
x -=3;
System.out.print (x +"");
}
System.out.println();
Question 4 options:
A)
-1
B)
-2
C)
10
D)
0
Question 5(2 points)
What is the value of y when the code is done executing when the user enters 10 for x and 0 for y??Assume there are no syntax errors and the code will compile.
int x;
int y;
System.out.println ("Enter a value for x:");
x = scan.nextInt();
System.out.println ("Enter a value for y:");
y = scan.nextInt();
while (x > y)
{
x -=3;
System.out.print (x +"");
}
System.out.println();
Question 5 options:
A)
0
B)
10
C)
-1
D)
-2
Question 6(2 points)
What are the values of count after the following code is executed? Assume there are no syntax errors and the code will compile.
int count =5;
int num =3;
do
{
if (count %2!=0)
num -=4;
else
num +=2;
count++;
}
while (count <12);
Question 6 options:
A)
0
B)
5
C)
13
D)
12
Question 7(2 points)
What is the value of num when the loop is done? Assume there are no syntax errors and the code will compile.
int count =5;
int num =3;
do
{
if (count %2!=0)
num -=4;
else
num +=2;
count++;
}
while (count <12);
Question 7 options:
A)
3
B)
12
C)
-7
D)
0

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 Programming Questions!