62). Which of these is necessary condition for automatic type conversion in Java?

[A]The destination type is smaller than source type
[B]The destination type is larger than source type
[C]The destination type can be larger or smaller than source type
[D]None of the mentioned

Show Answer

63). What is the prototype of the default constructor of this Java class?
 public class prototype { }

[A]prototype( )
[B]prototype(void)
[C] public prototype(void)
[D]public prototype( )

Show Answer

64). What will be the error in the following Java code?
byte b = 50;
    b = b * 50;

[A]b cannot contain value 100, limited by its range
[B]* operator has converted b * 50 into int, which can not be converted to byte without casting
[C]b cannot contain value 50
[D]No error in this code

Show Answer

65). If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?
byte b = 50;
    b = b * 50;

[A]long
[B]int
[C]double
[D]float

Show Answer

66). What is Truncation in Java?
byte b = 50;
    b = b * 50;

[A]Floating-point value assigned to an integer type
[B]Integer value assigned to floating type
[C]Floating-point value assigned to a Floating type
[D]Integer value assigned to an integer type

Show Answer

67). What will be the output of the following Java code?
    class char_increment 
    {
        public static void main(String args[]) 
        {
            char c1 = 'D';
            char c2 = 84;
            c2++;
            c1++;
            System.out.println(c1 + " "  + c2);
        } 
    }

[A] E U
[B] U E
[C]V E
[D]U F

Show Answer

68). What will be the output of the following Java code?
    class conversion 
    {
        public static void main(String args[]) 
        {
            double a = 295.04;
            int  b = 300;
            byte c = (byte) a;
            byte d = (byte) b;
            System.out.println(c + " "  + d);
        } 
    }

[A]38 43
[B]39 44
[C]295 300
[D]295.04 300

Show Answer

69). What will be the output of the following Java code?
    class A 
    {
        final public int calculate(int a, int b) { return 1; } 
    } 
    class B extends A 
    { 
        public int calculate(int a, int b) { return 2; } 
    } 
     public class output 
     {
        public static void main(String args[]) 
        { 
            B object = new B(); 
            System.out.print("b is " + b.calculate(0, 1));  
        } 
    }

[A] b is : 2
[B]b is : 1
[C]Compilation Error
[D]An exception is thrown at runtime

Show Answer

70). What will be the output of the following Java program, if we run as “java main_arguments 1 2 3”?
    class main_arguments 
    {
        public static void main(String [] args) 
        {
            String [][] argument = new String[2][2];
            int x;
            argument[0] = args;
            x = argument[0].length;
            for (int y = 0; y < x; y++) 
                System.out.print(" " + argument[0][y]);              
        }
    }

[A] 1 1
[B]1 0
[C]1 0 3
[D]1 2 3

Show Answer

71). What will be the output of the following Java program?
    class c 
    {    
        public void main( String[] args ) 
        {  
            System.out.println( "Hello" + args[0] ); 
        } 
    }

[A]Hello c
[B]Hello
[C]Hello world
[D]Runtime Error

Show Answer