Languages-C & C Plus Plus [3i Infotech Placement]: Sample Questions 228 - 230 of 354

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

Question 228

C & C Plus Plus

Describe in Detail


What is accessor?


  • AN accessor is a class operation that does not modify the state of an object.
  • The accessor functions need to be declared as const operations.
  • Accessor methods allow the programmer to obtain the value of an object՚s instance variables
  • The data can be accessed but not changed
  • The name of an accessor method typically starts with the word ‘get’
Given the Accessor Method Getx () and Gety () Methods

Question 229

C & C Plus Plus

Write in Short

Short Answer▾

How would you obtain segment and offset addresses from a far address of a memory location?


  • Pointer to far objects are stored using four bytes that is 32 bits (on 32 bit machines) .
  • The bytes are stored little endian or low to high order.
  • The first word contains the 14-bit memory offset.
  • The second word contains the page number.
  • The memory address is calculated as bellow:

Variable address = (page ⚹ ) + offset

Function Address = (segment ⚹ ) + offset

Question 230

C & C Plus Plus

Describe in Detail


What is the output of the following program?

  1. main ()
  2. {
  3.     inti =10;
  4.     voidpascalf (int, int, int);
  5.     f (i ++, i ++, i ++ );
  6.     printf ( “%d” i);
  7. }
  8. voidpascalf (integer:i, integer:j, integer:k)
  9. {
  10.     write (i, j, k);
  11. }


Compiler error: unknown type integer

Compiler error: Undeclared functions write

In the program

Table Shows the Program
int i = 10;
  • Define the integer variable i = 10
void pascal f (int, int, int) ;
  • Pascal keyword doesn՚t mean that pascal code can be used.
  • It means that the function follows Pascal argument passing mechanism in calling the functions.
void pascal f (integer: i, integer: j, integer: k)


write (i, j, k) ;


  • Unknown type integer
  • Undeclared functions write

Developed by: