Languages-C & C Plus Plus [TCS Placement]: Sample Questions 63 - 65 of 119

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 63

C & C Plus Plus
Edit

Write in Short

Short Answer▾

How do you find out if a linked-list has an end (i.e.. the list is not a cycle)

Explanation

  • You can find out by using 2 pointers.
  • One of them goes 2 nodes each time.
  • The second one goes at 1 node every time.
  • If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower.

Question 64

C & C Plus Plus

Question

MCQ▾

Which of the following is the correct class of the object cout?

Choices

Choice (4)

a.

Ostream

b.

Iostream

c.

Ifstream

d.

Istream

Answer

a.

Explanation

  • Ostream is the correct class of the object cout.
  • This c ++ class is used for outputting information to an arbitrary device (screen, hard drive, diskette. .) from a program.
  • C ++ always has an instantiated object of class ostream called “cout”
Given the Image is Define the Ostream Class

Question 65

C & C Plus Plus

Question

MCQ▾

Which of the following is correct about function overloading?

Choices

Choice (4)

a.

The types of arguments are different.

b.

The order of argument is different.

c.

The number of argument is same

d.

Both a. and b. are correct

Answer

d.

Explanation

  • Overloaded functions have same name but accessed function depends on the number and type of arguments so, answer is option A & B.
  • C ++ allows specification of more than one function of the same name in the same scope. These are called overloaded functions.
  • Overloaded functions enable different functional executions at run-time, depending on the types and number of arguments.
Given the Image is Define the Function Overloading

Developed by: