- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
TCS Interview programming questions
If you want to apply for TCS then this article might be helpful for you as well as your friends.TCS is basically a large IT company which hire on basis of programming knowledge and some other factors.Programming is a basic factor that TCS must test before giving job.
So,reading previous interview programming questions that TCS ask frequently in its interview is very beneficial.
TCS Programming questions – Important Points
Source
Instructions
1) Only Single question, 20 minutes is given.2) You can write your code in C / C++ / Java .
3) TCS itself provide an IDE to debug.
4) If you write your code in Java, the class name should be named Maze.
5) As per the instructions,The input to the program either through STDIN / Command line arguments.
6) The program should write the output to STDOUT.
Points to note
1) While printing the output no leading or trailing spaces should be printed.2) Other than the required output, no other text should be printed.
3) If the output is a number, no leading sign must be printed unless it is a negative number.
4) No scientific notation (3.9265E + 2).
5) All floating point numbers must contain that many decimal places as mentioned in the question.
TCS important programming questions
Q1.
Find the 19th term of the series?0,0,7,6,14,12,21,18, 28
Comment answer in comment sections to help others.
Q2.
Given series: 1, 2, 1, 3, 2, 5, 3, 7, 5, 11, 8, 13, 13, 17, …
Series is a mixture of 2 series – odd terms in this series form a Fibonacci series and even terms are the prime numbers in increasing order. Now write a program to find the Nth term in this series.Comment answer in comment sections to help others.
Q3.
Series: 0,0,2,1,4,2,6,3,8,4,10,5,12,6,14,7,16,8
Series is a mixture of 2 series-odd terms in this series form even numbers in ascending order and 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 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 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.
Comment answer in comment sections to help others.
Q4.
The program will recieve 3 English words inputs from STDIN
- These 3 words will be read one at a time, in three separate line
- The first word should be changed like all vowels should be replaced by $
- The second word should be changed like all consonants should be replaced by #
- The third word should be changed like all char should be converted to upper case
- Then concatenate the three words and print them
For example if you print how are you then output should be h$wa#eYOU.
You can assume that input of each word will not exceed more than 5 chars
Write Code for this
Comment answer in comment sections to help others.
Q5.
Which keyword is used to come out of a loop only for that iteration?
A. break
B. continue
C. return
D. None of the mentioned
Q6.
Write a C program to calculate the factorial of a
non negative integer N. The factorial of a number N is defined as the
product of all integers from 1 up to N. Factorial of 0 is defined to be
1. The number N is a non negative integer that will be passed to the
program as the first command line parameter. Write the output to stdout
formatted as an integer WITHOUT any other additional text.
You may
assume that the input integer will be such that the output will not
exceed the largest possible integer that can be stored in an int type
variable.
Example:
Example:
If the argument is 4, the value of N is 4. So, 4 factorial is 1*2*3*4 = 24. Output : 24
Comment answer in comment sections to help others.
Q7.
What is the output of this C code?
void main()
{double k = 0;
for (k = 0.0; k < 3.0; k++);
printf("%lf", k);}
A. 2.000000
B. 4.000000
C. 3.000000
D. Run time error
Comment answer in comment sections to help others.
Q8.
Consider the given input and output:
Input: Get 3 strings in 3 lines as input
Hello
Hi
Good Morning
Hi
Good Morning
Output:
- In the 1st string, replace the vowels with “
- In the 2nd string, replace the consonants with *
- In the third string, convert the lowercase letters to upper case.
Comment answer in comment sections to help others.
Q9.
Find the value of N when F(N) = f(a)+f(b) where a+b is the minimum possible and a*b = N
- F(1) = 0
- F(2) = 2
- F(N) = 0, if N is odd prime.
- F(N) = F(a) + F(b), where a and b are factors of N and (a + b) is minimum among all factors. Also a * b = N
Input: N = 5
Output: 0
Since 5 is an odd prime.
Input: N = 4
Output: 4
4 can be written as 2 * 2, hence f(2) + f(2) = 4
Input: N = 20
Output: 4
20 can be written as f(4) + f(5), and f(4) can be written as f(2) + f(2), which is 4.
Comment answer in comment sections to help others.
Q10.
Make Binary Search Tree
If possible then print Yes else print No.
Examples:
Input: arr[] = {3, 6, 9, 18, 36, 108}Comment answer in comment sections to help others.
Output: Yes
This is one of the possible Binary Search Tree with given array.
Input: arr[] = {2, 17}
Output: No
Some important algorithms to practice for TCS interview :
TCS Programming Questions | Number of times asked in the Test |
String Reversal | 14 |
Average of two Numbers | 39 |
LCM of two Numbers | 51 |
HCF/GCD Question | 66 |
LCM & HCF | 10 |
Swapping and Reversal | 20 |
Factorial and Series | 20 |
Operations on Numbers | 30 |
Misc | 20 |
If this article is helpful please Follow , Share and Comment.
Please follow my blog if you are interested in web development and programming
If you have any questions and queries fill contact form,i will reply immediately.
For more programming questions you may try :
https://www.geeksforgeeks.org/
https://www.freshersnow.com/tcs-placement-papers/
https://www.faceprep.in/tcs-ninja-coding-questions/
https://prepinsta.com/tcs-interview/
c
c++
coding
java
python
tcs interview questions
tcs interview questions pdf languages
tcs interview questions quora
tcs programming questions 2019 top programming sites
top coding languages
- Get link
- X
- Other Apps
Comments
This comment has been removed by a blog administrator.
ReplyDelete