Java - MCQ

Multiple Choice Questions


Share with a Friend

 

Java MCQ - Introduction to Java - Set 13

61. Which one is a valid declaration of a boolean?
A). boolean b1 = 1;
B). boolean b2 = ‘false’;
C). boolean b3 = false;
D). boolean b4 = ‘true’
View Answer
Correct: C



62. What will be the output of the following Java program?

    class mainclass {
        public static void main(String args[]) 
        {
            char a = 'A';
            a++;
            System.out.print((int)a);
        } 
    }
A). 66
B). 67
C). 65
D). 64
View Answer
Correct: A



63. What will be the output of the following Java code?

    class asciicodes {
        public static void main(String args[]) 
        {
            char var1 = 'A';
            char var2 = 'a';
            System.out.println((int)var1 + " " + (int)var2);
        } 
    }
A). 162
B). 65 97
C). 67 95
D). 66 98
View Answer
Correct: B



64. Which of these is long data type literal?
A). 0x99fffL
B). ABCDEFG
C). 0x99fffa
D). 99671246
View Answer
Correct: A



65. Which of these can be returned by the operator &?
A). Integer
B). Boolean
C). Character
D). Integer or Boolean
View Answer
Correct: D



 
 
 
   
   
   
UltraInfo Technologies
ITDeveloper