Logo

Java Questions Set 52:

Quiz Mode

Predict the output of the following Java code:

1
2
3
4

Solution:

Which of the following can operate on boolean variables

1. &&
2. ==
3. ?:
4. +=

1
2
3
4

Solution:

Choose the correct methods that return the proxy object in Hibernate?

1
2
3
4

Solution:

  Protected modifier be accessed  within the package and outside the package but through inheritance only 

1
2

Solution:

Which Java collection interface provides the capability to store objects using a key-value pair?

1
2
3
4

Solution:

what should be the output of this code block?

 public class abekus {

  public static void main(String[] args) {

   String input = " ";

   System.out.println("-" + input.trim() + "-");

  }

 }

Solution:

How many times 'abekus' is printed?

public class abekus

{

public static void main(String[] args) {

while(true);{

    System.out.println("abekus");

}

}

}

1
2
3
4

Solution:

public class testcase{

  static int x[];

  static{

      x[0]=1;

   }

 public static void main (String []args) {

   }

}




1
2
3
4

Solution:

import java.util.*;

    class output 

    {

        public static void main(String args[]) 

        {

            LinkedList set = new LinkedList();

            set.add(new Integer(3));

            set.add(new Integer(8));

            set.add(new Integer(5));

            set.add(new Integer(1));

   set.addFirst(new Integer(2));

            set.addLast(new Integer(9));

            Iterator i = set.iterator();

            Collections.reverse(set);

       Collections.shuffle(set);

  System.out.println(set.peekFirst()+" "+set.pollLast());

        }

    }

1
2
3
4
5

Solution: