C Programming Multiple Choice Questions (MCQ) | IT Developer <?php echo $page_title; ?>
IT Developer

Java Programming Multiple Choice Questions (MCQ)

Introduction to Java - Multiple Choice Questions (MCQ) - Set 27



Share with a Friend

Multiple Choice Questions


Java - Introduction to Java - Multiple Choice Questions (MCQ) - Set 27

131. 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




132. 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




133. 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




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




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