Vidyalelo
Java Programming · all questions

Interfaces and Abstract Classes
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

309

Questions

7/16

Page

Pick an option on a question to see the right answer and solution.

Which of these is a super class of Character wrapper?

Select an option to see the answer and solution.

Which of this package is used for invoking a method remotely?

Select an option to see the answer and solution.

Which of these packages contain all the Java's built in exceptions?

Select an option to see the answer and solution.

What will be the output of the following Java code?
class Output 
{
    public static void main(String args[]) 
    {
        byte a[] = { 65, 66, 67, 68, 69, 70 };
        byte b[] = { 71, 72, 73, 74, 75, 76 };  
        System.arraycopy(a , 0, b, 0, a.length);
        System.out.print(new String(a) + " " + new String(b));
    }
}

Select an option to see the answer and solution.

Which of these class is used to create user defined exception?

Select an option to see the answer and solution.

Which of these methods returns the total number of bytes of memory available to the program?

Select an option to see the answer and solution.

What does System.getProperty("variable") return?

Select an option to see the answer and solution.

Which of these package provides the ability to read and write in Zip format?

Select an option to see the answer and solution.

Which of these is a wrapper for simple data type char?

Select an option to see the answer and solution.

Which of function return absolute value of a variable?

Select an option to see the answer and solution.

Which of these is a wrapper for simple data type float?

Select an option to see the answer and solution.

What will be the output of the following Java code?
class Output
{
    public static void main(String args[])
    {
        Double i = new Double(257.578);  
        int x = i.intValue();
        System.out.print(x);
    }
}

Select an option to see the answer and solution.

What will be the output of the following Java code?
class A 
{
     int x;
     int y;
     void display() 
     {
          System.out.print(x + " " + y);
     }
}
class Output 
{
     public static void main(String args[]) 
     {
         A obj1 = new A();
         A obj2 = new A();
         obj1.x = 1;
         obj1.y = 2;
         obj2 = obj1.clone();
         obj1.display();
         obj2.display();
     }
}

Select an option to see the answer and solution.

What will be the output of the following Java code?
class Output 
{
     public static void main(String args[]) 
     {
         double x = 3.14;  
         int y = (int) Math.abs(x);
         System.out.print(y);
     }
}

Select an option to see the answer and solution.

Which of these methods of Byte wrapper can be used to obtain Byte object from a string?

Select an option to see the answer and solution.

What will be the output of the following Java program?
class newthread implements Runnable 
{
Thread t;
    newthread() 
    {
        t = new Thread(this,"New Thread");
        t.start();
}
public void run()
    {
        t.setPriority(Thread.MAX_PRIORITY);	
        System.out.println(t);
}
}
class multithreaded_programing 
{
    public static void main(String args[]) 
    {
        new newthread();        
    }
}

Select an option to see the answer and solution.

Which of these method returns a smallest whole number greater than or equal to variable X?

Select an option to see the answer and solution.

What will be the output of the following Java code?
class Output 
{
     public static void main(String args[]) 
     {
         double x = 3.14;  
         int y = (int) Math.ceil(x);
         System.out.print(y);
     }
}

Select an option to see the answer and solution.

Which of this package is used for handling security related issues in a program?

Select an option to see the answer and solution.

What will be the output of the following Java program?
class Output 
{
    public static void main(String args[]) 
    {
        Long i = new Long(256);  
        System.out.print(i.hashCode());
    }
}

Select an option to see the answer and solution.