Languages-C & C Plus Plus [TCS Placement]: Sample Questions 88 - 89 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 88

C & C Plus Plus

Question

MCQ▾

Which of the following concepts of OOPS means exposing only necessary information to client?

Choices

Choice (4)

a.

Data binding

b.

Data hiding

c.

Encapsulation

d.

Abstraction

Answer

b.

Explanation

  • Data hiding means exposing only necessary information to client
  • Data hiding hides the details of an object or function- providing data security and reducing complexity.
  • Data hiding allows the implementations to change internally without changing external interface.
  • Eg: consider our ATM. All we know is withdrawing the amount, but how it actually works and how the transaction occurs are totally hidden.
Given the Image is Define the Data Hiding
  • Data hiding is also used to hide information inside code after the code is broken down and hidden from the object.
  • Data hiding is about not leaking the implementation details to any user of the class.

Question 89

C & C Plus Plus

Question

MCQ▾

Which of the following concept of oops allows compiler to insert arguments in a function call if it is not specified?

Choices

Choice (4)

a.

Call by reference

b.

Call by value

c.

Call by pointer

d.

Default arguments

Answer

d.

Explanation

  • “Default arguments” allows compiler to insert arguments in a function call not specified by the caller.
  • Value of default argument is provided in function declaration and automatically assigned by the compiler if caller of the function does not provide a value for the argument with default value.
  • Following simple C ++ example demonstrates use of default arguments.
Given the Image is Define the Working of Default Argument in C ++

Developed by: