TCS NQT 2025: Coding Question Last Year

 TCS NQT 2025: Coding Question on "Print the Words Ending with Letter 'S'"

tec-nqt-2025


Description for 2025 Freshers


Section 1: English 
Section 2: Quantitative Aptitude
Section 3: Programming Concepts
Section 4: Coding  


The TCS National Qualifier Test (NQT) is one of the most widely recognized coding assessments, designed to evaluate the technical and problem-solving skills of freshers who are aspiring to kickstart their careers in the IT industry. For 2025 freshers, the NQT continues to be a gateway to opportunities with TCS, one of the leading global IT services companies. In this blog, we will walk through a coding problem often asked during TCS NQT assessments: Print the Words Ending with the Letter 'S'. The problem tests your understanding of basic string manipulation and your ability to write efficient code to handle input and output correctly. Freshers looking to secure a position in top-tier organizations like TCS must be prepared to solve such problems by mastering concepts like string processing, loops, and conditionals in programming languages like C.


The task at hand is to write a program that reads an input string, checks each word, and prints the words that end with the letter 's'. This problem can be considered a typical string processing problem that evaluates your ability to work with strings and handle edge cases, such as ensuring the program works correctly for words with varying lengths and punctuation marks.


For freshers aiming for TCS NQT 2025, it's crucial to build a solid foundation in coding, problem-solving, and efficient algorithmic thinking. The TCS NQT exam usually consists of multiple sections, and solving questions like the one discussed in this blog will help you sharpen your skills. Not only will you demonstrate your technical abilities, but you will also show your preparedness for a future in software development, engineering, or IT consulting roles.


Post Description for 2025 Freshers

The TCS NQT 2025 is approaching fast, and it's time to gear up for the coding challenges that will help you secure your place in one of the world's largest IT companies. One of the most commonly asked types of questions in TCS NQT exams is string manipulation, and in this blog post, we dive deep into a problem where you need to Print the Words Ending with the Letter 'S'. This problem will test your skills in working with strings, loops, and conditions. For freshers preparing for the 2025 recruitment, understanding how to approach and solve such questions is key to succeeding in TCS NQT. In addition to coding, you should also be aware of the packages offered by TCS, which include attractive salary structures, growth opportunities, and a chance to work with cutting-edge technologies.


Salary Packages for TCS NQT 2025 Freshers

For freshers, TCS NQT provides an excellent opportunity to start your career in the IT industry with competitive salary packages. The typical salary packages offered by TCS for freshers range between:


TCS Ninja: ₹3.36 LPA (Lakh Per Annum) for the entry-level positions.

TCS Digital: ₹7 LPA and above for candidates with exceptional skills in areas like cloud computing, artificial intelligence, and machine learning.

TCS also offers various benefits, such as flexible working hours, health insurance, opportunities for career advancement, and global exposure, depending on the role and the business unit.


join telegram channel to get free pdf problem solved of last year TCS NQT Paper.

Click Here 👉 : JOIN NOW


Problem Statement

You are given a string of words. Your task is to print only the words that end with the letter 's'. For example:


Input:

this was mine

Output:

this

was



Approach

The approach to solving this problem involves the following steps:


  • Read the input string.
  • Split the string into words.
  • Check each word to see if it ends with the letter 's'.
  • If a word ends with 's', print it.
  • If a word does not end with 's', skip it.
  • Let's now look at the provided solution step by step.



Solution Walkthrough


#include <stdio.h>

#include <string.h>


char str[100];


void main() {

    int i, t, j, len;

    scanf("%[^\n]s", str);  // Read the entire line of input

    len = strlen(str);       // Get the length of the string

    str[len] = ' ';          // Append a space to the string to handle the last word


    for (t = 0, i = 0; i < strlen(str); i++) {

        // If a space is found and the previous character is 's', it indicates the end of a word

        if ((str[i] == ' ') && (str[i - 1] == 's')) {

            // Print the word from index t to i-1

            for (j = t; j < i; j++) {

                printf("%c", str[j]);

            }

            t = i + 1;  // Update t to the index of the next word

            printf("\n");

        }

        else {

            // If a space is found, set t to the next word's start index

            if (str[i] == ' ') {

                t = i + 1;

            }

        }

    }

}

TCS NQT Solved MOCK Test Pdf

Click Here 👉 : View Here

Conclusion

As a 2025 fresher preparing for the TCS NQT, it's vital to practice coding problems, especially those related to string manipulations, loops, and conditionals. Tackling problems like "Print the Words Ending with the Letter 'S'" will improve your understanding and boost your confidence. With the right preparation, you can secure a rewarding position at TCS, with an attractive salary and numerous opportunities to grow your career. Be sure to work on a variety of coding challenges, stay up to date with the latest industry trends, and practice consistently. Good luck with your TCS NQT 2025 preparations!

Previous Post Next Post

Contact Form