recategorized by
4,564 views
15 votes
15 votes

What are $x$ and $y$ in the following macro definition?

macro	Add x, y
        Load y
        Mul x
        Store y
end macro	
  1. Variables
  2. Identifiers
  3. Actual parameters
  4. Formal parameters
recategorized by

3 Answers

15 votes
15 votes

ans is D

  • formal parameter — the identifier used in a method to stand for the value that is passed into the method by a caller.
    • For example, amount is a formal parameter of calculate
  • actual parameter — the actual value that is passed into the method by a caller.
    • For example, the 800 used when calculate is called is an actual parameter.
    • actual parameters are often called arguments
float calculate (float amount)
{
 return amount * 1.2;   
}

int main()
{
  ...
  float final = calculate(800);
  ...
}
edited by
1 votes
1 votes

A parameter or argument is data which is taken as input or considered as additional information by the function for further processing. There are two types of parameters or arguments. The parameters which are passed in the function call are known as actual parameters or actual arguments. The parameters which are received by the called function are known as formal parameters or formal arguments. Example is shown below:

 

actuval-formal-params

In the above example, x and y are known as actual parameters and a and bare known as formal parameters.

0 votes
0 votes
macro Add x, y
    Load y
    Mul x
    Store y
end macro

In the given macro definition:  x and y are formal parameters of the macro.

Formal Parameters: These are placeholders or symbols used in the definition of a macro. They act as variables within the macro definition and are replaced by actual values or expressions when the macro is invoked. In the provided macro definition, x and y are formal parameters. When you use this macro, you would provide actual values for x and y as arguments, and the macro would substitute those values into the macro body.

For example, if you invoke the macro as follows:

Add a, b

It would be replaced as:

Load b
Mul a
Store b

 

Answer:

Related questions

13 votes
13 votes
6 answers
1
Kathleen asked Oct 8, 2014
6,934 views
What is the value of $X$ printed by the following program?program COMPUTE (input, output); var X:integer; procedure FIND (X:real); begin X:=sqrt(X); end; begin X:=2 FIND(...
7 votes
7 votes
3 answers
3
Kathleen asked Sep 12, 2014
1,542 views
Macro expansion is done in pass one instead of pass two in a two pass macro assembler because _________
33 votes
33 votes
5 answers
4
Kathleen asked Oct 8, 2014
21,019 views
The minimum number of edges in a connected cyclic graph on $n$ vertices is:$n-1$$n$$n+1$None of the above