0% found this document useful (0 votes)
31 views

Java SAQ Mid-1

Uploaded by

hemanthe05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Java SAQ Mid-1

Uploaded by

hemanthe05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Unit 1

1. What do you think is the necessity of OOPs concepts in Java?

OOPs in Java provides a structured and organized way to create reusable, modular,
and maintainable code.

2. Define Data Abstraction with an example.

Data Abstraction hides internal implementation details, providing a clear interface for
interaction. Example: A car object can be used without knowing its engine
specifications.

3. What are Object and Class in Java?

A Class is a blueprint, and an Object is an instance of a class.

4. List various Data Types in Java.

Java data types: int, float, double, char, boolean, etc.

5. Benefits and Applications of OOP

Benefits include code reusability, scalability, and security. Applications range from
gaming to real-time systems.

6. How to Declare a Variable and Use of the Variable?

Declare a variable: int x = 5;. It stores values for operations.

7. What is Type Conversion & Casting?

Type conversion automatically changes data types; casting explicitly converts


between types.

8. List out Java buzzwords.

Simple, Secure, Portable, Object-oriented, Multithreaded, Robust, etc.

9. Comment on History of Java.

Java was created by James Gosling at Sun Microsystems in 1995.


10. Define Polymorphism.

Polymorphism allows methods to perform differently based on the object calling it.

11. Write the use of Recursion in a program.

Recursion simplifies problems by solving smaller subproblems recursively.

12. List out the OOPs Concepts.

Abstraction, Encapsulation, Inheritance, Polymorphism.

13. Define arrays.

Arrays are a collection of elements of the same data type.

14. What is Method Overloading?

Method overloading is when methods have the same name but different parameters.

15. Write about java Data types.

Java has primitive (int, float) and reference types (String, arrays).

16. What is a method and its advantage?

A method is a block of code performing a specific task, promoting code reusability.

17. Describe the various features of JAVA.

Features include platform-independence, security, object-orientation, and multithreading.

18. Describe in detail about Operators.

Operators in Java include arithmetic, relational, logical, and bitwise operators.

19. What are the object-oriented programming languages?

Examples include Java, C++, Python, and Ruby.


Unit 2
1. What is super keyword in java?

The super keyword refers to the parent class's constructor or methods.

2. Which keyword is used in inheritance?

The extends keyword is used in inheritance.

3. List the types of Inheritance in java.

Single, Multilevel, Hierarchical, and Hybrid (through interfaces).

4. Define Abstract class.

An abstract class cannot be instantiated and can have abstract methods.

5. Define Super class and Subclass.

A superclass is the parent class, and a subclass is the derived child class.

6. List the two advantages of using Interfaces?

Multiple inheritance and separation of implementation from definition.

7. List the Access Modifiers in java.

public, private, protected, and default.

8. Write difference between class and interface.

A class contains implementations; an interface contains only method declarations.

9. Which keyword is used in inheritance concept?

The extends keyword is used for inheritance.

10. Define Interface.

An interface is a contract containing only abstract methods and constants.

11. Explain about Garbage Collection.

Garbage Collection in Java automatically frees unused memory by removing unreferenced


objects.
12. What is Package?

A package is a collection of classes and interfaces, used to organize code.

13. What is mean by Constructor in java?

A constructor is a special method used to initialize objects.

14. What is the purpose of using a method? How do you declare a method?

Methods perform operations; declared as returnType methodName(parameters).

15. List the types of Inheritance in java.

Single, Multilevel, Hierarchical, Hybrid.

16. How to import a package?

Use the import keyword, e.g., import java.util.Scanner;.


Unit 3
1. What is finally block?

The finally block ensures code execution after try-catch, regardless of


exceptions.

2. How to Handle Exceptions in java?

Use try-catch blocks to handle exceptions gracefully.

3. Compare throw and throws keywords.

throw explicitly throws an exception, while throws declares possible exceptions.

4. Define Checked and unchecked exceptions.

Checked exceptions are caught at compile time; unchecked occur at runtime.

5. What is the use of finally keyword?

finally ensures the execution of code even if an exception occurs.

6. Define Try and Catch keyword in Exception Handling.

try holds code that might throw an exception; catch handles the thrown exception.

7. What is an Exception and when it occurs?

An exception is an error disrupting normal program flow, occurring during runtime.

8. List a few Checked Exceptions.

IOException, ClassNotFoundException, etc.

You might also like