3i Infotech Placement: Sample Questions 12 - 14 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 12

Edit

Describe in Detail

Essay▾

What is polymorphism?

Explanation

Understanding of Polymorphism in Image
  • Ability of an object to take on many forms is polymorphism.
  • Common use of polymorphism in OOP is for parent class to refer to a child class object- implements the concept of performing a single action by different ways.
  • There are two types of polymorphism in java: compile time polymorphism and runtime polymorphism.
  • Polymorphism in java can be done by method overloading or by method overriding.
  • Overloading static method in java is an example of compile time polymorphism.

Question 13

Edit

Describe in Detail

Essay▾

How are device represented in UNIX?

Explanation

  • Devices in UNIX are represented by files.
  • Each piece of hardware is a file.
  • Allows access to the hardware.
  • Device file is specified as ‘block special file’ with characteristics similar to a disk file.
  • Represents a device with characteristics similar to a keyboard.

Two types of devices are character devices and block devices.

ls-l/dev/zero

  • crw-rw-rw-1 root — — /dev character device

ls-l/dev/sdal

  • brw-rw — -1 root -/dev/sdal block device
Two Types of Devices

Question 14

Question

MCQ▾

In the following code segment what will be the result of the function value of x, value of y

  1. {
  2.     unsignedintx =-1;
  3.     inty;
  4.     y =~0;
  5.     if (x == y)
  6.     printf ( “same” );
  7.     else
  8.     printf ( “notsame” );
  9. }

Choices

Choice (4)

a.

Not same

b.

Same, MAXUNIT, MAXUNIT

c.

Same

d.

Not same, MAXINT

Answer

c.

Explanation

  • In the program
Table Showing the Program
unsigned int x =-1;
  • define the unsigned integer variable x =-1
int y;
  • define the integer variable y
y = ~0;
  • ~0 is the binary representation of -1
  1. if (x == y)
  2. printf ( “same” );
  3. else
  4. printf ( “notsame” );
  5. }
  • Check the if condition
  1. if (-1 == -1)
  2. printf ( “same” );
  3. else
  4. printf ( “notsame” );
  5. }
  • So the answer is same

Developed by: