The Gateway to Computer Science Excellence
+16 votes

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 by Veteran (52.2k points)
edited by | 1.7k views

1 Answer

+25 votes
Best answer

$C$ is the answer.

  • $A[i] = B[j]$;     Indexed addressing
  • while $(^*A++)$;      Auto increment
  • temp $=^*x$;       Indirect addressing
by Veteran (431k points)
edited by
Ans C

Array implementation- indexed addressing

Pointer, passing array as parameter- indirect addressing

Constant- immediate addressing

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


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


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


Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,309 answers
105,022 users