Object Oriented Programming - I (3140705) MCQs

MCQs of Introduction to java and elementary programming

Showing 71 to 80 out of 95 Questions
71.
If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?
(a) long
(b) int
(c) double
(d) float
Answer:

Option (c)

72.
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
Answer:

Option (a)

73.
Java is a ........... language.
(a) weakly typed
(b) strongly typed
(c) moderate typed
(d) None of these
Answer:

Option (b)

74.
How many primitive data types are there in Java?
(a) 6
(b) 7
(c) 8
(d) 9
Answer:

Option (c)

75.
Size of int in Java is
(a) 16 bit
(b) 32 bit
(c) 64 bit
(d) Depends on execution environment
Answer:

Option (b)

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
Answer:

Option (b)

77.
Which is a reserved word in the Java programming language?
(a) method
(b) native
(c) subclasses
(d) reference
Answer:

Option (b)

78.
Which is a valid keyword in java?
(a) interface
(b) string
(c) Float
(d) unsigned
Answer:

Option (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';
Answer:

Option (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
Answer:

Option (c)

Showing 71 to 80 out of 95 Questions