3i Infotech Placement: Sample Questions 369 - 370 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 369

Edit

Describe in Detail

Essay▾

Can we specify variable field width in a scanf () format string? If possible how?

Explanation

  • It is possible to specify variable field width in a scanf () format string by using % s control string.
  • The % s reads string of variable field width up to the first white space character.

Example:

scanf ( “% s” , name) ; // where name is a character array

  • The scanf () stores results in variables provided in argument list.
  • Note that scanf reads the data from the console or from a FILE stream and parses it.

Question 370

Edit

Describe in Detail

Essay▾

What is an adaptor class or wrapper class?

Explanation

  • Adaptor class is a class that has no functionality of its own.
  • Its member functions hide the use of a third party software component or an object with the non-compatible interface or a non- object- oriented implementation.

A wrapper class is a fairly broad concept.

  • It basically means to repackage a piece of code into a new interface (or coating) .
  • Two main reasons for doing a wrapper class are:
    • adapting an interface
    • decoupling the implementation the interface (i.e.. . , most often called a “compilation firewall” ) .
Define the Adapter Class Pattern

Developed by: