Top 20 TCS NQT Coding Questions, Programming Questions, and Solutions

TCS NQT Coding Question

TCS NQT (National Qualifiers Test) is an online test conducted by Tata Consultancy Services (TCS) for hiring fresh engineering graduates. The coding questions in this test assess a candidate’s programming skills and problem-solving abilities. These questions are designed to evaluate how well a candidate can write code, understand problem statements, and devise efficient solutions. This blog has listed TCS NQT Coding Questions. TCS NQT Programming Questions PDF will be uploaded later in this blog. .

Furthermore, the coding questions may cover various topics such as arrays, strings, linked lists, trees, recursion, dynamic programming, and more. Freshers need to make a Preparation Strategy for the TCS NQT Exam before learning the TCS NQT Coding Questions. Candidates need to practice extensively to develop their coding skills and prepare thoroughly for the TCS NQT coding section.

TCS NQT Coding Question 2024

Candidates can refer to the TCS NQT Coding Question 2024 before appearing for the NQT Exam. The Exam Analysis of the TCS NQT Exam can be referred to understand the Coding Questions that are commonly asked in the TCS NQT Exam are listed below:

TCS NQT Coding Questions Coding Round
Number of Questions 3 Questions
Time Limit 90 MInutes
Difficulty Round Hard

Whereas, The coding Questions in Round 2 (Advanced) of the TCS exam have 3-4 coding questions. Students get 90 minutes to solve them. These questions test advanced coding skills by covering moderate to high-level Data Structures and Algorithms topics. The difficulty level is higher compared to earlier rounds. Strong problem-solving and implementation skills are crucial to performing well in this coding round.

Moreover, The difficulty level of these questions ranges from easy to moderate. Mock test pages are available on our Skillvertex blog to allow candidates to excel in the NQT Exam.Additionally, interview Questions can also be accessed through this blog.

TCS NQT Coding Questions and Answers 2024

1. Reverse a string in Python.


def reverse_string(s):
    return s[::-1]

# Example usage:
print(reverse_string("hello"))  # Output: "olleh"

2. Check if a string is a palindrome in Python.


def is_palindrome(s):
    return s == s[::-1]

# Example usage:
print(is_palindrome("racecar"))  # Output: True

3. Find the factorial of a number in Python.


def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

# Example usage:
print(factorial(5))  # Output: 120

4. Implement a binary search algorithm in Python.


def binary_search(arr, target):
    low, high = 0, len(arr) - 1
    while low <= high:
        mid = (low + high) // 2
        if arr[mid] == target:
            return mid
        elif arr[mid] < target:
            low = mid + 1
        else:
            high = mid - 1
    return -1

# Example usage:
print(binary_search([1, 2, 3, 4, 5], 3))  # Output: 2

5. Implement a bubble sort algorithm in Python.


def bubble_sort(arr):
    n = len(arr)
    for i in range(n):
        for j in range(0, n-i-1):
            if arr[j] > arr[j+1]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

# Example usage:
print(bubble_sort([5, 3, 2, 4, 1]))  # Output: [1, 2, 3, 4, 5]

6. Find the maximum element in an array in Python.


def find_max(arr):
    max_element = arr[0]
    for num in arr:
        if num > max_element:
            max_element = num
    return max_element

# Example usage:
print(find_max([5, 3, 9, 1, 7]))  # Output: 9

7. Calculate the Fibonacci sequence up to a certain number in Python.


def fibonacci(n):
    fib_sequence = [0, 1]
    while fib_sequence[-1] < n:
        fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
    return fib_sequence[:-1]

# Example usage:
print(fibonacci(50))  # Output: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

8. Remove duplicates from a list in Python.


def remove_duplicates(arr):
    return list(set(arr))

# Example usage:
print(remove_duplicates([1, 2, 2, 3, 4, 4, 5]))  # Output: [1, 2, 3, 4, 5]

9. Check if a number is prime in Python.

def is_prime(n):
    if n <= 1:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True

# Example usage:
print(is_prime(17))  # Output: True

10. Find the sum of digits of a number in Python.

def sum_of_digits(n):
    return sum(int(digit) for digit in str(n))

# Example usage:
print(sum_of_digits(12345))  # Output: 15

11. Implement a stack in Python.


class Stack:
    def __init__(self):
        self.items = []

    def push(self, item):
        self.items.append(item)

    def pop(self):
        if not self.is_empty():
            return self.items.pop()

    def is_empty(self):
        return len(self.items) == 0

    def peek(self):
        if not self.is_empty():
            return self.items[-1]

    def size(self):
        return len(self.items)

# Example usage:
stack = Stack()
stack.push(1)
stack.push(2)
print(stack.peek())  # Output: 2
stack.pop()
print(stack.peek())  # Output: 1

12.Implement a queue in Python.


class Queue:
    def __init__(self):
        self.items = []

    def enqueue(self, item):
        self.items.append(item)

    def dequeue(self):
        if not self.is_empty():
            return self.items.pop(0)

    def is_empty(self):
        return len(self.items) == 0

    def size(self):
        return len(self.items)

# Example usage:
queue = Queue()
queue.enqueue(1)
queue.enqueue(2)
print(queue.dequeue())  # Output: 1

13. Find the intersection of two arrays in Python.


def intersection(arr1, arr2):
    return list(set(arr1) & set(arr2))

# Example usage:
print(intersection([1, 2, 3, 4], [3, 4, 5, 6]))  # Output: [3, 4]

14. Count the occurrences of each word in a sentence in Python.

def word_count(sentence):
    words = sentence.split()
    word_count_dict = {}
    for word in words:
        if word in word_count_dict:
            word_count_dict[word] += 1
        else:
            word_count_dict[word] = 1
    return word_count_dict

# Example usage:
print(word_count("the quick brown fox jumps over the lazy dog"))  
# Output: {'the': 2, 'quick': 1, 'brown': 1, 'fox': 1, 'jumps': 1, 'over': 1, 'lazy': 1, 'dog': 1}

15.Implement a linked list in Python.


class Node:
    def

16. Find the missing number in an array containing numbers from 1 to n in Python.


def find_missing_number(nums):
    n = len(nums) + 1
    total_sum = n * (n + 1) // 2
    actual_sum = sum(nums)
    return total_sum - actual_sum

# Example usage:
print(find_missing_number([1, 2, 4, 5]))  # Output: 3

17.Check if two strings are anagrams of each other in Python.

def are_anagrams(s1, s2):
    return sorted(s1) == sorted(s2)

# Example usage:
print(are_anagrams("listen", "silent"))  # Output: True

18.Find the first non-repeating character in a string in Python.

def first_non_repeating_char(s):
    char_count = {}
    for char in s:
        if char in char_count:
            char_count[char] += 1
        else:
            char_count[char] = 1
    for char in s:
        if char_count[char] == 1:
            return char
    return None

# Example usage:
print(first_non_repeating_char("hello"))  # Output: 'h'

19. Rotate an array to the right by k steps in Python.

def rotate_array(nums, k):
    k %= len(nums)
    nums[:] = nums[-k:] + nums[:-k]

# Example usage:
nums = [1, 2, 3, 4, 5]
rotate_array(nums, 2)
print(nums)  # Output: [4, 5, 1, 2, 3]

20. Find the intersection of two linked lists in Python.

class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

def get_intersection_node(headA, headB):
    pointerA, pointerB = headA, headB
    while pointerA != pointerB:
        pointerA = pointerA.next if pointerA else headB
        pointerB = pointerB.next if pointerB else headA
    return pointerA

# Example usage:
# Construct linked lists
intersect_node = ListNode(3)
intersect_node.next = ListNode(4)

headA = ListNode(1)
headA.next = ListNode(2)
headA.next.next = intersect_node

headB = ListNode(5)
headB.next = ListNode(6)
headB.next.next = intersect_node

intersection = get_intersection_node(headA, headB)
print(intersection.val)  # Output: 3

TCS NQT Coding And Programming Questions And Solutions

Candidates can check out the Programming Questions Solutions along with the TCS NQT Coding Questions. This NQT Programming Question is a very essential section for the TCS NQT exam. The Programming Questions And Solutions PDF will be uploaded for your reference.

Exam DetailsProgramming Logic Exam for TCS NQT
Number of Questions10
Time Limit15 minutes
Sections4
Topics CoveredDifficulty
8-9High
Type of TestNegative Marking
Non-adaptiveNo

Moreover, TCS has introduced a Programming Logic Questions and Test section to ensure that new employees who are joining TCS have good coding knowledge. This section will have 10 questions, and you will get 15 minutes to solve them. The difficulty level is high, candidates can practice sample questions from previous TCS test papers.

Important Points:

  • There is no negative marking for incorrect answers.
  • The TCS NQT (National Qualifiers Test) is adaptive this year.
  • You will not get any physical rough paper during the exam. Instead, a calculator and rough work area will be available on your computer screen.

The TCS NQT Coding Questions are designed to thoroughly evaluate a candidate’s programming abilities. These questions cover a wide range of topics from basic programming concepts to advanced data structures and algorithms. The difficulty level ranges from easy to highly challenging. Proper preparation by practicing a variety of coding problems is crucial to performing well in this section.

Therefore, having a strong grasp of programming fundamentals, problem-solving skills, and the ability to write clean, efficient code are key requirements. With dedicated practice and a systematic approach, candidates can improve their coding skills and increase their chances of succeeding in the TCS NQT coding round. Ultimately, this section aims to identify candidates with the necessary coding prowess for various technology roles at TCS.

  1. TCS NQT Eligibility Criteria 2024, Qualification, Percentage, Backlog
  2. TCS NQT Apply Online 2024, Direct Application Link
  3. TCS NQT Hiring Process 2024, Job Role, Salary
  4. TCS NQT Salary 2024 For Freshers, In Hand Salary, Package
  5. TCS NQT Registration Process 2024, Step-By-Step Process

TCS NQT Coding Question – FAQs

Q1.Does TCS NQT have coding questions?

Ans. TCS NQT (National Qualifier Test) features coding questions to assess candidates’ programming and problem-solving skills. These questions gauge candidates’ ability to write code and solve problems effectively.

Q2.Does TCS have repeated coding questions?

Ans. TCS NQT often repeats similar coding questions due to its new recruitment pattern. With the coding module introduced recently, the question bank is limited. Candidates may encounter questions where the compiler could be either command line-based or scan-based.

Q3.Is TCS digital coding hard?

Ans. The online test for TCS Digital is known for its difficulty compared to other service-based companies. With 31 questions to answer, candidates have 110 minutes to complete the test, making it quite challenging.

Q4.Is it easy to pass TCS NQT?

Ans. There is no fixed minimum score to pass the TCS NQT exam. The qualifying percentage depends on how many candidates appear for the test. However, candidates should aim to score at least 60% in the different sections to have a good chance of clearing the written stage.

Q5.Is TCS digital easy to crack?

Ans. The TCS Digital exam is considered very difficult and well-known. Its placement process is tougher than the regular TCS Ninja process. Only 8-10% of students who appear for the TCS Digital exam manage to clear it.

Q6.Is coding compulsory for TCS?

Ans. Yes, the Coding Section is a very mandatory part of the TCS NQT Exam. So, Candidates are required to attend them.

Q7.Can I attempt TCS NQT twice?

Ans. Yes, candidates can attempt the TCS NQT exam multiple times in a year. There is no restriction on the number of attempts. However, you need to wait for at least 6 months after your last attempt before you can take the exam again.

Q8.Is Python allowed in TCS NQT?

Ans. Yes, You can choose one programming language for coding questions. The options are C, C++, Java, Python, and Perl.

Q9.Is TCS good for beginners?

Ans. If someone wants to learn new things and advance their career, then joining TCS would be a good option for them.

Q10.Can I clear TCS Ninja without coding?

Ans. For the TCS Ninja hiring process, coding skills are not required. If you perform well in the verbal, reasoning, and quantitative sections, that is enough to clear the first round and move to the next stage.

Hridhya Manoj

Hello, I’m Hridhya Manoj. I’m passionate about technology and its ever-evolving landscape. With a deep love for writing and a curious mind, I enjoy translating complex concepts into understandable, engaging content. Let’s explore the world of tech together

Leave a Comment