Saturday, 17 December 2016

Core Java Data – Type MCQ

1. What is the range of data type short in Java?
a) -128 to 127
b) -32768 to 32767
c) -2147483648 to 2147483647
d) None of the mentioned

2. An expression involving int, byte with literal numbers then resulting expression will be to which of these?
a) int
b) long
c) byte
d) float

3. Which of the following are legal lines of Java code?
1. int w = (int)888.8;
2. byte x = (byte)1L;
3. long y = (byte)12;
4. byte z = (byte)123L;
a) 1 and 2
b) 2 and 3
c) 3 and 4
d) All statements are correct.

4. Which of these literals can be contained in a data type float variable?
a) 1.7e-388
b) 3.4e-039
c) 1.7e+408
d) 3.4e-059

5. Which of the following is correct statement?         
a) Boolean true value is 1 and false value is 0
b)Every private class has a wrapper class
c) Constant identifier precede with a reserved word final
d) System.out.println() method also flushes the buffer

6. For which of the following data types the ValueOf() method is NOT overloaded in the string class?
      a)Float
      b)Boolean
      c)Object
     d)None of these

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

8. in Java byte, int, short and long all of these are
a)signed
b)unsigned
c)Both of the above
d)None of these

9. Size of int in Java is
a)16 bit
b)32 bit
c)64 bit
d)Depends on the bit of OS

10. The smallest integer type is ......... and its size is ......... bits.
a)short, 8
b)byte, 8
c)short, 16
d)short, 16
 
                              


No comments:

Post a Comment