Skip to content

karthikreddy-7/TCS-NQT-CODING-SHEET

Repository files navigation

TCS-NQT-CODING-SHEET

Contains all the previously asked and practice coding questions by TCS in Java Programming Language

Table of Contents

Problems on Arrays

Contains coding problems related to Array manipulation.

1. Find the smallest number in an array Click here to see solution

2. Find the largest number in an array Click here to see solution

3. Second Smallest and Second Largest element in an array Click here to see solution

4. Reverse a given array Click here to see solution

5. Count frequency of each element in an array Click here to see solution

6. Rearrange array in increasing-decreasing order Click here to see solution

7. Calculate sum of the elements of the array Click here to see solution

8. Rotate array by K elements – Block Swap Algorithm Click here to see solution

9. Average of all elements in an array Click here to see solution

10. Find the median of the given array Click here to see solution

11. Remove duplicates from a sorted array Click here to see solution

12. Remove duplicates from an unsorted array Click here to see solution

13. Adding Element in an array Click here to see solution

14. Find all repeating elements in an array Click here to see solution

15. Find all non-repeating elements in an array Click here to see solution

16. Find all symmetric pairs in array Click here to see solution

17. Maximum product subarray in an array Click here to see solution

18. Replace each element of the array by its rank in the array Click here to see solution

19. Sorting elements of an array by frequency Click here to see solution

20. Rotation of elements of array- left and right Click here to see solution

21. Finding equilibrium index of an array Click here to see solution

22. Finding Circular rotation of an array by K positions Click here to see solution

23. Sort an array according to the order defined by another array Click here to see solution

24. Search an element in an array Click here to see solution

25. Check if Array is a subset of another array or not Click here to see solution

Problems on Numbers

Contains coding problems related to number manipulation.

1. Check if a number is palindrome or not Click here to see solution

2. Find all Palindrome numbers in a given range Click here to see solution

3. Check if a number is prime or not Click here to see solution

4. Prime numbers in a given range Click here to see solution

5. Check if a number is armstrong number or not Click here to see solution

6. Check if a number is perfect number Click here to see solution

8. Check whether a given number is positive or negative Click here to see solution

9. Sum of first N natural numbers Click here to see solution

10. Find Sum of AP Series Click here to see solution

11. Program to find sum of GP Series Click here to see solution

12. Greatest of two numbers Click here to see solution

13. Greatest of three numbers Click here to see solution

14. Leap Year or not Click here to see solution

15. Reverse digits of a number Click here to see solution

16. Maximum and Minimum digit in a number Click here to see solution

17. Print Fibonacci up to Nth Term Click here to see solution

18. Factorial of a number Click here to see solution

19. Power of a number Click here to see solution

20. Factors of a given number Click here to see solution

21. Print all prime factors of the given number Click here to see solution

22. Check if a number is a strong number or not Click here to see solution

23. Check if a Number is Automorphic Click here to see solution

24. GCD of two numbers Click here to see solution

25. LCM of two numbers Click here to see solution

26. Check if a number is Harshad number Click here to see solution

27. Check if the number is abundant number or not Click here to see solution

28. Sum of digits of a number Click here to see solution

29. Sum of numbers in the given range Click here to see solution

30. Permutations in which N people can occupy R seats in a classroom Click here to see solution

31. Program to add two fractions Click here to see solution

32. Replace all 0s with 1s in a given integer Click here to see solution

33. Can a number be expressed as a sum of two prime numbers Click here to see solution

34. Calculate the area of a circle Click here to see solution

35. Program to find roots of a Quadratic Equation Click here to see solution

Problems on Number System

Contains coding problems related to number system manipulation.

1. Convert Binary to Decimal Click here to see solution

2. Convert binary to octal Click here to see solution

3. Decimal to Binary conversion Click here to see solution

4. Convert decimal to octal Click here to see solution

5. Convert octal to binary Click here to see solution

6. Convert octal to decimal Click here to see solution

7. Convert digits/numbers to words Click here to see solution

Problems on Sorting

Contains coding problems related to sorting algorithms.

1. Bubble Sort Algorithm Click here to see solution

2. Selection Sort Algorithm Click here to see solution

3. Insertion Sort Algorithm Click here to see solution

4. Quick Sort Algorithm Click here to see solution

5. Merge sort algorithm Click here to see solution

Problems on String

Contains coding problems related to string manipulation.

1. Check if a given string is palindrome or not Click here to see solution

2. Count number of vowels, consonants, spaces in String Click here to see solution

3. Find the ASCII value of a character Click here to see solution

4. Remove all vowels from the string Click here to see solution

5. Remove spaces from a string Click here to see solution

6. Remove characters from a string except alphabets Click here to see solution

7. Reverse a String Click here to see solution

8. Remove brackets from an algebraic expression Click here to see solution

9. Sum of the numbers in a String Click here to see solution

10. Capitalize first and last character of each word Click here to see solution

11. Calculate frequency of characters in a string Click here to see solution

12. Find Non-repeating characters of a String Click here to see solution

13. Check if two strings are anagram of each other Click here to see solution

14. Count common sub-sequence in two strings Click here to see solution

15. Check if two strings match where one string contains wildcard characters Click here to see solution

16. Return maximum occurring character in the input string Click here to see solution

17. Remove all duplicates from the input string Click here to see solution

18. Print all the duplicates in the input string Click here to see solution

19. Remove characters from first string present in the second string Click here to see solution

20. Change every letter with the next lexicographic alphabet in the given string Click here to see solution

21. Write a program to find the largest word in a given string Click here to see solution

22. Write a program to sort characters in a string Click here to see solution

23. Count number of words in a given string Click here to see solution

24. Write a program to find a word in a given string which has the highest number of repeated letters Click here to see solution

25. Change case of each character in a string Click here to see solution

26. Concatenate one string to another Click here to see solution

27. Write a program to find a substring within a string. If found display its starting position Click here to see solution

28. Reverse words in a string Click here to see solution

Previously Asked Coding Question

1. A chocolate factory is packing chocolates into the packets. The chocolate packets here represent an array of N number of integer values. The task is to find the empty packets(0) of chocolate and push it to the end of the conveyor belt(array). Click here to see solution

Example 1 : N=8 and arr = [4,5,0,1,9,0,5,0].

There are 3 empty packets in the given set. These 3 empty packets represented as O should be pushed towards the end of the array

Input :

8 – Value of N

[4,5,0,1,9,0,5,0] – Element of arr[O] to arr[N-1],While input each element is separated by newline

Output:

4 5 1 9 5 0 0 0

Example 2:

Input:

6 — Value of N.

[6,0,1,8,0,2] – Element of arr[0] to arr[N-1], While input each element is separated by newline

Output:

6 1 8 2 0 0

2. Joseph is learning digital logic subject which will be for his next semester. He usually tries to solve unit assignment problems before the lecture. Today he got one tricky question. The problem statement is “A positive integer has been given as an input. Convert decimal value to binary representation. Toggle all bits of it after the most significant bit including the most significant bit. Print the positive integer value after toggling all bits”. Click here to see solution

Constrains-

1<=N<=100

Example 1:

Input :

10 -> Integer

Output :

5 -> result- Integer

Explanation:

Binary representation of 10 is 1010. After toggling the bits(1010), will get 0101 which represents “5”. Hence output will print “5”.

About

Contains all the previously asked coding Questions by TCS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published