TCS Papers: Sample Questions 301 - 302 of 502

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 301

» Basic CS » Operating System

Essay Question▾

Describe in Detail

What is device drivers?

Explanation

  • Device driver is actually a communication layer between device and computer.

  • When a new device is added, the driver should be installed in order to run the program.

  • Device drivers plug into an OS to handle a particular device.

  • Operating System takes help from device drivers to handle all I/O devices.

  • Device drivers encapsulate device-dependent code and implement a standard interface in such a way that code contains device-specific register reads/writes.

  • Device driver is generally written by the device’s manufacturer and delivered along with the device on a CD-ROM.

  • How a device driver handles a request is as follows:

    • Suppose a request comes to read a block N. If the driver is idle at the time a request arrives, it starts carrying out the request immediately.

    • Otherwise, if the driver is already busy with some other request, it places the new request in the queue of pending requests.

Image of Device drivers

Image of Device Drivers

Given the image is define the logical position of device drivers

Question number: 302

» Languages » C & C Plus Plus

MCQ▾

Question

A union that has no constructor can be initialized with another union of ________ type.

Choices

Choice (4) Response

a.

Virtual

b.

Different

c.

Class

d.

Same

Answer

d.

Explanation

  • A union is an object that can hold any one of a set of named members. The members of the named set can be of any data type. Members are overlaid in storage.

  • The storage allocated for a union is the storage required for the largest member of the union, plus any padding required for the union to end at a natural boundary of its strictest member.

  • Union member is referenced the same way as referencing a member of a structure.

  • For example:

  1. union {
  2.     char birthday[9];
  3.     int age;
  4.     float weight;
  5. people;
  6. people.birthday[0] = ' ';
  • Assigns ‘ ’ to the first element in the character array birthday, a member of the union people.

  • Union data type and a union of that type can be put in the same statement by placing the variable declaration after the data type definition.