HCL Technologies Interview Preparation
55+ coding, technical, system design and HR questions with complete solutions for freshers.
| Question | Answer | Category |
|---|---|---|
| Q1. Write program to count frequency of each character. | Use hashmap to store character counts while iterating through string. | Coding |
| Q2. Reverse a linked list. | Maintain three pointers: prev, current, next. Reverse direction of links iteratively. | Coding |
| Q3. Find first non-repeating character from stream of characters. | Use hashmap with indexes, track characters seen. Return first non-repeating. | Coding |
| Q4. Design a URL shortener system. | Use hash function for mapping long URLs to short codes. Store in database with TTL. Scale with cache and load balancing. | System Design |
| Q5. Implement LRU Cache. | Use HashMap + Doubly Linked List. HashMap for O(1) access, DLL for maintaining order. | Coding |
| Q6. What is database indexing? | Indexing creates data structure (usually B-tree) for faster data retrieval. Trade-off: faster reads, slower writes, more storage. | Technical |
| Q7. Design a messaging system like WhatsApp. | Message queue (Kafka), WebSocket for real-time, database for persistence, cache for active conversations. | System Design |
| Q8. Two Sum problem. | Use hashmap: store target-num as key, check if current num exists in map. | Coding |
| Q9. How does REST API differ from GraphQL? | REST: fixed endpoints, multiple requests for related data. GraphQL: single endpoint, query what you need, no over/under-fetching. | Technical |
| Q10. Longest substring without repeating characters. | Use sliding window with hashmap to track character positions. | Coding |
| Q11. Explain TCP vs UDP. | TCP: reliable, ordered, connection-oriented. UDP: faster, connectionless, unreliable. Used for video streaming, gaming. | Technical |
| Q12. Merge two sorted arrays. | Use two pointers, compare elements, add smaller to result. | Coding |
| Q13. What is deadlock? How to prevent it? | Deadlock: circular wait for resources. Prevention: break one of four conditions (mutual exclusion, hold & wait, no preemption, circular wait). | Technical |
| Q14. Group anagrams together. | Sort characters in each word, use sorted string as key in hashmap. | Coding |
| Q15. Design a parking lot system. | Multiple levels, different vehicle types, payment system. Use state machine for spot status. | System Design |
| Q16. Missing number in array. | Use expected sum minus actual sum formula or XOR operation. | Coding |
| Q17. What are transactions in database? | Unit of work with ACID properties. Ensures data consistency. Can commit or rollback. | Technical |
| Q18. Implement queue using two stacks. | Stack1 for push, Stack2 for pop. Transfer elements when popping if Stack2 is empty. | Coding |
| Q19. What is multithreading? | Ability to execute multiple threads simultaneously. Improves performance. Requires synchronization for shared resources. | Technical |
| Q20. Maximum subarray sum (Kadane's algorithm). | Track current sum, reset if negative. Update max at each step. | Coding |
| Q21. Tell me about yourself. | Brief intro: education, relevant projects, internships, skills, why HCL. Keep concise. | HR |
| Q22. Why HCL Technologies? | Company reputation, innovation, global presence, career growth opportunities. | HR |
| Q23. Your strengths and weaknesses. | Strengths: problem-solving, quick learner. Weakness: showing improvement. | HR |
| Q24. How do you handle pressure? | Stay calm, prioritize, communicate, break into smaller tasks. | HR |
| Q25. Team collaboration experience. | Use STAR method. Emphasize communication, listening, compromise. | HR |
| Q26. Rotate matrix 90 degrees. | Transpose + reverse each row. Or use layer by layer approach. | Coding |
| Q27. Design a search engine (Google). | Web crawler, indexer, ranking algorithm, cache layer, distributed architecture. | System Design |
| Q28. Number of islands (BFS/DFS). | Traverse grid, mark visited cells, count disconnected components. | Coding |
| Q29. Intersection of two linked lists. | Use two pointers traversing both lists. When one reaches end, switch to other list. | Coding |
| Q30. Median of two sorted arrays. | Use binary search on smaller array to find partition point. | Coding |
| Q31. Valid parentheses expression. | Use stack to match opening and closing brackets. | Coding |
| Q32. Word ladder (BFS). | BFS from start word, generate next words by changing one letter, find shortest path. | Coding |
| Q33. Coin change problem. | Dynamic programming. dp[i] = minimum coins needed for amount i. | Coding |
| Q34. Longest increasing subsequence. | Dynamic programming or binary search approach. O(n log n) with binary search. | Coding |
| Q35. Edit distance (Levenshtein). | DP: table[i][j] represents edits needed to convert first i chars to first j chars. | Coding |
| Q36. Serialize/deserialize binary tree. | Use preorder traversal with markers for null nodes. Reconstruct by reversing process. | Coding |
| Q37. LCA of binary tree. | Recursively search left and right subtrees. Return node if found in current or both subtrees. | Coding |
| Q38. Trap rainwater. | Use two pointers or DP. At each position, water = min(max_left, max_right) - height. | Coding |
| Q39. Merge k sorted lists. | Use heap (priority queue) to efficiently get minimum element each time. | Coding |
| Q40. Sliding window maximum. | Use deque to maintain indices of useful elements in decreasing order. | Coding |
| Q41. Implement Trie (Prefix Tree). | TrieNode with children dict/array. Insert, search, startsWith operations. | Coding |
| Q42. Word break problem. | DP where dp[i] = True if word[:i] can be segmented from dictionary. | Coding |
| Q43. Permutations of string. | Backtracking: fix each character at position, recursively permute rest. | Coding |
| Q44. N-Queens problem. | Backtracking. Place queens row by row, check if placement valid, backtrack if not. | Coding |
| Q45. Graph bipartite coloring. | Use BFS/DFS to color graph with 2 colors. Return false if adjacent nodes have same color. | Coding |
| Q46. Topological sort (Kahn's algorithm). | Calculate in-degree for each node. Process nodes with in-degree 0, reduce neighbors's in-degree. | Coding |
| Q47. Dijkstra shortest path. | Use priority queue, process nodes in order of distance, update neighbors. | Coding |
| Q48. Implement hash map with collision handling. | Open addressing or chaining for collision resolution. Load factor management. | Coding |
| Q49. Salary expectations? | Research market rates. Give range based on location, experience, skills. | HR |
| Q50. Where do you see yourself in 5 years? | Show growth mindset. Senior developer, technical lead, or specialist role. | HR |
| Q51. Do you have questions for us? | Ask about team, culture, tech stack, growth opportunities, or company vision. | HR |
| Q52. How do you stay updated with technology? | Online courses, blogs, GitHub, coding platforms, tech conferences. | HR |
| Q53. Describe conflict with colleague, how resolved. | Use STAR. Focus on professional resolution, listening, mutual understanding. | HR |
| Q54. Why did you leave previous job? | Focus on growth, learning, new challenges. Avoid negativity about company/people. | HR |
| Q55. Any questions about company/role? | Show genuine interest. Ask about projects, team size, learning opportunities. | HR |