Java Programming – Advanced Coding Questions
Instructions:
• Use OOP concepts wherever possible
• Avoid writing everything inside main()
• Use methods, classes, constructors
• Add proper validation
• Code readability will be evaluated
SECTION A: Logic + Control Flow
Q1. Smart Number Analyzer
Write a Java program that:
- Takes an integer input
- Determines whether it is positive, negative, or zero
- Determines whether it is even or odd
Use nested if-else.
Q2. Menu-Driven Calculator (Enhanced)
Create a menu-driven calculator using switch with:
- Addition, Subtraction, Multiplication, Division, Exit
The program should repeat until Exit is selected.
Handle division by zero.
SECTION B: Strings + Loops
Q3. String Character Analyzer
Count total characters, vowels, digits, and spaces in a string.
Q4. Palindrome Checker
Check whether a string is a palindrome.
Ignore case. Do not use built-in reverse methods.
SECTION C: Arrays + Methods
Q5. Second Largest Element
Find the second largest element in an array without sorting.
Q6. Frequency Counter
Print frequency of each element in an integer array.
SECTION D: Methods + Recursion
Q7. Power Function Using Recursion
Compute x^n using recursion without [Link]().
Q8. Recursive Digit Sum
Find sum of digits of a number using recursion.
SECTION E: Classes & Constructors
Q9. Employee Salary System
Calculate total salary using basic, HRA (20%), DA (10%).
Q10. Immutable Student Class
Create an immutable Student class using final variables.
SECTION F: Encapsulation
Q11. Secure Bank Account
Implement deposit and withdraw with validation.
SECTION G: Inheritance & Polymorphism
Q12. Shape Area Calculator
Use abstract class Shape with Rectangle and Circle.
Q13. Notification System
Demonstrate runtime polymorphism using parent reference.
SECTION H: super Keyword
Q14. Constructor Chaining
Use super() to initialize parent class attributes.
SECTION I: Packages
Q15. User-Defined Package
Create package [Link] with Student and Teacher classes.
MINI PROJECTS
Q16. Student Result Processing System
Calculate total, percentage, grade for multiple students.
Q17. Library Management System
Add, display, and search books.
Q18. ATM Simulation
Login with PIN, check balance, deposit, withdraw, exit.