Programming Languages Assignment 2: Deadline: Sunday 14 Feb 2021
Programming Languages Assignment 2: Deadline: Sunday 14 Feb 2021
Assignment 2
Deadline: Sunday 14 Feb 2021
Note: You have to submit the assignment either in .docx or .pfd format. In case of plagiarism
you will be award zero.
Problem 1: Answer the following short questions. 15 Marks. [CLO 1]
1. Explain how the coercion rules of a language affect its error detection.?
2. How is referential transparency related to functional side effects?
3. Do you think the elimination of explicit type conversion in your favorite
language would be beneficial? Why or why not? Support your arguments.
4. What are the design issues for enumeration types?
5. What advantages do Java and C# reference type variables have over the
pointers in other language.
int fun(int*k) {
*k += 4;
return 3 * (*k) - 1;
}
Suppose fun is used in a program as follows:
void main() {
int i = 10, j = 10, sum1, sum2;
sum1 = (i / 2) + fun(&i);
sum2 = fun(&j) + (j / 2);
}