This topic contains a solution. Click here to go to the answer

Author Question: What is the output of the following fragment? for (int i = 0; i < 15; i++) {if (i % 4 == ... (Read 41 times)

debasdf

  • Hero Member
  • *****
  • Posts: 570

Question 1

What is the output of the following fragment?

int i = 1;
int j = 1;
while (i < 5) {
i++;
j = j * 2;
}
System.out.println(j);

◦ 16
◦ 64
◦ 4
◦ 8
◦ 32

Question 2

What is the output of the following fragment?

for (int i = 0; i < 15; i++) {
if (i % 4 == 1)
System.out.print(i + " ");
}

◦ 1 3 5 7 9 11 13 15
◦ 1 4 8 12
◦ 1 5 9 13 16
◦ 1 5 9 13
◦ 1 3 5 7 9 11 13


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by debasdf on May 6, 2020

olivia_paige29

  • Sr. Member
  • ****
  • Posts: 334
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 39% of students answer this correctly




debasdf

  • Member
  • Posts: 570
Reply 2 on: May 6, 2020
Great answer, keep it coming :)


31809pancho

  • Member
  • Posts: 317
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

Multiple sclerosis is a condition wherein the body's nervous system is weakened by an autoimmune reaction that attacks the myelin sheaths of neurons.

Did you know?

More than 150,000 Americans killed by cardiovascular disease are younger than the age of 65 years.

Did you know?

The human body produces and destroys 15 million blood cells every second.

Did you know?

Glaucoma is a leading cause of blindness. As of yet, there is no cure. Everyone is at risk, and there may be no warning signs. It is six to eight times more common in African Americans than in whites. The best and most effective way to detect glaucoma is to receive a dilated eye examination.

Did you know?

Many people have small pouches in their colons that bulge outward through weak spots. Each pouch is called a diverticulum. About 10% of Americans older than age 40 years have diverticulosis, which, when the pouches become infected or inflamed, is called diverticulitis. The main cause of diverticular disease is a low-fiber diet.

For a complete list of videos, visit our video library