3i Infotech Papers: Sample Questions 1217 - 1219 of 1245

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

Question number: 1217

» Languages » C & C Plus Plus

Short Answer Question▾

Write in Short

Why are function arguments called “signatures”?

Explanation

  • The arguments distinguish functions with the same name (functional polymorphism).

  • The name alone does not necessarily identify a unique function but name and arguments (signatures) uniquely identify a function.

  • For ex: class person {public: char getsex (); void setsex (char); void setsex (int); };

  • Functions setsex () have same name but different signature.

Question number: 1218

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What do you mean by friendly in C++?

Explanation

  • A friend function of a class is defined in class scope but it has the right to access all private and protected members of another class.

  • The proper types for friend functions appear in the class definition, friends are not member function.

  • A friend can be a function, function template, or member function. If a class or class template is member, than entire class and all of its members are friends.

Below is declaration of a friend function:

class Box {

double width;

public:

double length;

friend void printWidth (Box box);

void setWidth (double wid);

};

Question number: 1219

» Basic CS » Operating System

Essay Question▾

Describe in Detail

What is a semaphore?

Explanation

Understanding of semaphore.

Understanding of Semaphore.

Understanding of semaphore.

  • A semaphore controls access by multiple processes to a common resource in a parallel programming environment.

  • Widely used to control access to files and shared memory.

  • Functionalities associated with semaphores are set, check and wait until it clears to set it again.

  • The two most common kinds of semaphores are counting semaphores and binary semaphores.

  • Counting semaphores take non-negative integer values and binary semaphore can take the value only.

  • Semaphores are commonly used for two purposes: to share a common memory space and to share access to files.