Skip to content

ArpitChoubey/JavaProgrammingInterviewQuestion-Part-II

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

A curated collection of hand-picked Java programs designed to strengthen your programming logic and boost your interview confidence.

🧠 About This Repository

This repository contains practical Java programs covering core concepts, data structures, string manipulation, sorting algorithms, and logical problem-solving — all tailored for Software Test Engineers, Automation Testers, SDETs, and Java learners preparing for interviews.

Every program is self-contained, well-commented, and focuses on interview-specific problem-solving techniques that demonstrate your coding ability and logical thinking.

🧩 What You’ll Learn

✅ Core Java fundamentals through hands-on examples ✅ Arrays, Strings, Collections, and Loops mastery ✅ Sorting algorithms like Bubble, Insertion, and Selection Sort ✅ Logical and pattern-based interview problems ✅ Stack, HashMap, and LinkedList implementation ✅ Recursion, matrix operations, and mathematical logic ✅ String operations like reversal, prefix, rotation, and transformation

📚 List of Java Programs Included

Here’s what this collection covers (each program is in a separate file for easy navigation):

  1. Create an ArrayList of fruits, convert it into an array, and print all elements.

  2. Accept rows and columns from the user to build and print a 2D matrix.

  3. Convert a string array to ArrayList using Arrays.asList() and print all elements.

  4. Check if parentheses () { } [ ] in a string are balanced using a Stack.

  5. Convert a binary number to decimal using Integer.parseInt().

6.Sort an array using Bubble Sort.

7.Build a Simple Calculator performing +, −, ×, ÷ operations using user input.

  1. Validate if a string contains only digits.

  2. Count set bits (1s) in a binary representation of an integer.

  3. Find duplicate elements in an array using a HashSet.

  4. Create a dynamic array from user input and display all values.

  5. Classic FizzBuzz problem (1 to 100).

  6. Compute GCD (Greatest Common Divisor) of two numbers.

14.Demonstrate a HashMap storing employee IDs and names.

15.Implement a custom version of atoi() (convert string to integer).

  1. Implement strStr() to find substring index.

  2. Sort an array using Insertion Sort.

  3. Calculate LCM (Least Common Multiple) of two integers.

  4. Find the longest common prefix among an array of strings.

  5. Demonstrate LinkedList creation and manipulation (add, remove, display).

  6. Input a 2D matrix and print its transpose.

  7. Move all zeros to the end of an array.

  8. Reverse a name string input by the user.

  9. Count occurrences of each character using a HashMap.

  10. Generate Pascal’s Triangle.

  11. Print numbers from 1 to N using recursion.

  12. Print different star and number patterns using nested loops.

  13. Remove negative numbers from an array, sort, and display results.

  14. Remove vowels from a string.

  15. Replace all vowels with ‘*’ and display the new string.

  16. Reverse a string using StringBuilder/StringBuffer reverse().

  17. Reverse elements in an ArrayList or LinkedList.

  18. Reverse the order of words in a sentence.

  19. Rotate an array by K positions (left or right).

  20. Sort an array using Selection Sort.

  21. Sort arrays or strings using Arrays.sort().

  22. Sort an ArrayList in ascending and descending order.

  23. Sort an array of strings alphabetically.

  24. Print a rectangle star pattern based on user input.

  25. Check if one string is a rotation of another.

  26. Convert a numeric string to an integer manually (without parsing).

42.Remove leading and trailing spaces without using trim().

  1. Merge two arrays and display the union (remove duplicates).

  2. Find all unique characters in a string.

💻 Tech Stack Used

Language: Java (JDK 8+)

IDE: IntelliJ IDEA / Eclipse / VS Code

Concepts Covered: Core Java, Collections, Loops, Recursion, Arrays, Strings

🏁 How to Run

Clone the repository:

git clone https://github.com/ArpitChoubey/JavaProgrammingInterviewQuestion-Part-II.git

Open any .java file in your IDE.

Compile and run:

javac FileName.java java FileName

Follow the input prompts and observe the output.

🧠 Ideal For

QA Engineers preparing for Java-based interview rounds

Manual Testers transitioning to Automation / SDET roles

Students and beginners learning Core Java concepts

Developers revising fundamentals for coding interviews

🤝 Contributions

Contributions are always welcome! If you have an interesting Java problem or a more optimized approach, feel free to:

Fork this repository

Create a new branch

Add your solution

Submit a Pull Request

Your contributions will help others in the testing and developer community learn faster � �

🌟 Support & Connect

If you find this repository useful, please consider starring ⭐ it on GitHub to help others discover it!

📬 Connect with me on LinkedIn: - https://www.linkedin.com/in/arpitchoubey/ & Medium - https://medium.com/@ArpitChoubey9

About

General Asked Java Programming Question Part II

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages