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 37 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 :)


ktidd

  • Member
  • Posts: 319
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

After a vasectomy, it takes about 12 ejaculations to clear out sperm that were already beyond the blocked area.

Did you know?

The most common childhood diseases include croup, chickenpox, ear infections, flu, pneumonia, ringworm, respiratory syncytial virus, scabies, head lice, and asthma.

Did you know?

Approximately 25% of all reported medication errors result from some kind of name confusion.

Did you know?

A good example of polar molecules can be understood when trying to make a cake. If water and oil are required, they will not mix together. If you put them into a measuring cup, the oil will rise to the top while the water remains on the bottom.

Did you know?

Alcohol acts as a diuretic. Eight ounces of water is needed to metabolize just 1 ounce of alcohol.

For a complete list of videos, visit our video library