TCS
Company
Category
2. Mr. Bean chooses a number and he keeps on doubling the number followed by subtracting one from it, if he chooses 3 as initial number and he repeats the operation for 30 times then what is the final result?
a. (2^30) - 1
b. (2^30) - 2
c. (2^31) - 1
d. (2^31) – 2
Read Solution (Total 4)
-
- ans: 2^31 +1
for the first time 3 3*2=6 6-1=5
2^2 +1=5
for the second time 5 5*2=10 10-1=9
2^3 +1 =9
.
.
.
therefore for the 30th time ans will be 2^31 +1 - 9 years agoHelpfull: Yes(9) No(0)
- it can done by verification with small no:
let repeat it for 3 times instead of 30 times
i.e 1st time 3*2-1=5 =>2^2 +1
2nd time 5*2-1=9 =>2^3+1
3rd time 9*2-1=17=>2^4+1
for last time the answer is 2^31 +1 which is not given in the options - 9 years agoHelpfull: Yes(1) No(0)
- dummy question
- 9 years agoHelpfull: Yes(1) No(0)
- Ans:
(2^31)+1 - 6 years agoHelpfull: Yes(0) No(0)
TCS Other Question