TCS-NQT - Question-Paper - 3
TCS-NQT - Question-Paper - 3
Q1. What is the value of (a + b + c)2 : (a3 + b3 + c3) if (ab + bc + ca) = 131, (a2 + b2 + c2) = 138 and abc =
280?
A. 15 : 43
B. 18 : 41
C. 20 : 49
D. 17 : 434
Answer: C
om
A. Both I and III
B. Only III
.c
C. Both II and III
D. Only I
Answer: D w
no
Q3. Simplify
0.7 x 0.7 x 0.7 + 0.3 x 0.3 x 0.3 + 0.3 x 0.7 x 3
rs
--------------------------------------------------
he
C. -⅓
D. 3
.fr
Answer: A
w
Q4. In an examination, 62% candidates passed in physics and 60% candidates passed in Mathematics. If
w
37% candidates passed in both these subjects, what percent of the candidates failed in both the subjects?
A. 5%
w
B. 20%
C. 25%
D. 15%
Answer: D
Q5. If price of petrol increases by 35% and Rajesh intends to spend only an additional 25% on petrol, by
how much % will he reduce the quantity of petrol purchased?(Approx)
A. 14%
B. 9%
C. 11%
D. 13%
Answer: C
Q6. If 20% apples from a cart are rotten and the remaining apples are sold at 20% discount, the seller gets
92% profit on the cost price of the whole cart. By what percent above the cost price has the seller marked
up the apples?
A. 180%
B. 250%
C. 200%
D. 280%
Answer: C
Q7. Selling an item at 5/6th of its marked price results in a loss of 10%. What is the % of profit/loss, if a
discount of 5% is offered on the marked price?
om
A. 2.6% loss
B. 2.6% profit
C. 3% profit
.c
D. 3% loss
Answer: B
w
Q8. The simple interest earned on a sum of Rs. 3650 at some rate after 4 years is Rs. 584. Find the rate of
no
interest (in p.a.)
A. 3.5%
rs
B. 4.5%
C. 3%
he
D. 4%
Answer: D
es
A. 5 : 4
B. 4 : 5
w
C. 1 : 1
D. 2 : 3
w
Answer: A
w
A. 10
B. 12
C. 8
D. 9
Answer: A
Q12. A sum amounts to Rs. 16,000 at the end of three years and to Rs. 25,600 at the end of six years under
compound interest (interest being compounded annually). Find the simple interest earned if the same sum
is invested at 15% p.a. for two years.
om
A. Rs. 3,000
B. Rs. 4,000
C. Rs. 3,500
.c
D. Rs. 4,500
Answer: A
w
no
Q13. A flask is filled with 20% acid. 49 ml of that solution is taken out and is replaced with 40% acid to
make it a solution of 27% acid. Find the initial volume of the solution in the flask.
A. 140 ml
rs
B. 175 ml
he
C. 70 ml
D. 105 ml
Answer: A
es
Q14. Disha and Patni entered into a partnership. Disha invested as much money as was earned by Patni a
.fr
share from the profit. If the profit was Rs. 18,000 and the money invested by Disha was Rs. 3,000 more
than Patni, What is the investment made by Disha if it is less than Rs. 5,000?
w
A. Rs. 4,500
w
B. Rs. 7,500
C. Rs. 6,000
w
D. Rs. 5,500
Answer: A
Q15. If the 9-digit number 807x6y9z8 is divisible by 99, then the value of (x + y + z)^½ is ______
A. 4
B. 3√3
C. 6
D. √5
Answer: A
Q16. Rahul and Sachin can complete a work in 60 days and 45 days respectively. Rahul starts working with
120% of his capacity and Sachin with 80% of his capacity. In how many days will they complete 75% of the
work if they work together?
A. 25.71
B. 19.85
C. 17.64
D. 16.24
Answer: B
Q17. The ratio of the speed of a bus and a car is 2:5. The car covers a distance of 280 km in some time and
the bus covers a distance of d km less in the same time. What is the distance covered by the bus?
A. 132 km
B. 168 km
C. 112 km
om
D. 144 km
Answer: C
.c
Q18. A boat travels 12 km downstream and 6 km upstream in 3 hours. The same boat takes fifty percent
extra time to cover 10 km downstream and 16 upstream. If the same boat travels 20 km downstream and z
km upstream in 4 hours, find z. w
no
A. 8 km
B. 4.5 km
C. 7.5 km
rs
D. 9 km
he
Answer: B
Q19. Ranjeet’s present age is half of his brother Manjeet’s age after 10 years. After 5 years, the ratio of ages
es
B. 20 yrs
C. 15 yrs
w
D. 18 yrs
w
Answer: D
w
Q20. A plane is cutting a cone parallel to the base in such a way that the radius of the new cone is half of
the radius of the original cone. Find the ratio of the volume of the original cone to that of the volume of the
portion of the cone left after being cut by the plane ( the part other than the new cone).
A. 8 : 7
B. 9 : 7
C. 7 : 6
D. 8 : 5
Answer: A
Q22. In a circular ground of radius 28m, the shaded portion area in the circle represents forest area while
the remaining part of the circle is available for construction purposes. Find the area reserved for construction
purpose(approx).
om
A. 1764 m²
B. 3120 m²
.c
C. 1850 m²
D. 2053 m²
Answer: D w
no
Q23. Find the difference between arithmetic mean and median of the first seven consecutive natural
numbers.
rs
A. 1
he
B. 3.5
C. 2
D. 0
es
Answer: D
.fr
Q24. Find the quartile deviation of the observations 16, 2, 8, 24, 4, 32, 18.
A. 8
w
B. 12
w
C. 6
D. 10
w
Answer: D
Q25. The standard deviation of a series of ‘n’ observations is σ. If each observation is multiplied by 12, the
respective ratio of the standard deviation and the variance is:
A. 1 : 9σ
B. 1 : 12σ
C. 3σ : 1
D. σ : 1
Answer: B
Q26. If the arithmetic mean of 23, 15, 19, p, 12, 7, is 16 while the arithmetic mean of 37, 28, 53, q, 42 is 41,
then find (p+q)/(q-p)
A. 2.6
B. 2.2
C. 3.5
D. 3.2
Answer: A
om
.c
w
no
rs
he
es
.fr
w
w
w
TCS Ninja Verbal Ability Questions
Q1. One part of the sentence below may contain an error. Identify the part. If there is no error, please choose
‘No error’.
Riya finally declined the proposal which she were eagerly waiting for.
Answer: A
om
Q2. Read the following passage and fill in the blanks by selecting the most appropriate option.
Experts warn that tourists should stay as far away as possible from wild elephants. They do not look violent
.c
or ____ 1 _____when compared to the big cats. But, a five ton _____2_____ elephant can do serious damage.
A. 1-c, 2-b
rs
B. 1-b, 2-a
he
C. 1-a, 2-b
D. 1-d, 2-b
es
Answer: A
.fr
Q3. One part of the sentence below may contain an error. Identify the part. If there is no error, please choose
‘No error’.
w
w
As little pieces of debris and space-dust burn up in Earth’s atmosphere, it causes spectacular shooting stars.
w
A. No error
B. It causes spectacular shooting stars
C. As little pieces of debris and space-dust
D. burn up in Earth’s atmosphere
Answer: B
Q4. Read the following passage and fill in the blanks by selecting the most appropriate option.
Sailing is fun. But it takes work and muscles to keep the sailboat moving. One will have to constantly ___1___
the weather and adjust the sails to turn the boat in the required direction. It also takes a lot of ___2___ to
raise the mast and sails before you start enjoying the freedom of exploring new places in your sailboat.
A. 1-c, 2-b
B. 1-b, 2-a
C. 1-c, 2-d
D. 1-a, 2-a
Answer: B
om
Q5. Abdul is confident ____ the scholarship.
A. of winning
.c
B. to win
C. in winning
D. for winning w
no
Answer: A
rs
B. by
C. at
es
D. on
.fr
Answer: D
w
w
Q7. One part of the sentence below may contain an error. Identify the part. If there is no error, please choose
w
‘No error’.
All the students of the class decided to head to the Principal’s office to complain for the new teacher’s
misconduct.
Answer: C
Q8. For the four sentence (S1 to S4) paragraph, sentences S1 and S3 are given. From the options P, Q and
R, choose the appropriate sentences for S2 and S3 respectively.
S1. The colour of the ocean is due to the absorption and scattering of the sunlight.
S2.
S3.
S4. This water now scatters both blue and yellow light, producing the characteristic green colour of the
Atlantic Ocean.
P. When sunlight strikes the water, the red wavelength is absorbed and blue wavelength is scattered,
making the ocean appear blue.
Q. However, in the case of the Atlantic Ocean, the decaying plants on the ocean bed release yellow pigments
that dissolve in the water.
om
R. The colour of the water depends on the light scattered and substances dissolved in it.
A. PQ
.c
B. QR
C. RQ
D. QP w
no
Answer: A
rs
Q9. One part of the sentence below may contain an error. Identify the part. If there is no error, please choose
‘No error’.
he
The soldiers, in an attempt of showing their loyalty towards their king, fought ruthlessly until the end of war.
es
A.No error
B.fought ruthlessly until the end of war.
.fr
Answer: C
w
w
Answer: D
Q11. Read the following passage and fill in the blanks by selecting the most appropriate option.
Did you know that most of the mothers in the animal kingdom feed on their new borns? It comes as a __1__
for many humans who have always overly __2__ the role of a mother. The animal kingdom, especially the
species of the lower strata like reptiles and insects , lack emotions like mammals.
A. 1-a, 2-b
B. 1-d, 2-a
C. 1-b, 2-a
D. 1-c, 2-b
om
Answer: B
.c
Q12. Select the appropriate option to fill in the blank.
Kamlesh wanted to argue and __________ to rebel, but the fear of Mr. Rattan, his teacher, always stopped
him.
A. longed
w
no
B. is longing
C. has longed
rs
D. longs
he
Answer: C
es
Q13. Rathan than ________ stones on the mad man, people should be ____ with him and providing him with
the appropriate treatment.
.fr
A. pelting, sympathized
B. pelting, sympathizing
w
C. pelted, sympathizing
D. pelt, sympathize
w
w
Answer: B
Q14. For the four sentence (S1 to S4) paragraph, sentences S1 and S3 are given. From the options P, Q and
R, choose the appropriate sentences for S2 and S3 respectively.
S1. In the early years when long trade voyages were undertaken that would take months or maybe even a
year to reach the destination, coconuts were granted a special place.
S2.
S3.
S4. Its popularity has recently increased although they were grown in tropical regions for more than 4,500
yrs.
P. By and large, the coconut water was drunk and the pulp eaten.
Q. The best part of this fruit was that there were no chances of it going bad.
R. The voyages were rife with difficulties and hardships
A. RQ
B. PQ
C. QP
D. RP
Answer: B
om
Q15. For the four sentence (S1 to S4) paragraph, sentences S1 and S3 are given. From the options P, Q and
R, choose the appropriate sentences for S2 and S3 respectively.
S1. Probably dating back to the early Neolithic and even the Palaeolithic age, the mythology of Greek
.c
goddesses is considered to be the oldest mythologies of the world, even a precursor to Indo-European
mythologies.
S2.
S3.
w
no
S4. She was a symbol of regenerative powers of nature such as fertility, birth, rebirth and death.
rs
P. The Biblical snake is one of the many remaining symbols that demonise the old female snake death.
Q. It is largely been censored by the scientific community and yet there is extensive reliable research on the
he
subject.
R. A 20th century archaeologist, Marija Gimbutas developed a theory on an evolved and pastrola Old
es
European civilisation that worshipped Goddesses in the form of a bird, feline or a snake
A. RQ
.fr
B. QP
C. RP
w
D. PQ
w
Answer: A
w
Q16. For the four sentence (S1 to S4) paragraph, sentences S1 and S3 are given. From the options P, Q and
R, choose the appropriate sentences for S2 and S3 respectively.
S1. Using data analytics has helped companies identify trends and purchase patterns at various levels and
helped customise various styles.
S2.
S3.
S4. It is correct to say that many business owners will have a lot on their minds post lockdown and till the
pandemic dies down.
P. Data analytics utilizes powerful algorithms to analyse current and past customer data to come up with
solutions
Q. They have adapted to digitalization and have customized their products in line with current trends
R. Low cost of implementing data analytics driven software is an added advantage
A. QP
B. RQ
C. QR
D. PR
Answer: A
om
Q17. You are going to read a text about the history of working women. Some sentences are missing from
the text. Choose from the list (A-C) the most appropriate sentence for each gap (1-2) in the text. There is
one extra sentence that you do not need to use.
.c
Women started working in the time of the war during the period of 1914-1918 and 1939-1945, when the
w
need of the hour was manpower at the factories and other industries. ___1___ While their husbands and
no
brothers were away at war, women fulfilled their new roles, ___2___. Many other women were inspired by
those women who were able to perform both the roles adeptly. A much greater increase in the percentile of
working women was seen after the industrial revolution, when the industrial society was doing extremely
rs
well.
he
A. Back at home, they were still performing their own roles which were looking after kids, running the house,
etc.
es
A. 1-A, 2-A
w
B. 1-B, 2-A
C. 1-C, 2-A
w
D. 1-B, 2-C
w
Answer: B
Q18. Which one of the following sentences uses the formal language?
A. I am shocked at your rowdy behaviour.
B. Hey! Let’s grab a cup of joe.
C. Heck! I lost all my data.
D. I am greatly devastated to learn about the demise of your mother.
Answer: D
Q19. The Following sentence pair can be combined into one better sentence. Choose the option that
combines the two sentences best without changing the meaning.
Aniruddh has been playing the tabla throughout the day. This explains the pain in his fingers.
A. The pain in his fingers explains that he has been playing the tabla throughout the day.
B. Aniruddh was playing the tabla all day long so he can get pain in his fingers.
C. Aniruddh has been playing the tabla all day long, which explains the pain in his fingers.
D. Aniruddh has been playing the tabla throughout the day so he can’t explain the pain in his fingers.
Answer: C
Q20. You are going to read a text about transformation of self. Some sentences are missing from the text.
Choose from the list (A-C) the most appropriate sentence for each gap (1-2) in the text. There is one extra
sentence that you do not need to use.
Transformation is usually painful because it involves a process, a means to find an end. 1 ___________ In
om
pain is our true enlightenment as our crucial lessons are learnt here. 2 ______________ For humans, evolution
is painfully slow as we take the longest to learn.
A. Attainment, on the other hand, is happiness because you gained what you wanted.
.c
B. Without process, however, there is no achievement, so there is no gain without pain.
C. How long the process continues will depend on how fast we learn our lessons.
A. (1)-A, (2)-B
B. (1)-A, (2)-C
w
no
C. (1)-C, (2)-B
D. (1)-B, (2)-C
rs
Answer: D
he
Mental health can affect daily living, relationships and physical health. Factors in people’s lives, interpersonal
connections and biological factors can all contribute to mental health disruptions. Looking after mental health
.fr
can preserve a person’s ability to enjoy life. Doing this involves reaching a balance between life activities,
responsibilities and efforts to achieve psychological resilience. Conditions such as stress, depression and
w
anxiety can all affect mental health and disrupt a person’s routine. Although mental health is in everyday
use, many conditions that doctors recognize as psychological disorders have physical roots.
w
w
Mental health is about not only avoiding active conditions but also looking after ongoing wellness and
happiness. Preserving and restoring mental health is crucial on an individual basis and throughout different
communities and societies the world over. In the United States, the National Alliance on Mental Illnesses
estimates that almost 1 in 5 adults experience mental health problems each year.
According to the National Institute of Mental Health (NIMH), in 2017, an estimated 11.2 million adults in the
USor about 4.5 % of adults, had a severe psychological condition. Everyone has some risk of developing a
mental health disorder, no matter their age, sex, income or ethnicity. In the US and much of the developed
world, mental health disorders are one of the leading causes of disability. Social and financial circumstances,
biological factors, and lifestyle choices can all shape a person’s mental well-being. A large proportion of
people with a mental health disorder have more than one condition at a time. It is important to note that
good mental health depends on a delicate balance of factors and that several elements of life and the world
at large can work together to contribute to disorders.
Answer: A
om
health.
B. Mental health involves reaching a balance between life activities, responsibilities and efforts to achieve
psychological resilience.
.c
C. Preserving and restoring mental health is crucial on an individual basis, as well as throughout different
communities and societies the world over.
w
D. Mental health is about not only avoiding active conditions, but also looking after ongoing wellness and
happiness.
no
Answer: A
rs
A. Prescribing
B. Incendiary
es
C. Laudatory
D. Analytical
.fr
Answer: D
w
Q24. What do you mean by “Mental health is about not only avoiding active conditions but also looking after
w
A. Mental health care is about looking after ongoing wellness and happiness on a day-to-day basis.
B. Mental health care is about treatment of active mental health disruptions as well as general mental well-
being.
C. Mental health care is not about taking care of mental disruptions but bodily diseases.
D. Mental health care is about avoiding active mental disruptions only.
Answer: B
TCS Ninja Reasoning Ability Questions
Q1. Which is the WRONG term in the following series?
LAT, OES, QIR, SOQ, UUP
A. QIR
B. LAT
C. UUP
D. SOQ
Answer: A
Q2. The table shows the total number of 10th class students in 5 different schools [P, Q, R, S and T]
and the ratio of the number of students in Art, Commerce and Science respectively.
The students study only the above subjects in the class of each school.
om
School Total Students Arts : Commerce : Science
P 240 1:2:3
.c
Q 450 7:1:1
w
no
R 360 5:4:3
S 180 2:5:3
rs
T 330 6:4:1
he
B. 220
C. 260
.fr
D. 240
w
Answer: C
w
Q3. In each of the five pairs of letter-clusters, the letters in the second term are a rearranged/transformed
w
form of the letters in the first term in a particular pattern. In which two pairs, has the transformation been
done in the same way?
A. PLANT : PLZMG
B. MANGO : MAMTL
C. BLACK : BLBDP
D. TABLE : ATLBE
E. CHEER : HCREE
A. A and B
B. D and A
C. B and C
D. C and D
Answer: A
Q4. Given below is a question followed by two statements, I and II each containing some information. Decide
which of the statement(s) is/are sufficient to answer the question.
Five persons - A, B, C, D and E - sit around a circular table, facing the centre not necessarily in that order.
Who sits second to the right of D?
I. A sits to the immediate right of E, who is not a neighbour of D.
II. B is to the immediate left of D.
A. If only statement II is sufficient to answer the question
B. If the data in both the statements I and II together are necessary to answer the question.
C. If only statement I is sufficient to answer the question.
D. If the data either in statement I alone or in statement II alone is sufficient to answer the question.
om
Answer: B
Q5. Given below is a question followed by two statements, I and II each containing some information. Decide
.c
which of the statement(s) is/are sufficient to answer the question.
Six persons P, Q, R, S, T and U have different scores in a classroom test, who scored the 2nd highest marks?
w
I. P scores better than T and Q, who scores better than S. S scores better than U. R scores better than P.
II. S scores better than at least one person, P scores better than S and T.
no
A. The data is statement I alone is sufficient to answer the question, while the data in statement II alone is
not sufficient to answer the question
rs
B. The data given in both statements I and II together is not sufficient to answer the question
C. The data either in statement I alone or in statement II alone is sufficient to answer the question
he
Q. The data is statement II alone is sufficient to answer the question, while the data in statement I alone is
not sufficient to answer the question.
es
Answer: A
.fr
Q7. The annual salary of a person consists of two parts - basic salary and allowance. The allowance is always
calculated as a fraction of the basic salary. Every year, his basic salary increases by Rs.5000 and his
allowance, as a percentage of his basic salary, increases by 5 percentage points. The present basic salary of
the person is Rs. 30,000 and his present allowance is 20% of his present basic salary. After how many
months from now will the Annual salary of the person be Rs. 60,750?
A. 33
B. 30
C. 36
D. 24
Answer: C
om
K % L means L is mother of K.
K + L means K is grandson of L.
K × L means L only child of K.
.c
K © L means K is L’s sister.
R+A×E@F#G© T
w
Which of the following is a CORRECT conclusion drawn from the expression?
no
A. F is daughter of A
B. R is father of T.
rs
C. E is mother of T.
D. R is son of G.
he
Answer: D
es
.fr
Q9. The given question consists of six statements followed by 4 options consisting of three statements put
together in a specific order. Choose the option, which indicates a valid argument that is, when the third
w
A. b f e
B. a f c
C. d c f
D. a c e
Answer: D
Q10. Three statements are given followed by two conclusions numbered I and II. You have to consider these
statements to be TRUE, even if they seem to be at variance with commonly known facts. Decide which of
the given conclusions logically follows from the given statement.
Statements:
Some books are cars.
No bus is a car.
Some cars are motors.
Conclusions:
I. Some motors are not buses.
om
II. Some books are buses.
A. If either I or II follows
.c
B. If neither I or II follows
C. If only II follows
D. If only I follows w
no
Answer: B
rs
Q11. A statement is followed by two assumptions numbered I and II. Consider the statement and decide
he
Statement:
Country X will talk on every issue and try to resolve every conflict with its neighbouring country.
.fr
Assumptions:
w
Answer: C
Q12. A statement is followed by two arguments numbered I and II. Decide which of the argument(s) is/ are
strong (important and directed related to the question) and which is/ are weak (not important and not related
to the central message of the question).
Statement:
Should young children be exposed to virtual gaming?
Arguments:
I. Yes. It will prepare them for leadership.
II. No. Young minds cannot take violence.
Answer: A
om
Q13. Two statements are given followed by two conclusions numbered I and II. You have to consider these
statements to be TRUE even if they seem at variance with commonly known facts. Decide which of the
.c
conclusions logically follows from the given statement.
Statements:
All runs are overs.
w
no
Some overs are bats.
rs
Conclusions:
I. All bats are runs.
he
A. If either I or II follows.
B. If neither I nor II follows.
.fr
C. If only I follows.
D. If only II follows.
w
Answer: B
w
w
Q14. Following are the selection criteria for any student to get admission in “Central University of India” for
any undergraduate program.
Answer: B
Q15. Rohan is selecting pizza from a pizzeria. Following are the criteria of selection by him for the pizza.
a. It must be a non-veg pizza.
b. It must cost less than INR 450.
c. It must be a hand toasted pizza.
om
d. If any pizza is satisfying all the criteria given above except c, but it is a cheese burst pizza, then he needs
permission from his uncle.
e. If any pizza is satisfying all the criteria given above except b, but provides mushroom and corn for free,
.c
then he needs permission from his mother.
w
“Pizza on the spot” house is providing a new hand toasted non-veg pizza which costs Rs.550. It provides
free toppings of onion, capsicum, corn, paneer and tomato.
no
A. He will need to take permission from his uncle.
rs
D. It will be selected.
es
Answer: B
.fr
Q16. Five persons A,B,C,D, and E are comparing the number of books which they have bought recently. A
bought more number of books than C and E, but not the highest. B bought more number of books than
w
exactly one person. Then which of the following bought the highest numbers of books?
w
A. C
w
B. E
C. D
D. B
Answer: Option C
Q17. Rajpal is going to buy a laptop. Following are the criteria of selection of the laptop given by his father.
a. Must be < Rs.38,000.
b. Must have RAm equal to or more than 8 GB.
c. Must have intel processor of version i3 or above.
d. If any laptop is satisfying all of the above criteria except a, it will need his dad’s permission if it is less than
Rs.45,000.
e. If any laptop is satisfying all of the above criteria except b, it will need his mom’s permission if it has storage
of more than 512 GB.
ATC58 is a new laptop in the market that costs Rs.36,000and having 16 GB RAM. It consists of Pentium 8
processor and pre-installed Windows 10.
Which of the following options below is CORRECT for the laptop given above?
om
Answer: D
.c
Q18. I, J, K, L, M and N have their birthdays not in the same order but in different months such as January,
February, April, July, August and December. w
no
Two people have their birthdays between N and J’s birthday. M’s birthday is not in the second half of the
year. The birthday of N is either in January or August. K’s birthday falls in the month having the minimum
rs
number of days. At the most, 3 people have birthdays between N and I’s birthday.
he
B. J, birthday in July
C. Person J
.fr
Answer: D
w
Q19. Eight persons A,B,C,D,E,F,G and H are sitting around a square table . All of them are facing towards
w
the centre. Only one person sits on each of the sides and only one person sits on each of the corners. Four
of them sit on the sides and four of them sit on the corners. C is sitting 3rd to the left of B, who sits on a side.
D is sitting opposite to H, who is sitting 3rd to the right of B. A is sitting 2nd to the right of G. G is not sitting
opposite to either E or F, F is not an immediate neighbor of H.
Q20. Six friends L, M, N, O, P and Q are sitting around a circular table and facing outside. Q is sitting fourth
to the left of M, who is sitting to the immediate left of N. P is sitting opposite to N and and adjacent to O. O
is not sitting adjacent to Q.
A. L is adjacent to P
B. M is between O and P
C. P is sitting opposite to Q
D. There are 3 friends sitting between M and L.
Answer: A
om
.c
w
no
rs
he
es
.fr
w
w
w
TCS Ninja Programming Logic Questions
1. *From the given statements, which one is CORRECT regarding infix notation?
A. Operators can be written either before or after operands
B. Operators are written between the operands.
C. Operators are written between the operands.
D. Operators are written after the operands.
Answer: B
om
D. ==
Answer: D
.c
w
3. Which of the below SDLC models does not incorporate any changes?
no
A. Build and Deploy Model
B. RAD Model
C. Waterfall Model
rs
Answer: C
C. Backtracking
D. Greedy Algorithm
w
Answer: A
w
w
6. #include<stdio.h>
int main () {
while (){
print(“Hello World”);
}
return 0;
}
A. No output will be printed
om
B. Hello World
C. Compilation error
D. Infinite loop
.c
Answer: C
C. Wxy*+za*+
D. W+xy*za
he
Answer: C
es
B. Spiral Model
C. V Model
w
D. Incremental Model
Answer: B
w
w
om
Enter your answer only as a NUMERAL in the box.
Answer: 12
.c
11. What will be the output of the following code?
#include <iostream>
using namespace std;
#define pi 3.14159
w
no
int main ()
{
rs
float r = 3;
float circular_area;
he
circular_area = pi * r * r;
cout<<circular_area;
es
return 0;
}
.fr
A. 28
B. 28.2743
w
C. 29
D. 18.7564
w
Answer: B
w
TCS Ninja Hands-on Coding Questions
Q1. Given a non-negative integer array Arr having size N. Each element of the array will carry a different
value. This means no two elements can have the same values.The candidate has to do this with minimal
changes in the original value of the elements, making every element as least as much value as it originally
had.
Find the minimum sum of all elements that can be set the array for:
Example 1:
Input
3 -> Value of N, represents size of Arr
2 -> Value of Arr[0]
2-> Value of Arr[1]
om
4-> Value of Arr[2]
Output
.c
9
Explanation: w
no
As two elements have the same value, max value for the one of them needs to be incremented to 3.
He can set the array with 2+3+4=9
rs
Example 2:
he
Input
2 -> Value of N, represents size of Arr
3 -> Value of Arr[0]
es
Output
w
Wrong Input
w
Explanation:
w
Here N=2, so we need to provide value of only two elements but we are providing value of three elements
so result is “Wrong Input”
Solution in C++:
#include<iostream>
using namespace std;
int main()
{
int n, sum = 0, flag = 0;
cin >> n;
int arr[n];
for(int i = 0; i < n; i++)
{
cin >> arr[i];
om
}
for(int i = 0; i < n; i++)
{
.c
for(int j = i+1; j < n; j++)
{
if(arr[i] == arr[j])
{
w
no
arr[i] = arr[i]+1;
}
rs
if(arr[j] < 0)
flag = 1;
he
}
}
es
if(flag == 1)
cout << "Wrong Input";
w
else
w
Q2. 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 the output will print “5”.
om
Example 2
Input:
101 ---> Integer
.c
Output:
Wrong input → result - String
Explanation:
w
no
Given integer “101” is out of range. Hence the output will print “Wrong input”.
rs
Instructions
w
2. Written program code by the candidate will be verified against all the inputs which are supplied from
the system.
Solution in C++:
#include<iostream>
using namespace std;
void toggle(int &n)
{
int temp = 1;
while (temp <= n)
{
n = n ^ temp;
temp = temp << 1;
}
}
int main()
{
int n;
cin >> n;
if(n <= 100)
{
toggle(n);
cout << n;
}
else
om
cout << "Wrong Input";
return 0;
}
.c
w
no
Q3. Given a string S(input) consisting of * and #. The length of the string is variable. The task is to find the
minimum number of * and # required to make it a valid string. The string is considered valid if the number of
rs
* and # are equal. The * and # can be at any position in the string.
he
Note: The output will be a positive or negative integer based on number of * and # in the input string.
es
(#=*): 0
w
Example 1:
Input
w
###*** → Value of S
w
Output
0 ---> number of * and # are equal
Example 2:
Input
###***# → Value of S
Output
-1 ---> number of # is more than *
Example 3:
Input
#*** → Value of S
Output
2 ---> number of * is more than #
Constraints
S = {*,#}
om
0<len(S)<=50
Solution in C++:
.c
#include<iostream>
using namespace std;
int main()
{
w
no
string str;
int count = 0, count1 = 0;
rs
{
if(str[i] == '#')
es
count++;
if(str[i] == '*')
.fr
count1++;
}
w
if(count == count1)
cout << "0";
w
else
w