Professional Documents
Culture Documents
A. 5321
B. Compilation error
C. Prints 5 once
D. Prints 5 in an infinite loop
2. On executing Counter class, how many Counter objects are created in the memory?
A. 3
B. 1
C. 4
D. 2
A. 32
B. 22
C. Compilation error in main method
D. An exception is thrown at runtime
6. Which of the method of String class is used to remove leading and trailing white
spaces?
A. ltrim( )
B. trim( )
C. rtrim( )
D. trimBoth( )
7. For the code below, what should be the name of java file?
A. helloworld.java
B. Hello.java
C. HelloWorld.java
D. helloWorld.java
A. 65 66
B. 123
C. AB
D. Compilation error
10. What will be the result of compiling and executing Test class?
A. 20
B. 33
C. 30
D. An exception is thrown at runtime
11. What will be the result of compiling and executing Test class?
A. FFFFF
B. TTTFT
C. FTFFF
D. NullPointerException is thrown at runtime
A. java.time.format
B. java.time
C. java.text
D. java.util
13. What will be the result of compiling and executing Test class?
A. Compilation error
B. true
C. false
D. None
A. java.lang
B. java.io
C. java.util
D. default package
16. What will be the result of compiling and executing Test class?
A. [Array,List]
B. Compilation error
C. An exception is thrown at runtime
D. [Array,null,List,null]
17. How many String objects are there in the HEAP memory, when control is at Line 9?
A. 3
B. 2
C. 4
D. 5
18. Which of the following is the correct package declaration to declare Test class in
com.exam.oca.Test
A. package com.exam.oca.Test;
B. package com.exam.oca.*;
C. Package com.exam.oca;
D. package com.exam.oca;
19. What will be the result of compiling and executing Test class?
A. [true]
B. NullPointerException is thrown at runtime
C. [false]
D. []
20. What will be the result of compiling and executing Test class?
21. What will be the result of compiling and executing Test class?
A. true:true
B. null:null
C. false:false
D. NullPointerException is thrown at runtime
22. What will be the result if Test class is executed by below command? java Test 10
A. THREE
B. TWO
C. ONE
D. Compilation error
23. What will be the result of compiling and executing Wall class?
A. green
B. null
C. NullPointerException
D. Compilation error
24. What will be the result of compiling and executing Test class?
A. Runtime exception
B. compilation error
C. true
D. false
25. What will be the result of compiling and executing Test class?
A. 3
B. 2
C. Compilation error
D. 0
26. Which of the following statement is correct?
27. What will be the result of compiling and executing Test class?
A. [5,10]
B. An exception is thrown at runtime
C. Compilation error
D. [50,50]
28. What will be the result of compiling and executing Test class?
A. 1947-08-14T23:59:59
B. 1947-08-14T23:59:59.999999999
C. 1947-08-14T23:59:59.0
D. 1947-08-14T23:59:59.999
29. What will be the result of compiling and executing Test class?
A. 01-11-12
B. 01-11-11
C. 11-11-11
D. 11-11-12