41.
What will be the output of the following Java program?
class X 
{
    int a;
    double b;
}
class Y extends X 
{
int c;
}
class Output 
{
    public static void main(String args[]) 
    {
        X a = new X();
        Y b = new Y();
        Class obj;
        obj = a.getClass();
        System.out.print(obj.getName());
    }
}

43.
What will be the output of the following Java code?
class isinfinite_output 
{
    public static void main(String args[]) 
    {
        Double d = new Double(1 / 0.);  
        boolean x = d.isInfinite();
        System.out.print(x);
    }
}

44.
What will be the output of the following Java program?
class X 
{
    int a;
    double b;
}
class Y extends X 
{
int c;
}
class Output 
{
    public static void main(String args[]) 
    {
        X a = new X();
        Y b = new Y();
        Class obj;
        obj = b.getClass();
        System.out.print(obj.isLocalClass());
    }
}

46.
Which of the following is an incorrect statement about packages?

48.
What will be the output of the following Java program?
class Output 
{
    public static void main(String args[])
    {
  Double i = new Double(257.578123456789);  
        float x = i.floatValue();
        System.out.print(x);
    }
}

49.
What will be the output of the following Java program?
import java.io.*;
class Chararrayinput 
{
    public static void main(String[] args) 
    {
  String obj  = "abcdef";
        int length = obj.length();
        char c[] = new char[length];
        obj.getChars(0, length, c, 0);
        CharArrayReader input1 = new CharArrayReader(c);
        CharArrayReader input2 = new CharArrayReader(c, 0, 3);
        int i;
        try 
        {
while ((i = input2.read()) != -1) 
            {
                System.out.print((char)i);
            }
        } 
        catch (IOException e) 
        {
      // TODO Auto-generated catch block
            e.printStackTrace();
  }
}
}

50.
What will be the output of the following Java program?
import java.io.*;
public class filesinputoutput 
{
  public static void main(String[] args) 
    {
 String obj  = "abc";
       byte b[] = obj.getBytes();
       ByteArrayInputStream obj1 = new ByteArrayInputStream(b);
       for (int i = 0; i < 2; ++ i) 
       {
           int c;
           while ((c = obj1.read()) != -1) 
           {
             if (i == 0) 
               {
                   System.out.print(Character.toUpperCase((char)c));
                   obj2.write(1); 
             }
           }
           System.out.print(obj2);
       }
    }
}

Read More Section(Interfaces and Abstract Classes)

Each Section contains maximum 100 MCQs question on Interfaces and Abstract Classes. To get more questions visit other sections.