(a) Consider the code fragment given below: ``` a : integer procedure f1(b: integer) b:= 5 Print a ... a:= 10 f1 (a) print a ``` Differentiate among the terms call-by-value, call-by-reference and call-by-value / result. Explain the output for the above code for call-by- value, call-by-reference and call-by- value / result. $\mathbf{1 5}$
Explanation
In call-by-value, the value of a is passed to the function f1, so a remains 10. In call-by-reference, the reference of a is passed to the function f1, so a becomes 5. In call-by-value/result, the value of a is passed to the function f1, but the result is not returned, so a remains 10.
โฌ Related Topic
๐ Syllabus
View KERALA UNIVERSITY Class 6 Syllabus โ
๐ Practice Questions
Practice Previous Year Questions โ
๐ค Practice with AI
Generate Practice Question Paper โ
๐ Related Concepts
- (a) List down any four key characteristics of Light Rail Transit System (LRT).
- (a) Explain the factors involved in the selection of good alignment for a railway line. Illustrate with necessary sketch
- (a) Explain the functions of rails and various types of rails in use.
- (a) What is negative super elevation? A $1^{\circ}$ curve track diverges from a main curve of $3^{\circ}$ in the opposit
- (a) Why is widening of gauge required on sharp curves? Determine the extent of gauge widening required for a broad gauge