0
0
Compiler Designknowledge~10 mins

Parameter passing mechanisms in Compiler Design - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to identify the parameter passing mechanism where the actual parameter's value is copied to the formal parameter.

Compiler Design
In [1], changes made to the parameter inside the function do not affect the original argument.
Drag options to blanks, or click blank then click option'
Acall by reference
Bcall by name
Ccall by value
Dcall by result
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing call by value with call by reference, which allows changes to affect the original.
2fill in blank
medium

Complete the code to identify the parameter passing mechanism where the function can modify the caller's variable directly.

Compiler Design
In [1], the function receives the address of the actual parameter, allowing direct modification.
Drag options to blanks, or click blank then click option'
Acall by value
Bcall by reference
Ccall by copy-restore
Dcall by name
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up call by reference with call by value, which does not allow changes to the original variable.
3fill in blank
hard

Fix the error in the statement describing call by name parameter passing.

Compiler Design
In call by name, the actual parameter is [1] each time it is used in the function body.
Drag options to blanks, or click blank then click option'
Are-evaluated
Bpassed as a copy
Cevaluated once at the start
Dpassed by address
Attempts:
3 left
💡 Hint
Common Mistakes
Assuming call by name evaluates the parameter only once like call by value.
4fill in blank
hard

Fill both blanks to complete the description of call by copy-restore mechanism.

Compiler Design
In call by copy-restore, the actual parameter is [1] to the function and [2] back to the caller after the function finishes.
Drag options to blanks, or click blank then click option'
Acopied
Bpassed by reference
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing copy-restore with call by reference or call by value.
5fill in blank
hard

Fill all three blanks to complete the dictionary comprehension that maps parameter passing mechanisms to their key feature.

Compiler Design
features = { [1]: [2] for [3] in ['call by value', 'call by reference', 'call by name'] }
Drag options to blanks, or click blank then click option'
Amechanism
B{'call by value': 'copy', 'call by reference': 'address', 'call by name': 're-evaluation'}[mechanism]
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same variable name for keys and values incorrectly.