TCS Placement: Sample Questions 474 - 476 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 474

Edit

Write in Short

Short Answer▾

1/3 of a number is 6 more than 1/6 of the same number. What is the number?

Explanation

Let the number be x.

1/3 of x = 1/6 of x + 6

The required number is 36.

Question 475

Question

MCQ▾

Which of the following is not a type of constructor?

Choices

Choice (4)

a.

Parameterized Constructor

b.

Default Constructor

c.

Friend Constructor

d.

Copy Constructor

Answer

c.

Explanation

  • Friend constructor is not a constructor - but friend is used for functions.
  • Friend functions are not member functions of a class to which they are a friend.
  • Friend functions are declared inside the class using the friend keyword and then they are defined outside the class.
  • Friend function can access any member of a class to which it is a friend.
  • Friends are functions or whole classes getting access to the private data of a class- breaking encapsulation
  • A function cannot make itself a friend of a class without changes to the class.
  • A common use of friend functions is to allow the use of << and >> with cout and cin for output and input of user defined types.

Question 476

Write in Short

Short Answer▾

What will be answer of following expression?

Explanation

We already know that,

Substituting a = 40 and b = 31 in the given expression,

Developed by: