Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Programming Questions in JAVA Asked at Experienced

    211 / 226

    Consider the below series : 0,0,2,1,4,2,6,3,8,4,10,5,12,6,14,7,16,8
    This series is a mixture of 2 series all the odd terms in this series form even numbers in ascending order and every even terms is derived from the previous term using the formula (x/2)

    Write a program to find the nth term in this series.

    The value n in 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 the nth term no other characters /strings or message should be written to STDOUT.

    For example if n=10,the 10 th term in the series is to be derived from the 9th term in the series. The 9th term is 8 so the 10th term is (8/2)=4. Only the value 4 should be printed to STDOUT.

    You can assume that the n will not exceed 20,000.

    Input : NA


    Output : NA

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

    212 / 226

    Write an efficient program to find the sum of contiguous sub-array within a one-dimensional array of numbers which has the largest sum.

    Input : {-2, -3, 3, -1, -2, 1, 5, -3}


    Output :

    Please Login to view the answer

    213 / 226

    Given an expression string exp. Examine whether the pairs and the orders of “{“,”}”,”(“,”)”,”[“,”]” are correct in exp.
    For example, the program should print 'balanced' for exp = “[()]{}{[()()]()}” and 'not balanced' for exp = “[(])”

    Input : The first line of input contains an integer T denoting the number of test cases. Each test case consists of a string of expression, in a separate line.


    Output :

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

    214 / 226

    Write a program to find transpose of a square matrix mat[][] of size N*N. Transpose of a matrix is obtained by changing rows to columns and columns to rows.

    Input : The first line of input contains an integer T, denoting the number of testcases. Then T test cases follow. Each test case contains an integer N, denoting the size of the square matrix. Then in the next line are N*N space separated values of the matrix.


    Output :

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

    Tags:Wipro NLTH

    215 / 226

    Given an array arr[] of N integers. Do the following operation n-1 times. For every Kth operation:

    Right rotate the array clockwise by 1.
    Delete the (n-k+1)th last element.

    Now, find the element which is left at last.

    Input : The first line of input contains an integer T denoting the number of test cases. Then T test cases follows. Each test case contains two lines. The first line of each test case contains an integer N. Then in the next line are N space separated values of the array arr[].

    2
    4
    1 2 3 4
    6
    1 2 3 4 5 6


    Output :

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

    Tags:Wipro NLTH

    216 / 226

    Given an array of N positive integers, find GCD of all the array elements.

    Input : Input: N = 3, arr[] = {2, 4, 6}

    Explanation: GCD of 2,4,6 is 2.


    Output :

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

    Tags:Wipro NLTH

    217 / 226

    Given an unsorted array arr[] of positive integers. Find the number of triangles that can be formed with three different array elements as lengths of three sides of triangles.

    Note:
    A triangle is possible
    with all the elements 5, 3 and 4.

    Input : 3
    3 5 4


    Output :

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

    Tags:Wipro NLTH

    218 / 226

    Given an array Arr of N positive integers and another number X. Determine whether or not there exist two elements in Arr whose sum is exactly X.

    Explanation: Arr[3] + Arr[4] = 6 + 10 = 16

    Input : N = 6, X = 16
    Arr[] = {1, 4, 45, 6, 10, 8}


    Output :

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

    219 / 226

    Given an integer N, count the numbers having an odd number of factors from 1 to N (inclusive).

    Input : N = 5


    Output :

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

    Tags:Wipro NLTH

    220 / 226

    Given a String of length S, reverse the whole string without reversing the individual words in it. Words are separated by dots.

    The first line contains T denoting the number of testcases. T testcases follow. Each case contains a string S containing characters.

    Input : i.like.this.program.very.much


    Output :

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

    Tags:Wipro NLTH




You at page 22 practice here all the basics and standard c, C++, JAVA, Python program asked at Experience level job interview or in coding round. Practice our hand-picked 22 coding round programming interview questions asked in coding round of various it companies and exams. You can practice all the given at this page 22 programed given C, C++, JAVA, Python question in any language, you can post your answer and same time you can review other users answer. It is always recommanded to write your own C, C++, JAVA, Python coding questions answer first and then refer others answers. At this page 22 we have covers all the coding questions in 2020-2021 and previously asked in their Interview round or coding rounds.