InfyTQ Recursion Quiz 2

Question 1

Time: 00:00:00
What is the use of Observable class?

 It is used to create global subclasses

 It is used to create global subclasses

It is used to create classes that other part of the program can observe

It is used to create classes that other part of the program can observe

It is used to create classes that can be accessed by other parts of the program.

It is used to create classes that can be accessed by other parts of the program.

It is used to create methods that can be accessed by other parts of the program.

It is used to create methods that can be accessed by other parts of the program.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Which of these methods is called when the observed object has changed?

 setChanged()

 setChanged()

update()

update()

notifyObserver()

notifyObserver()

All of the mentioned

All of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Which of these interfaces is implemented by TimerTask class?

 Runnable

 Runnable

Thread

Thread

Observer

Observer

ThreadCount

ThreadCount

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What is the output of this program?

1.import java.util.*;

2.class LOCALE_CLASS {

  1. public static void main(String args[]) {

  2.   Locale obj = new Locale(“HINDI”, “INDIA”) ;

  3.   System.out.print(obj.getDisplayLanguage());

  4. }


7.}

India

India

INDIA

INDIA

HINDI

HINDI

Nothing is displayed

Nothing is displayed

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Which of these methods return a largest whole number less than or equal to variable X?

double ciel(double X)

double ciel(double X)

double floor(double X)

double floor(double X)

double max(double X)

double max(double X)

double min(double X)

double min(double X)

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What is the output of this program?

1.class recursion {

  1. int func (int n) {

  2.   int result;

  3.   if (n == 1)

  4.       return 1;

  5.   result = func (n – 1);

  6.   return result;

  7. }


9.}

10.class Output {

  1. public static void main(String args[]) {

  2.   recursion obj = new recursion() ;

  3.   System.out.print(obj.func(5));

  4. }


15.}

1

1

120

120

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Which of these methods is used to notify observers of the change in observed object?

update()

update()

notify()

notify()

check()

check()

observed()

observed()

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What’s the output of the following code ?







int doSomething(int a, int b)

{

if (b==1)

   return a;

else

   return a + doSomething(a,b-1);

}

 

    doSomething(2,3);

4

4

2

2

3

3

6

6

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What happens if base condition is not defined in recursion ?

 Stack underflow

 Stack underflow

Stack Overflow

Stack Overflow

None of these

None of these

Both a and b

Both a and b

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
int func(int a, int b){
   if(b==0)
       return 0;
   if(b==1)
       return a;
   return a + func(a,b-1);
 }

what will be the output of func(3,8)

11

11

24

24

22

22

21

21

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%