Java - MCQ

Multiple Choice Questions


Share with a Friend

 

Java MCQ - Introduction to Java - Set 16

76. Which one of these lists contains only Java programming language keywords?
A). class, if, void, long, Int, continue
B). goto, instanceof, native, finally, default, throws
C). try, virtual, throw, final, volatile, transient
D). strictfp, constant, super, implements, do
View Answer
Correct: B



77. Which is a reserved word in the Java programming language?
A). method
B). native
C). subclasses
D). reference
View Answer
Correct: B



78. Which is a valid keyword in java?
A). interface
B). string
C). Float
D). unsigned
View Answer
Correct: A



79. Which is a valid declaration of a String?
A). String s1 = null;
B). String s2 = 'null';
C). String s3 = (String) 'abc';
D). String s4 = (String) '\ufeed';
View Answer
Correct: A



80. What will be the output of the program?

class Equals 
{
    public static void main(String [] args) 
    {
        int x = 100;
        double y = 100.1;
        boolean b = (x = y);
        System.out.println(b);
    }
}
A). true
B). false
C). Compilation fails
D). An exception is thrown at runtime
View Answer
Correct: C



 
 
 
   
   
   
UltraInfo Technologies
ITDeveloper