TCS Placement: Sample Questions 265 - 267 of 502

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 265

Edit

Describe in Detail

Essay▾

Write a function to swap the values of two integers.

Explanation

Program:

  1. #include<stdio.h>
  2. intmain()
  3. {
  4.     intx=15, y=20;
  5.     x=x+y;
  6.     y=x-y;
  7.     x=x-y;
  8.     printf(“Afterswapping :x=%d, y=%d”, x, y);
  9.     return0;
  10. }
  • Output:

After swapping: x = 20, y = 15

Question 266

Question

MCQ▾

A is 20 percent more efficient than B. If two persons can complete a piece of work in 60 days then in how many days A working alone can complete the work?

Choices

Choice (4)

a.

90

b.

100

c.

80

d.

110

Answer

d.

Explanation

  • A is 20 % more efficient than B.
  • If B՚s per day work is 100 units then A՚s per day work will be 120.
  • Both persons together complete a day.
  • If they work together, they will take 60 days to complete the work. So total work = 60 x 220
  • We are asked to find the number of days to complete the work when A alone is working, which will be
  • So, A alone will take 110 days to complete the work.

Question 267

Question

MCQ▾

If a man can swim downstream at 6kmph and upstream at 2kmph, his speed in still water is:

Choices

Choice (4)

a.

4kmph

b.

2kmph

c.

2.5kmph

d.

3kmph

Answer

a.

Explanation

  • Let the speed of man in still water is u kmph.
  • Downstream speed means person is swimming in the direction of water and upstream speed means person is swimming in the opposite direction of flowing water.
  • Downstream speed, a = 6 kmph and upstream speed, b = 2 kmph
  • Speed of man, u = (a + b) /2

u = (6 + 2) /2

u = 4 kmph

  • Man՚s speed will be 4 kmph in still water.

Developed by: