Add office photos
Employer?
Claim Account for FREE

Plivo

2.7
based on 42 Reviews
Filter interviews by

TCS Interview Questions and Answers

Updated 1 Aug 2024

Q1. Given an array of 0s, 1s and 2s sort the array - expected O(n)

Ans.

Sort an array of 0s, 1s, and 2s in O(n) time complexity.

  • Use three pointers to keep track of the positions of 0s, 1s, and 2s.

  • Traverse the array and swap elements to their respective positions.

  • The first pointer should point to the first occurrence of 1, and the second pointer should point to the first occurrence of 2.

  • Example: [0, 1, 2, 0, 1, 2] -> [0, 0, 1, 1, 2, 2]

Add your answer

Q2. Given an array of 0s,1s and 2s sort the array - O(n)

Ans.

Sort an array of 0s, 1s, and 2s in O(n) time complexity.

  • Use three pointers to keep track of the positions of 0s, 1s, and 2s.

  • Traverse the array and swap elements to their respective positions.

  • Time complexity is O(n) and space complexity is O(1).

Add your answer

Q3. Reverse a string and maintain the special character and space positions

Ans.

Reverse a string while preserving the positions of special characters and spaces.

  • Iterate through the string from both ends using two pointers

  • Swap characters if both are alphabets or both are special characters

  • Continue until the pointers meet in the middle

Add your answer

Q4. write a program to determine if given strings are an anagram

Ans.

A program to determine if given strings are an anagram.

  • Convert each string to lowercase and remove any non-alphabetic characters.

  • Sort the characters in each string.

  • Compare the sorted strings to check if they are equal.

Add your answer
Discover TCS interview dos and don'ts from real experiences

Q5. Design tinyURL

Ans.

Design a service to shorten long URLs into short ones.

  • Generate a unique ID for each long URL and store it in a database.

  • Map the unique ID to the long URL and store it in the database.

  • Create a short URL by using the unique ID as a parameter.

  • Redirect the short URL to the long URL when accessed.

  • Implement security measures to prevent abuse and ensure privacy.

  • Consider implementing analytics to track usage and performance.

Add your answer

Q6. Explain portfolio project

Ans.

A portfolio project is a collection of work samples showcasing a designer's skills and experience.

  • Include a variety of projects to demonstrate range and expertise

  • Provide context for each project, explaining the problem, solution, and outcome

  • Highlight any special techniques or tools used in the projects

  • Showcase projects that align with the specific role or industry

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at TCS

based on 11 interviews
Interview experience
2.5
Poor
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

3.9
 • 402 Interview Questions
4.1
 • 365 Interview Questions
4.2
 • 361 Interview Questions
4.2
 • 349 Interview Questions
4.0
 • 277 Interview Questions
3.7
 • 180 Interview Questions
View all
Top Plivo Interview Questions And Answers
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter