Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
Java All : Basic Loop Types


Exam Paper Problems

Infinite Loop #3920

( As In Exam - ICSE2014 )

What is an infinite loop? Write an infinite loop statement.

What is an infinite loop? Write an infinite loop statement.

while do-while comparison #4042

( As In Exam - ICSE2018 )

State the difference between while and do while

State the difference between while and do while loop.

for loop output #4071

( As In Exam - ICSE2018 )

Give the output of the following program segment and also mention how many t

Give the output of the following program segment and also mention how many times the loop is executed:
int i;
for (i=5;i>10;i++)
System.out.println(i);
System.out.println(i*4);

while to for conversion #4246

( As In Exam - ICSE2016 )

Convert the following while loop to the corresponding for loop :

int m

Convert the following while loop to the corresponding for loop :

int m = 5, n = 10;
while (n>=1)
{
System.out.println(m*n);
n- -;
}

for loop output and execution count #4252

( As In Exam - ICSE2016 )

Analyze the given program segment and answer the following questions :

Analyze the given program segment and answer the following questions :
(i) Write the output of the program segment
(ii) How many times does the body of the loop gets executed?
for(int m=5; m<=20; m+=5)
{
if(m%3 == 0)
break;
else
if(m%5 == 0)
System.out.println(m);
continue;
}

do loop based output writing #4275

( As In Exam - ICSE2015 )

Write the output of the following code segment:

char ch;
int x = 97

Write the output of the following code segment:

char ch;
int x = 97;
do {
  ch = (char) x;
  System.out.print(ch + " ");
  if (x % 10 == 0)
    break;
  ++x;
} while (x <= 100);

 

Output Writing – For loop break #7226

( As In Exam - ICSE2017 )

Give the output of the following program segment and also mention the number

Give the output of the following program segment and also mention the number of times the loop is executed:

int a,b;
for (a = 6, b = 4; a <= 24; a = a + 6)
{
  if (a%b ==0)
    break;
}
System.out.println(a);

Do while to for conversion #7237

( As In Exam - ICSE2017 )

Convert following do-while loop into for loop.

int i=1;
int d=5;
d

Convert following do-while loop into for loop.

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



Exam Paper Problems:8 
Back