[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

TCS Digital Coding Questions

    1 / 8

    For given two matrices, Write a program to to multiply them. Matrices can either be square or rectangular.

    Input : mat1[][] = {{1, 2},
    {3, 4}}
    mat2[][] = {{1, 1},
    {1, 1}}

    2,3rd Shift 6 MARCH CHSL EXAM QUEST...
    2,3rd Shift 6 MARCH CHSL EXAM QUESTIONS, BY: PRINCE SHARMA

    Output :

    Please Login to view the answer

    2 / 8

    Given an array Arr[ ] of N integers and a positive integer K. The task is to cyclically rotate the array clockwise by K.

    Input : 5 —Value of N
    {10, 20, 30, 40, 50} —Element of Arr[ ]
    2 —–Value of K


    Output :

    View Answer |  Basics |  Practice Program | Add to Reading List To Reading List | Asked In TCS Digital |  Experience, Fresher
    Please Login to view the answer

    3 / 8

    Given two non-negative integers n1 and n2, where n1 For example:

    Suppose n1=11 and n2=15.

    There is the number 11, which has repeated digits, but 12, 13, 14 and 15 have no repeated digits. So, the output is 4.

    Input : 11 — Vlaue of n1
    15 — value of n2


    Output :

    View Answer |  Basics |  Practice Program | Add to Reading List To Reading List | Asked In TCS Digital |  Experience, Fresher
    Please Login to view the answer

    4 / 8

    In this 3 Palindrome, Given an input string word, split the string into exactly 3 palindromic sub-strings. Working from left to right, choose the smallest split for the first sub--string that still allows the remaining word to be split into 2 palindromes.

    Similarly, choose the smallest second palindromic substring that leaves a third palindromic sub-string.

    If there is no way to split the word into exactly three palindromic substrings, print “Impossible” (without quotes). Every character of the string needs to be consumed.

    Cases not allowed –

    After finding 3 palindromes using above instructions, if any character of the original string remains unconsumed.
    No character may be shared in forming 3 palindromes.

    Constraints

    1 <= the lngth of input sting <= 1000

    Input : First line contains the input string consisting of characters between [a-z].


    Output :

    View Answer |  Basics |  Practice Program | Add to Reading List To Reading List | Asked In TCS Digital |  Experience, Fresher
    Please Login to view the answer

    5 / 8

    In this even odd problem Given a range [low, high] (both inclusive), select K numbers from the range (a number can be chosen multiple times) such that sum of those K numbers is even.

    Calculate the number of all such permutations.

    As this number can be large, print it modulo (1e9 +7).

    Constraints

    0 <= low <= high <= 10^9
    K <= 10^6.

    Input

    First line contains two space separated integers denoting low and high respectively
    Second line contains a single integer K.

    Output

    Print a single integer denoting the number of all such permutations Input

    First line contains two space separated integers denoting low and high respectively
    Second line contains a single integer K.

    Output

    Print a single integer denoting the number of all such permutations

    Input : 4 5

    3


    Output :

    View Answer |  Basics |  Practice Program | Add to Reading List To Reading List | Asked In TCS Digital |  Experience, Fresher
    Please Login to view the answer

    6 / 8

    Roco is an island near Africa which is very prone to forest fire. Forest fire is such that it destroys the complete forest. Not a single tree is left.This island has been cursed by God , and the curse is that whenever a tree catches fire, it passes the fire to all its adjacent tree in all 8 directions,North, South, East, West, North-East, North-West, South-East, and South-West.And it is given that the fire is spreading every minute in the given manner, i.e every tree is passing fire to its adjacent tree.Suppose that the forest layout is as follows where T denotes tree and W denotes water.

    Your task is that given the location of the first tree that catches fire, determine how long would it take for the entire forest to be on fire. You may assume that the lay out of the forest is such that the whole forest will catch fire for sure and that there will be at least one tree in the forest

    Input Format:

    First line contains two integers, M, N, space separated, giving the size of the forest in terms of the number of rows and columns respectively.
    The next line contains two integers X,Y, space separated, giving the coordinates of the first tree that catches the fire.
    The next M lines, where ith line containing N characters each of which is either T or W, giving the position of the Tree and Water in the ith row of the forest.

    Output Format:

    Single integer indicating the number of minutes taken for the entire forest to catch fire

    Input : 3 3
    W T T
    T W W
    W T T


    Output :

    View Answer |  Basics |  Practice Program | Add to Reading List To Reading List | Asked In TCS Digital |  Experience, Fresher
    Please Login to view the answer

    7 / 8

    Compute the nearest larger number by interchanging its digits updated.Given 2 numbers a and b find the smallest number greater than b by interchanging the digits of a and if not possible print -1.

    Input Format
    2 numbers a and b, separated by space.

    Output Format
    A single number greater than b.

    If not possible, print -1

    Constraints

    1 <= a,b <= 10000000

    Input : 459 500


    Output :

    View Answer |  Basics |  Practice Program | Add to Reading List To Reading List | Asked In TCS Digital |  Experience, Fresher
    Please Login to view the answer

    8 / 8

    In a Conference ,attendees are invited for a dinner after the conference.The Co-ordinator,Sagar arranged around round tables for dinner and want to have an impactful seating experience for the attendees.Before finalizing the seating arrangement,he wants to analyze all the possible arrangements.These are R round tables and N attendees.In case where N is an exact multiple of R,the number of attendees must be exactly N//R,,If N is not an exact multiple of R, then the distribution of attendees must be as equal as possible.Please refer to the example section before for better understanding.
    For example, R = 2 and N = 3
    All possible seating arrangements are
    (1,2) & (3)
    (1,3) & (2)
    (2,3) & (1)
    Attendees are numbered from 1 to N.

    Input Format:

    The first line contains T denoting the number of test cases.
    Each test case contains two space separated integers R and N, Where R denotes the number of round tables and N denotes the number of attendees.

    Output Format:

    Single Integer S denoting the number of possible unique arrangements.

    Constraints:

    0 <= R <= 10(Integer)
    0 < N <= 20 (Integer)

    Input : 1
    2 5


    Output :

    View Answer |  Basics |  Practice Program | Add to Reading List To Reading List | Asked In TCS Digital |  Experience, Fresher
    Please Login to view the answer




TCS Digital Coding round is one of the tricky rounds of the whole TCS hiring process, for this round You need to master TCS Digital coding questions, you need not only have any coding language (C/C++/Java/Perl/ Python 2.7) knowledge, even you need to have strong logical thinking, to code the questions in given time. On this page of TCS Digital, you can Practice similar type programming questions that are asked constantly in the TCS Digital test. Here you will get an updated pattern of the TCS Digital coding exam pattern 2021-22. This will help boost your preparation for the TCS Digital exam. To make your TCS Digital coding round preparation easy, we have listed here TCS Digital coding questions, you can practice all the given questions, and try to write the program in the given time. After practising these questions, you will be in a place to code most of the TCS Digital coding questions in given 20 minutes time in any of the 15 prefered programming languages:

  1. C
  2. C#
  3. C++
  4. Python
  5. Python3
  6. Erlang
  7. go
  8. Haskel
  9. Java
  10. Java 7
  11. Kotlin
  12. Lua
  13. Perl
  14. Ruby
  15. Scala
TCS Digital coding Questions wl be a bit different from the normal coding round questions that are asked in other TCS exams. Here you will get 2 problem statements and each one has a total of 2 visible and 3 hidden test cases, instead of the total of 5 test cases. Test cases are compiler-generated input which will check if your output is coming as expected or not. The total mark allotted for each question is 60. If you are new to programming then you can filter the questions listed here as easy and can start practising after that, However, if u are having a good understanding and want to practice advanced questions then you can practice advanced coding questions all listed here.