Loading
notes intro/old submit AP Problems the dump links
 

Quiz 27 Recursion

 

id:

 

public recur (int x)
{
   if (x<=1)
        System.out.print(x);
   else     
   {
	   System.out.print(x);
       recur(x-1);
       System.out.print(x);
   }
}    
 
              

 

1. What would be printed if recur(-5) is called?

2. What would be printed if recur(3) is called?

public recur2 (int x)
{
   if (x<=100)
       recur2(x+1);
   
}    
 

3.When will recur2 above be an infinite loop

always

never

if x is less than 100

if x is more than 100