TCS Coding Questions 2022 Day 1 Slot 1

Coding Question 2 for 2022 (September slot)

In this article, we will discuss about the TCS Coding Question which is asked in the TCS placement test. This type of Coding Questions will help you to crack your upcoming TCS exam as well as during your inteview process.

TCS Coding Question 4 Day1 Slot 1

TCS Coding Question Day 1 Slot 1 – Question 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”.


Constraints :

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”.