• recategorized by
7,174 views
17 17 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

3 Answers

17 17 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
2 2 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.

2 2 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:
Position:
Show:

Related questions

15 15 votes
7 7 answers
10.8k
10.8k views
Kathleen asked Oct 8, 2014
10,804 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(...
20 20 votes
2 answers 2 answers
7.8k
7.8k views
Kathleen asked Sep 29, 2014
7,772 views
The conditional expansion facility of macro processor is provided totest a condition during the execution of the expanded programto expand certain model statements depend...
10 10 votes
4 4 answers
3.0k
3.0k views
Kathleen asked Sep 12, 2014
3,012 views
Macro expansion is done in pass one instead of pass two in a two pass macro assembler because _________
41 41 votes
8 answers 8 answers
26.6k
26.6k views
Kathleen asked Oct 8, 2014
26,558 views
The minimum number of edges in a connected cyclic graph on $n$ vertices is:$n-1$$n$$n+1$None of the above