java lang and java io Mcqs

Our collections of Multiple choice questions and answers focuses on study of java lang and java io. These questions are chosen from a collection of most authoritative and best reference books on Java. Our aim is to prepare an individual for competitive exams like NTS, GAT, ECAT, University and College entrance exams and various tests and job interviews. One should practice our Mcqs to assimilate java lang and java io topic comprehensively.

2.
Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object?

Int hash()

Int hashcode()

Int hashCode()

Integer hashcode()

7.
What is the output of this program?

    class Output 
    {
        public static void main(String args[]) 
        {
            char a[] = {'a', '5', 'A', ' '};   
            System.out.print(Character.isDigit(a[0]) + " ");
            System.out.print(Character.isWhitespace(a[3]) + " ");
            System.out.print(Character.isUpperCase(a[2]));
        }
    }

True false true

False true true

True true false

False false false

8.
What is the output of this program?

    class Output 
    {
        public static void main(String args[]) 
        {
            Integer i = new Integer(257);  
            byte x = i.byteValue();
            System.out.print(x);
        }
    }

0

1

256

257

13.
Which of the following is method of System class is used to find how long a program takes to execute?

Currenttime()

CurrentTime()

CurrentTimeMillis()

CurrenttimeMillis()

15.
What is the output of this program?

    class Output 
    {
        public static void main(String args[]) 
        {
            long start, end;   
            start = System.currentTimeMillis();
            for (int i = 0; i < 10000000; i++);
            end = System.currentTimeMillis();
            System.out.print(end - start);
        }
    }

0

1

1000

System Dependent

16.
What is the output of this program?

    class Output 
    {
        public static void main(String args[]) 
        {
            byte a[] = { 65, 66, 67, 68, 69, 70 };
            byte b[] = { 71, 72, 73, 74, 75, 76 };  
            System.arraycopy(a , 0, b, 0, a.length);
            System.out.print(new String(a) + " " + new String(b));
        }
    }

ABCDEF ABCDEF

ABCDEF GHIJKL

GHIJKL ABCDEF

GHIJKL GHIJKL

error: You are not allowed to do so.....
0Shares
0
Scroll to Top