search
Log In
18 votes
2.3k views

Match each of the high level language statements given on the left hand side with the most natural addressing mode from those listed on the right hand side.$$\begin{array}{clcl} \text{(1)} &\text{$A[I] = B[J]$} & \qquad\text{(a)} &\text{Indirect addressing} \\ 
\text{(2)} &\text{while $(^*A\text{++});$} & \qquad\text{(b)} & \text{Indexed addressing} \\   
\text{(3)} & \text{int temp $= ^*x$} & \qquad\text{(c)} &\text{Auto increment}  \\ \end{array}$$

  1. $(1, c), (2, b), (3, a)$
  2. $(1, c), (2, c), (3, b)$
  3. $(1, b), (2, c), (3, a)$
  4. $(1, a), (2, b), (3, c)$
in CO and Architecture
edited by
2.3k views

1 Answer

27 votes
 
Best answer

$C$ is the answer.

  • $A[i] = B[j]$;     Indexed addressing
  • while $(^*A++)$;      Auto increment
  • temp $=^*x$;       Indirect addressing

edited by
2
Ans C

Array implementation- indexed addressing

Pointer, passing array as parameter- indirect addressing

Constant- immediate addressing

Writing relocatable code- base addressing
0
arjun sir here increment will be operate on A or *A.
2
Isn't statement 2 is also using pointers for dereferencing A??
7

Cristine

Priority of post-increment/decrement is higher than dereferencing operator in C...

1

@akash.dinkar12 okay i got confused between *A++ and x=*A++ 

Answer:

Related questions

67 votes
6 answers
1
14.1k views
Consider a three word machine instruction $ADD A[R_0], @B$ The first operand (destination) $A[R_0]$ uses indexed addressing mode with $R_0$ as the index register. The second operand (source) [email protected]$ uses indirect addressing mode. $A$ and $B$ are memory addresses ... destination (first operand). The number of memory cycles needed during the execution cycle of the instruction is: $3$ $4$ $5$ $6$
asked Sep 22, 2014 in CO and Architecture Kathleen 14.1k views
18 votes
2 answers
2
5.3k views
Consider a direct mapped cache of size $32$ $KB$ with block size $32$ $bytes$. The $CPU$ generates $32$ $bit$ addresses. The number of bits needed for cache indexing and the number of tag bits are respectively, $10, 17$ $10, 22$ $15, 17$ $5, 17$
asked Sep 22, 2014 in CO and Architecture Kathleen 5.3k views
18 votes
2 answers
3
24 votes
4 answers
4
5.6k views
Relative mode of addressing is most relevant to writing: Co – routines Position – independent code Shareable code Interrupt Handlers
asked Oct 9, 2014 in CO and Architecture Kathleen 5.6k views
...