TCS NQT Coding Questions With Answer
1 / 18
For e.g. given array {1, 2, 3, 1, 2, 1, 2} we shall have:
For position 0: 1 is on positions 3&5 additional to position 0.
Thus for position 0: |3-0| + |5-0| = 8.
For position 1: 2 is on positions 4&6 additional to position 1.
Thus for position 1: |4-1| + |6-1| = 8.
Input : NA
Output : NA
2 / 18
For e.g. given string ‘banana’, palindromic substrings would be ‘aa’, ‘aaa’, ‘ana’, ‘anna’ and so on.
Input : NA
Output : NA
3 / 18
Eg :- l = 1
r = 10
Input : NA
Output : NA
Tags:SAP Labs TCS NQT Wipro NLTH
4 / 18
Input : The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains two lines . The first line of each test case contains two integers n and mdenoting the size of the matrix. Then in the next line are n*mspace separated values of the matrix.
Output :
Tags:TCS NQT Wipro NLTH
5 / 18
Input : The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is V and N,V is the value of cents and N is the number of coins.
The second line of each test case contains N input C[i],value of available coins.
Output :
Tags:TCS NQT Wipro NLTH
6 / 18
1, 2, 1, 3, 2, 5, 3, 7, 5, 11, 8, 13, 13, 17, ...
This series is a mixture of 2 series - all the odd terms in this series form a Fibonacci series and all the even terms are the prime numbers in ascending order.
Write a program to find the Nth term in this series.
Note:
The value N is a Positive integer that should be read from STDIN. The Nth term that is calculated by the program should be written to STDOUT. Other than the value of Nth term, no other characters/strings or message should be written to STDOUT.
For example, when N = 14, the 14th term in the series is 17. So only the value 17 should be printed to STDOUT.
Input : 14
Output :
Tags:TCS NQT Wipro NLTH
7 / 18
Write a program to generate such series.For example,1, 1, 2, 2, 4, 4, 8, 8, 16, 16,......
Input : NA
Output : NA
Tags:TCS NQT Wipro NLTH
8 / 18
If multiple characters occur with the same highest frequency then return "0".
Input : Input1: abcdd
Output :
Tags:TCS NQT Nagarro Wipro NLTH
9 / 18
Given 'n' (1 <= n <= 100000), find the nth prime number.
Input : An integer n
Output :
Tags:TCS NQT Nagarro Wipro NLTH
10 / 18
Given a number n, find the total number of Derangements of a set of n elements.
Input : 1st Input: n = 2
For two elements say {0, 1}, there is only one
possible derangement {1, 0}
2nd Input: n = 3
For three elements say {0, 1, 2}, there are two
possible derangements {2, 0, 1} and {1, 2, 0}
Output :
Tags:TCS NQT Nagarro Wipro NLTH
TCS NQT Coding round is one of tricky round of whole TCS NQT process, for this round You need to master in TCS NQT 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. To make your TCS NQT coding round preparation easy, we have listed here TCS NQT coding questions, you can practice all the given questions, and try to write program in given time. After practicing these questions, you will be in a place to code most of the TCS NQT coding questions in given 20 minutes time in your any of the 5 prefered programming languages i.e C/C++/Java/Perl/ Python 2.7.
Top Kudos Contributor
Trending Programming Qs.
- Given a string, say sentence=" this is crazy and fun" and a list, say ...
- Write a program to print next to the last word of a sentence.
- Write a program to generate a simple pattern. 1 12 123 1234 123 ...
- There are many cars parked in the parking lot. The parking is a straig...
- Write fibonacci series program. INPUT: 10 term OUTPUT: 0 1 1 2 3 5...
- Write a program to print next to the last word of a sentence.
Last Month Contributor
- Write a program to print next to the last word of a sentence.
- Write a program to convert uppercase to lower case and vice versa of a...
- Given a string, say sentence=" this is crazy and fun" and a list, say ...
- Write a program to remove the vowels from the input string.
- Write fibonacci series program. INPUT: 10 term OUTPUT: 0 1 1 2 3 5...