recategorized by
2,891 views
19 votes
19 votes
State whether the following statements are True or False with reasons for your answer

A subroutine cannot always be used to replace a macro in an assembly language program.
recategorized by

2 Answers

Best answer
3 votes
3 votes

$\textsf{TRUE}.$

A macro is evaluated at compile time whereas a function call happens at runtime. So, we can write a macro to rename any symbol which is not possible to be replaced by a simple subroutine call. For example consider the following $C$ code.

#define type int
type foo (type arg1)
{
    ...
}
#undef type

In the above code a macro is used to define a type which is used as the return and argument types for the function $\textsf{foo}.$ This is not possible to be implemented as a simple subroutine call (but can be done using $\textsf{typedef}$ is the language supports it).

selected by
22 votes
22 votes
This is true. We can not replace macro entirely using a subroutine. Ex: Macro constant used for renaming.
edited by
Answer:

Related questions

3 votes
3 votes
1 answer
1
gatecse asked May 3, 2021
2,325 views
State whether the following statements are True or False with reasons for your answer:A two pass assembler uses its machine opcode table in the first pass of assembly.
5 votes
5 votes
1 answer
2
gatecse asked May 3, 2021
1,278 views
State whether the following statements are True or False with reasons for your answerA symbol declared as ‘external’ in an assembly language program is assigned an ad...
12 votes
12 votes
2 answers
3
Kathleen asked Oct 5, 2014
2,611 views
State whether the following statements are True or False with reasons for your answer:Coroutine is just another name for a subroutine.
22 votes
22 votes
3 answers
4
Kathleen asked Oct 5, 2014
7,237 views
Let $p$ and $q$ be propositions. Using only the Truth Table, decide whether $p \Longleftrightarrow q$ does not imply $p \to \lnot q$is True or False.