TCS Interview Preparation (NQT)
55+ coding, DSA, aptitude, and HR questions with complete solutions for freshers.
| Question | Answer | Category |
|---|---|---|
| Q1. Reverse a string. | Use slicing or iterative reversal. | Coding |
| Q2. Check leap year. | Divisible by 400 OR (divisible by 4 AND not by 100). | Coding |
| Q3. Convert vowels to uppercase. | Iterate string, replace vowels with uppercase. | Coding |
| Q4. Check if palindrome. | Compare string with reverse. Ignore spaces/case. | Coding |
| Q5. Find hypotenuse of triangle. | Use Pythagorean theorem: c = sqrt(a² + b²). | Coding |
| Q6. Check Armstrong number. | Sum of digits raised to power of number of digits = number. | Coding |
| Q7. Two Sum problem. | Use hashmap to store complements. O(n) time. | Coding |
| Q8. Merge two sorted arrays. | Two pointer technique. O(n+m) time. | Coding |
| Q9. Maximum element in array. | Iterate and track maximum value. | Coding |
| Q10. Binary search. | Divide search space in half. O(log n) on sorted array. | Coding |
| Q11. Fibonacci series. | Each = sum of previous two. Start: 0, 1. | Coding |
| Q12. Factorial calculation. | Product of all positive integers ≤ n. | Coding |
| Q13. Prime number check. | Check divisibility up to sqrt(n). | Coding |
| Q14. GCD of two numbers. | Euclidean algorithm: gcd(a,b) = gcd(b, a%b). | Coding |
| Q15. Anagram check. | Sort both strings and compare. | Coding |
| Q16. Remove duplicates from sorted array. | Two pointers. Count unique elements. | Coding |
| Q17. Count character frequency. | Hashmap approach. O(n) time. | Coding |
| Q18. Rotate array by k. | Slicing or reverse technique. O(n) time. | Coding |
| Q19. Valid parentheses. | Stack: push open, pop close. Empty stack = valid. | Coding |
| Q20. Longest substring without repeating. | Sliding window with hashmap. O(n) time. | Coding |
| Q21. Average speed calculation. | Speed = Total Distance / Total Time. | Aptitude |
| Q22. Simple interest. | SI = (P × R × T) / 100. Where P=principal, R=rate, T=time. | Aptitude |
| Q23. Percentage calculation. | Percentage = (Value / Total) × 100. | Aptitude |
| Q24. Compound interest. | A = P(1 + R/100)^T. Interest = A - P. | Aptitude |
| Q25. Discount calculation. | Discount = Original Price × (Discount % / 100). | Aptitude |
| Q26. Work rate problem. | Combined rate = 1/A + 1/B. Time = 1 / Combined rate. | Aptitude |
| Q27. Ratio proportion. | If a:b = c:d then a/b = c/d. | Aptitude |
| Q28. Area of rectangle. | Area = Length × Width. | Aptitude |
| Q29. Area of circle. | Area = π × r². | Aptitude |
| Q30. Perimeter of rectangle. | Perimeter = 2 × (Length + Width). | Aptitude |
| Q31. Tell me about yourself. | Education, projects, internships, skills, why TCS. | HR |
| Q32. Why TCS? | IT leader, global presence, innovation, career growth, training. | HR |
| Q33. Your strengths. | Problem-solving, teamwork, communication, adaptability, learning. | HR |
| Q34. Reverse linked list. | Three pointers: prev, curr, next. Reverse iteratively. | Coding |
| Q35. Second largest element. | Track first and second. O(n) time, O(1) space. | Coding |
| Q36. Missing number in array. | Expected sum minus actual sum. | Coding |
| Q37. Array intersection. | Use hashset. O(n+m) time. | Coding |
| Q38. Duplicate in array. | Floyd cycle detection or hashmap approach. | Coding |
| Q39. Maximum subarray sum (Kadane). | Track current and max sum. Reset if negative. | Coding |
| Q40. Merge sort. | Divide, sort, merge. O(n log n) always. | Coding |
| Q41. Pressure handling. | Prioritize, break problems, communicate, stay focused. | HR |
| Q42. Salary expectations. | Research IT sector. Give realistic range. | HR |
| Q43. Bubble sort. | Compare adjacent, swap. O(n²) worst case. | Coding |
| Q44. Selection sort. | Find minimum, swap. O(n²) always. | Coding |
| Q45. Insertion sort. | Build sorted array incrementally. O(n²) worst, O(n) best. | Coding |
| Q46. Team collaboration. | STAR method: situation, task, action, result. | HR |
| Q47. LCM calculation. | lcm(a,b) = (a*b) / gcd(a,b). | Coding |
| Q48. Transpose matrix. | Swap rows and columns. | Coding |
| Q49. Matrix addition. | Add corresponding elements. O(n²). | Coding |
| Q50. Career goals in 5 years. | Senior developer, team lead, or specialist role. | HR |
| Q51. String reversal without built-in. | Use loop to build reversed string. | Coding |
| Q52. First non-repeating character. | Hashmap: return first with count = 1. | Coding |
| Q53. Common elements in arrays. | Use set intersection or two pointers. | Coding |
| Q54. Sum of digits. | Iterate digits, add them up. | Coding |
| Q55. How do you learn new tech? | Courses, projects, documentation, hands-on practice. | HR |