Core Java Online Test Questions and Answers

Core Java Online Test

Take Core Java Online Test and evaluate your readiness before you appear for any interview or written test. Consisting of objective type questions from various important concepts of Core Java, this test presents you questions followed by four options. The correct answer, explanation and example provided with each question make it easier for you to understand each concept well.

Who is this Core Java Online Test designed for?

All the Developers, Programmers, Front End developers, UI/ UX developers and designers will find this test extremely useful. All freshers, BCA, BE, BTech, MCA and college students wanting to make a career in IT field will be highly benefited by this test.

Core Java Online Test topics

This online test covers topics like - Object and Classes, Constructors, Datatypes, Variable Types, Modifier Types, Operators, Numbers, Characters, Strings, Arrays, Date and Time, Regular Expressions, Methods, Files and I/O, Exceptions, Inner classes, Inheritance, Overriding, Polymorphism, Abstraction, Encapsulation, Interfaces, Packages, Data Structures, Collections, Generics, Serialization, Networking, Multithreading etc.
1. Which of the following statement is legal?

a. int arr[][] = new int[5][5];
b. int[] arr = new int[5][];
c. int[] arr = new int[][5];
d. All of them

Answer: a. int arr[][] = new int[5][5];

2. What is returned when the method substring(2, 4) is invoked on the string "sample"?

a. "pl"
b. "am"  
c. "mp"  
d. "ampl"

Answer: c. "mp"

3. Which of the following is considered as a structure that defines the data and the methods to work on that data?

a. Object
b. Class  
c. Method
d. Variables

Answer: b. Class

4. Which of the following is considered as a specific instance of a class that contains real values instead of variables?

a. Object
b. Class  
c. Method
d. Variables

Answer: a. Object

5. Name the collection interface used to represent collections that maintain unique elements.

a. List
b. Map
c. Set
d. All of above

Answer: c. Set

6. Abstract classes cannot be instantiated, but they can be subclassed

a. True
b. False

Answer: a. True

7. Char data type is used to store any character and its minimum value is 0

a. True
b. False

Answer: a. True

8. Which of the following opertor inverts all the bits?

a. &
b. !
c. ~  
d. ^

Answer: c. ~

9. What is the value in num?

String str;
int num;
str = "tutorialride";
num = str.indexOf("tutor");

a. 0
b. 2
c. 4
d. -1

Answer: d. -1

10. Which of the following interface of Java Collection Framework doesn’t inherit from Collection interface?

a. List
b. Set
c. Queue
d. Map  

Answer: d. Map