Ex1: What output is produced by the following code fragment? (1 pt) int num = 0,
ID: 3634635 • Letter: E
Question
Ex1: What output is produced by the following code fragment? (1 pt)int num = 0, max = 15;
while (num < max)
{
System.out.println(num);
num += 5;
}
Ex2: What output is produced by the following code fragment? (2 pts)
int n = 0, limit = 15;
while (n < limit)
{
if (n%2 == 0)
System.out.println(n);
n++;
}
Ex3: What output is produced by the following code fragment? (2 pts)
for (int i = 0; i <= 50; i +=4)
System.out.println(i);
Ex4: What output is produced by the following code fragment? (2 pts)
for (int val = 50; val >=0; val--)
if (val%5 == 0)
System.out.println(val);
Explanation / Answer
Ex 1: 0 5 10 Ex 2: 0 2 4 6 8 10 12 14 Ex 3: 0 4 8 12 16 20 24 28 32 36 40 44 48 Ex 4: 50 45 40 35 30 25 20 15 10 5 0
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.