3i Infotech Papers: Sample Questions 1030 - 1031 of 1245

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

Question number: 1030

» Basic CS » Operating System

Essay Question▾

Describe in Detail

What are register variables? What are the advantages of using register variables?


  • The variables of ‘register’ type hint the compiler to store the variable in a register of the CPU.

  • Can be used for frequently used variables.

Advantages of Register variable:

  • Optimize the speed of program execution.

  • Faster by orders of magnitude.

  • Refer for variables accessed frequently.

  • Allocates fast memory in the form of a register.

Question number: 1031

» Languages » C & C Plus Plus

Essay Question▾

Describe in Detail

What is encapsulation?


Understanding of encapsulations

Understanding of Encapsulations

Understanding of encapsulations

  • A process of wrapping of data and methods in a single unit- “object” is called encapsulation.

  • Thus, state and behaviour are now in a single container.

  • Encapsulation is done using class keyword-

    • State is represented by declaration of variables on attributes

    • Behaviour is represented by operations in terms of methods

Advantage of Encapsulation:

  • Encapsulation secures data from other methods- data is available only within the class not accessible outside the class.

  • Data inside the class can only be manipulated by functions in the class

Benefit of Encapsulation:

  • Provides abstraction between an object and its clients.

  • Protects an object from unwanted access by clients.

  • Example: A bank application forbids a client to change an account’s balance.