Infosys Interview Preparation Guide
55+ interview questions with complete code solutions — technical, HR, aptitude, and coding rounds for freshers.
| Question | Answer | Category |
|---|---|---|
| Q1. Write a program to reverse an array of integers. | Use two-pointer technique: start from both ends, swap elements, and move pointers towards center. | Coding |
| Q2. Check if a given string is a palindrome. | Compare the string with its reverse. A palindrome reads the same forwards and backwards. | Coding |
| Q3. Find the second largest number in an array. | Use two variables to track first and second largest numbers. | Coding |
| Q4. Find all occurrences of a substring in a string. | Iterate through the string and use find() method or startswith() to locate all positions. | Coding |
| Q5. Check if two strings are anagrams of each other. | Sort both strings and compare. Anagrams have same characters in different order. | Coding |
| Q6. Remove duplicates from a sorted array. | Use two pointers: one for unique elements, one for iteration. | Coding |
| Q7. Rotate an array to the right by k steps. | Use array slicing or reverse technique for optimal solution. | Coding |
| Q8. Find all pairs in an array that sum to a target value. | Use hash map or two-pointer approach after sorting. | Coding |
| Q9. Print first n Fibonacci numbers. | Each Fibonacci number is sum of previous two numbers: F(n) = F(n-1) + F(n-2). | Coding |
| Q10. Check if a number is an Armstrong number. | An Armstrong number equals sum of its digits each raised to power of number of digits. | Coding |
| Q11. Count frequency of each character in a string. | Use dictionary/hash map to count character occurrences. | Coding |
| Q12. Find GCD (Greatest Common Divisor) of two numbers. | Use Euclidean algorithm: GCD(a,b) = GCD(b, a mod b). | Coding |
| Q13. Check if a number is prime. | Check if number has any divisors other than 1 and itself. | Coding |
| Q14. Convert string to integer (atoi). | Parse string digit by digit and build the integer. | Coding |
| Q15. Sort an array using bubble sort. | Compare adjacent elements and swap if they are in wrong order. Repeat until sorted. | Coding |
| Q16. Implement binary search on a sorted array. | Divide search interval in half repeatedly until element is found or interval is empty. | Coding |
| Q17. Matrix addition of two 2D arrays. | Add corresponding elements from both matrices. | Coding |
| Q18. Calculate factorial of a number using recursion. | Base case: factorial(0) = 1. Recursive case: factorial(n) = n * factorial(n-1). | Coding |
| Q19. Generate all prime numbers up to n using Sieve of Eratosthenes. | Mark multiples of each prime as non-prime iteratively. | Coding |
| Q20. Find common elements in two arrays. | Use set intersection to find common elements efficiently. | Coding |
| Q21. What is the difference between an abstract class and an interface? | Abstract classes can have both abstract and concrete methods with state (variables). Interfaces (until Java 8) only had abstract methods. Java 8+ allows default methods in interfaces. | Technical |
| Q22. What is normalization in databases? | Normalization is process of organizing data to reduce redundancy and improve data integrity. Normal forms: 1NF, 2NF, 3NF, BCNF. | Technical |
| Q23. Explain polymorphism with example. | Polymorphism: ability of object to take many forms. Method overloading (compile-time) and method overriding (runtime) are two types. | Technical |
| Q24. What is the difference between equals() and == in Java? | == compares object references. equals() compares object content/values. String class overrides equals(). | Technical |
| Q25. Explain the concept of garbage collection in Java. | Automatic memory management: JVM automatically frees memory by removing unreferenced objects. Reduces memory leaks. | Technical |
| Q26. What are ACID properties in databases? | Atomicity: all or nothing. Consistency: valid state. Isolation: no interference. Durability: permanent after commit. | Technical |
| Q27. What is the OSI model? | Open Systems Interconnection model with 7 layers: Physical, Data Link, Network, Transport, Session, Presentation, Application. | Technical |
| Q28. What is the difference between ArrayList and LinkedList? | ArrayList: array-backed, fast random access, slower insertion/deletion. LinkedList: node-based, slower access, faster insertion/deletion. | Technical |
| Q29. Explain JOIN operations in SQL. | INNER JOIN: common records. LEFT JOIN: all from left table. RIGHT JOIN: all from right table. FULL JOIN: all records from both. | Technical |
| Q30. What is exception handling in Java? | Mechanism to handle runtime errors using try-catch-finally blocks. Allows graceful error handling without crashing program. | Technical |
| Q31. Tell me about yourself. | Start with education, highlight relevant projects/skills, mention internships, conclude with career goals. Keep it concise (2-3 minutes). | HR |
| Q32. Why do you want to join Infosys? | Mention company's reputation, growth opportunities, innovation focus, and alignment with your career goals. | HR |
| Q33. What are your strengths? | Highlight relevant strengths: problem-solving, teamwork, quick learner, adaptability, communication skills. | HR |
| Q34. What are your weaknesses? | Be honest but show improvement: "I take time to perfect details, but learned to prioritize for deadlines." | HR |
| Q35. How do you handle pressure and deadlines? | Share example: prioritize tasks, communicate with team, remain calm, focus on solutions. | HR |
| Q36. Describe your teamwork experience. | Use STAR method: Situation, Task, Action, Result. Emphasize collaboration and communication. | HR |
| Q37. What are your salary expectations? | Research industry standards. Give range: "Based on my skills and market research, I expect X to Y range." | HR |
| Q38. Where do you see yourself in 5 years? | Show ambition and growth: "Experienced developer with leadership skills, contributing to company growth." | HR |
| Q39. Do you have any questions for us? | Ask about team culture, growth opportunities, tech stack used, or company vision. | HR |
| Q40. How do you stay updated with new technologies? | Online courses, tech blogs, GitHub, coding platforms like LeetCode, attending webinars. | HR |
| Q41. If a train travels 120 km in 2 hours, what is its average speed? | Speed = Distance / Time = 120 / 2 = 60 km/h. | Aptitude |
| Q42. Find the simple interest on 1000 at 5% per annum for 2 years. | SI = (P × R × T) / 100 = (1000 × 5 × 2) / 100 = 100. | Aptitude |
| Q43. What is 20% of 500? | 20% of 500 = (20/100) × 500 = 100. | Aptitude |
| Q44. If A can do work in 10 days and B can do it in 15 days, how long will they take together? | A's rate = 1/10, B's rate = 1/15. Combined rate = 1/10 + 1/15 = 5/30 = 1/6. Time = 6 days. | Aptitude |
| Q45. Solve: 2x + 5 = 15. | 2x = 15 - 5 = 10. x = 5. | Aptitude |
| Q46. What is the area of rectangle with length 5 and width 3? | Area = Length × Width = 5 × 3 = 15 square units. | Aptitude |
| Q47. Find compound interest on 5000 at 10% per annum for 2 years. | A = P(1 + R/100)^T = 5000(1 + 10/100)^2 = 5000 × 1.21 = 6050. CI = 1050. | Aptitude |
| Q48. If a book costs 200 and discount is 15%, what is final price? | Discount = 15% of 200 = 30. Final price = 200 - 30 = 170. | Aptitude |
| Q49. What is average of 10, 20, 30, 40? | Average = (10 + 20 + 30 + 40) / 4 = 100 / 4 = 25. | Aptitude |
| Q50. If ratio is 2:3 and sum is 50, find both numbers. | Let numbers be 2x and 3x. 2x + 3x = 50. 5x = 50. x = 10. Numbers are 20 and 30. | Aptitude |
| Q51. Write a program to find LCM of two numbers. | LCM = (a × b) / GCD(a, b). Can also use mathematical approach. | Coding |
| Q52. Reverse a linked list. | Iterate through list, reverse pointers at each node. | Coding |
| Q53. Find middle element of linked list. | Use slow and fast pointer approach. Slow moves 1 step, fast moves 2 steps. | Coding |
| Q54. Implement stack using array. | Use array with push and pop operations. | Coding |
| Q55. Check if a string has balanced parentheses. | Use stack: push opening brackets, pop on closing. Stack should be empty at end. | Coding |