Question 1

Consider the C struct defined below:

```    struct data   {
int marks [100];
int cnumber;
};
struct data student;
```

The base address of student is available in register R1. The field student.grade can be accessed efficiently using

 A Post-increment addressing mode, (R1)+ B Pre-decrement addressing mode, -(R1) C Register direct addressing mode, R1 D Index addressing mode, X(R1), where X is an offset represented in 2’s complement 16-bit representation
Question 1 Explanation:
sruct data
{
int marks[100];
int cnumber;
}; struct data student
Base Address of student is available in R1.
It is clearly mentioned X is the offset address to be summed with Base Address of R1.

Hence Index Addressing mode X(R1), where X is an offset represented in 2’s complement 16-bit representation.
⇾ Relative, Base Indexed & all subtypes of Indirect addressing modes are used with Arrays.
 Question 2
Which of the following is/are true of the auto-increment addressing mode? I.It is useful in creating self-relocating code II.If it is included in an Instruction Set Architecture, then an additional ALU is required for effective address calculation III.The amount of increment depends on the size of the data item accessed
 A I only B II only C III Only D II and III only
Question 2 Explanation:
I : Self relocating code always takes some address in memory. So auto-increment mode is not used for self relocating code. Hence this statement is wrong.
II. An additional ALU is not necessary for auto-increment. So this statement is wrong.
III. In auto-increment addressing mode the address where next data block to be stored is generated automatically depending upon the size of single data item required to store. This is based on pointer arithmetic. So this statement is true.
Hence option C is the answer.
 Question 3
 A It enables reduced instruction size B It allows indexing of array elements with same instruction C It enables easy relocation of data D It enables faster address calculations than absolute addressing
Question 3 Explanation:
 Question 4

 A (i) and (iv) B (i) and (ii) C (ii) and (iii) D (i), (ii) and (iv)
Question 4 Explanation:
A fixed address in memory which indicates a location by specifying a distance from another location. In this displacement type addressing is preferred.
So, option A is false.
This scheme is used by computers to control access to memory. In this pointers are replaced by protected objects which can be executed by kernal (or) some other privileged process authors.
So, this is suitable for program relocation at runtime.
The offset of the relative addressing is to allow reference to code both before and after the instruction.
This is also suitable.
Which leads to extra memory location which can be not suitable at run time.
This is not suitable.
 Question 5
 A the operand is inside the instruction B the address of the operand is inside the instruction C the register containing the address of the operand is specified inside the instruction D the location of the operand is implicit
Question 5 Explanation:
The operand is inside the instruction---Immediate addressing.
The operand is inside the instruction --- absolute addressing.
The register containing the address of the operand is specified inside the instruction --- Register addressing.
The location of the operand is implicit --- Implicit addressing.
 Question 6
A certain processor supports only the immediate and the direct addressing modes. Which of the following programming language features cannot be implemented on this processor?
 A Pointers B Arrays C Records D Recursive procedures with local variable E All the above
Question 6 Explanation:
A) Cannot be implemented because pointers need indirect addressing mode.
B) Cannot be implemented because arrays need Register indexing.
C) Records also needs pointers which needs indirect addressing modes, so this also cannot be implemented.
D) Recursive procedures needs stack, and so it needs stack pointers which inturn needs indirect addressing. So this also cannot be implemented.
 Question 7
Which of the following addressing modes permits relocation without any change whatsoever in the code?
Question 7 Explanation:
In PC relative addressing there is no change in the code.
 Question 8
Relative mode of addressing is most relevant to writing
 A coroutines B position – independent code C shareable code D interrupt handlers