Tech Basic Java

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Basic Java

Basic Java Sample Paper page 1 of 3

Basic Java Sample Paper

1. Which of these is not a valid constant of RetentionPolicy enum?


(1) CLASS
(2) COMPILETIME
(3) RUNTIME
(4) SOURCE

2. How many bits are allocated for float type in Java?


(1) 8
(2) 16
(3) 32
(4) 64

3. Does java support pointers?


(1) Yes
(2) No
(3) Depends on the JVM used
(4) Depends on system hardware

4. The methods that implements an interface must be decalred as:


(1) public
(2) private
(3) protected
(4) default

5. Tick the correct range for data type: 'short' in java


(1) -128 to 127
(2) -32768 to 32767
(3) -2147483648 to 2147483647
(4) -256 to 256

6. In java, data type 'char' is of the following code type


(1) ASCII
(2) UNICODE
(3) both of the above
(4) none of the above

7. In java, variable name cannot be one of the following


(1) identifier
(2) keyword
(3) both of the above

Prepare for MBA, Law, Software Engineering and many more...


Brought to you by EduThrill
Basic Java Sample Paper page 2 of 3

(4) none of the above

8. In java, a method which doesn't return any value returns the following type
(1) int
(2) float
(3) void
(4) none of the above

9. which keyword can be used any method to refer to current object


(1) import
(2) catch
(3) this
(4) none of the above

10. Specific region in a string can be compared with specific region in another string by the method
(1) regionMatches()
(2) regionMatch()
(3) match()
(4) none of the above

11. Overriding method can be prevented by the keyword


(1) static
(2) constant
(3) final
(4) none of the above

12. memory space for int data type


(1) 1byte
(2) 2byte
(3) 4byte
(4) 8byte

13. memory space for double data type


(1) 1byte
(2) 2byte
(3) 4byte
(4) 8byte

14. default value for short


(1) 0
(2) 1
(3) true
(4) false

Prepare for MBA, Law, Software Engineering and many more...


Brought to you by EduThrill
Basic Java Sample Paper page 3 of 3

15. default value for int


(1) 0
(2) 1
(3) true
(4) false

16. default value for float


(1) 0
(2) 0.0f
(3) 0.1
(4) 1

17. default value for boolean


(1) true
(2) none
(3) false
(4) 1

18. output of relational operators


(1) int
(2) char
(3) float
(4) boolean

19. java was designed by?


(1) james gosling
(2) bill gates
(3) david A. moon
(4) Guy L. Steele

20. 20th aniversary of java was celebrated in?


(1) 2010
(2) 2015
(3) 2016
(4) 2017

Prepare for MBA, Law, Software Engineering and many more...


Brought to you by EduThrill
Answer Key

1. (2) COMPILETIME
2. (3) 32
3. (2) No
4. (1) public
5. (2) -32768 to 32767
6. (2) UNICODE
7. (2) keyword
8. (3) void
9. (3) this
10. (1) regionMatches()
11. (3) final
12. (3) 4byte
13. (4) 8byte
14. (1) 0
15. (1) 0
16. (2) 0.0f
17. (3) false
18. (4) boolean
19. (1) james gosling
20. (2) 2015

You might also like