0% found this document useful (0 votes)
2 views4 pages

Java

The document contains a series of technical questions focused on Java programming, covering topics such as basic concepts, object-oriented programming principles, exception handling, collections framework, multithreading, JVM, access modifiers, interfaces vs. abstract classes, string manipulation, and garbage collection. Each question includes multiple-choice options along with the correct answers. This serves as a quiz or review material for individuals looking to test their knowledge of Java.

Uploaded by

Bhakti Pandit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Java

The document contains a series of technical questions focused on Java programming, covering topics such as basic concepts, object-oriented programming principles, exception handling, collections framework, multithreading, JVM, access modifiers, interfaces vs. abstract classes, string manipulation, and garbage collection. Each question includes multiple-choice options along with the correct answers. This serves as a quiz or review material for individuals looking to test their knowledge of Java.

Uploaded by

Bhakti Pandit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

JAVA

Technical questions focused on Java programming:

1. Basic Concepts:

- **Q1.** What is the main feature of Java's platform independence?

- **Options:**

1. Bytecode

2. Multithreading

3. Object-oriented programming

4. Garbage collection

- **Answer:** Bytecode

2. Object-Oriented Programming:

- **Q2.** In Java, which of the following is not a principle of Object-Oriented Programming?

- **Options:**

1. Abstraction

2. Encapsulation

3. Compilation

4. Inheritance

- **Answer:** Compilation

3. Exception Handling:

- **Q3.** Which keyword is used to create a custom exception in Java?

- **Options:**

1. throw

2. throws

3. try

4. catch

- **Answer:** throw
4. Collections Framework:

- **Q4.** Which of the following interfaces does not extend the Collection interface in Java?

- **Options:**

1. List

2. Set

3. Map

4. Queue

- **Answer:** Map

5. Multithreading:

- **Q5.** In Java, which method is used to start a thread?

- **Options:**

1. startThread()

2. run()

3. start()

4. begin()

- **Answer:** start()

6. Java Virtual Machine (JVM):

- **Q6.** What is the role of the Java Virtual Machine (JVM)?

- **Options:**

1. Compiling Java code into bytecode

2. Executing bytecode

3. Managing memory

4. All of the above

- **Answer:** All of the above

7. Access Modifiers:
- **Q7.** Which access modifier allows a class to be accessible only within its own package?

- **Options:**

1. public

2. protected

3. private

4. default

- **Answer:** default

8. Interfaces and Abstract Classes:

- **Q8.** What is the primary difference between an interface and an abstract class in Java?

- **Options:**

1. Interfaces can have method bodies, while abstract classes cannot.

2. Abstract classes can have instance variables, while interfaces cannot.

3. Interfaces support multiple inheritance, while abstract classes do not.

4. Both are the same.

- **Answer:** Abstract classes can have instance variables, while interfaces cannot.

9. Strings:

- **Q9.** Which of the following is a method to concatenate two strings in Java?

- **Options:**

1. join()

2. append()

3. concat()

4. merge()

- **Answer:** concat()

10. Garbage Collection:

- **Q10.** What is the purpose of garbage collection in Java?

- **Options:**
1. To free up memory by removing unused objects

2. To optimize the performance of the code

3. To compile Java code

4. To check for memory leaks

- **Answer:** To free up memory by removing unused objects

You might also like