TCS Interview Questions
Practice with real TCS interview questions
01
A Backend Developer was asked
Asked in 2024
Q. Can you explain how the Node.js event loop works? Illustrate your explanation with an example that includes asynchronous code execution.
Ans. The Node.js event loop is a crucial part of its non-blocking architecture, allowing it to handle multiple operations simultaneously. The event loop processes events from the event queue and executes callbacks. Here’s a breakdown:
1. Phases of the Event Loop: It consists of several phases: timers, I/O callbacks, idle, poll, check, and close callbacks.
2. Execution: It picks events from the queue and executes their callbacks, enabling asynchronous operations.
Here’s an example demonstrating the event loop in action:
Output:
In this example:
- The synchronous logs 'Start' and 'End' execute first.
- The promise resolution is handled next, demonstrating how microtasks (like promises) are executed before the next event loop tick.
- The
setTimeout and setImmediate callbacks are executed afterward, showing how the event loop manages asynchronous operations.Backend DeveloperCore Concept
02
A Software Engineer was asked
Asked in 2025
Q. What is the syllabus for TCS NQT 2025, and how can one prepare for the coding section effectively? Provide example coding questions and their solutions.
Ans. Syllabus Overview for TCS NQT 2025
The coding section typically covers:
- Data Structures (Arrays, Strings, Trees, Graphs)
- Algorithms (Sorting, Searching, Recursion)
- Basic programming concepts (Loops, Functions, OOP principles)
Example Coding Question 1: Reverse a Linked List
Problem Statement: Given the head of a singly linked list, reverse the list and return the reversed list.
Solution:
To reverse a linked list, we can use three pointers: previous, current, and next.
Example Coding Question 2: Find First Unique Character in a String
Problem Statement: Given a string, find the first non-repeating character in it and return its index. If it does not exist, return -1.
Solution:
We can use a dictionary to count the occurrences of each character and then identify the first unique character.
Software EngineerCore Concept
