Logo

Java Questions Set 236:

Quiz Mode

Find the output of the following Java code.

1
2
3
4

Solution:

 Byte codes are interpreted only by ?

1
2
3
4

Solution:

Where can applets be embedded?

1
2
3
4

Solution:

What is the process used to insert an element in a stack?

1
2
3
4

Solution:

Which of these methods can be used to obtain the reference to the container that generated a ContainerEvent?

1
2
3
4

Solution:

class test{

public static void main (String[] args) {

   int x=10,y=15;

   if(x==10 || ~y<15)

   {

       x--;

   }

   else

   {

       y++;    

   }

   System.out.println(x+" "+(--y));

}

}

1
2
3
4

Solution:

Which of the following is used to write objects to a stream?

1
2
3
4

Solution:

what should be the output of this code block?

 public class abekus {

  public static void main(String[] args) {

   int arr[] = {

    'a',

    'b',

    'c',

    'd',

    'e'

   };

   System.out.print(arr);

  }

 }

1
2
3
4

Solution:

What is the output of the following Java code?

import java.util.*;

class Abekus {

public static void main(String args[]) {

Formatter F = new Formatter();

F.format("%.3f", 2.00568123);

System.out.println(F);

}

}

1
2
3
4

Solution:

What is the correct output?

 class Abekus {

 public void show() {

 System.out.println("Abekus::show() called");

 }

}

class Derived extends Abekus {

 public void show() {

 System.out.println("Derived::show() called");

 }

}

public class Main {

 public static void main(String[] args) {

  Abekus a = new Abekus();;

  a.show();

 }

}

1
2
3
4

Solution: