VU CS504- Software Engineering – I FinalTerm Solved Unsolved Past Papers FALL 2005
FINAL TERM EXAMINATION
SEMESTER FALL 2005
CS508-Modern Programming Languages
|Total Marks: 100 Duration: 3 Days|
Maximum Time Allowed: 3 Days
Please read the following instructions carefully before attempting any question:
The examination mode for the cs508 final term examination is take home examination, which mean that you are allowed to take your examination papers to your home or computer labs and complete it using all available resources. Followings are the instructions for doing the take home examination.
For Teacher’s use only
Question No: 1
| Consider the following Code written in C.
int a = 0;
int f(int x, int y)
return (a = x + 1);
int g(int *x)
return (*x = a + 2);
w = double(a) + f(a, g(&a))/g(&a);
printf (“w is %f”, w);
On some different important commercial compilers, the values found for the variable w were 5.6, 4.5, and 7.5. Furthermore, this last value changed to 2.5 when the expression to compute w was changed to:
w = f(a, g(&a))/g(&a) + double(a);
None of this is an error by the compiler writer!
(a) Give a justification for each one of these values.
(b) Would Java have the same kind of problem? Why or why not. Justify.
Question No: 2
| Compare C# and Java and highlight at least five differences. Then critically compare these features and argue why one design is better than the other.
|Question No: 3 Marks: 20|
|(a) Write a Prolog description of your family tree (based only on facts), going back to your grandparents and including all descendents (males and females). The facts should include the gender of a person and relationship of every person with every other person.(b) Write a set of rules for family relationships, including all relationships from grandparents through two generations. Now add these to the facts of part (a), and eliminate all the facts except the gender and parent-child relationship. You should still be able to establish the relationship of any person with any other person in your family.
Question No: 4
| Compare weak and strong typing. Argue why it is OK to have weak typing in scripting languages but not in other general purpose languages such as Java and C++.
Question No: 5
| Consider the following 5 binding times:
(1) language design time
(2) program writing time
(3) compile time
(4) load time
(5) run time
Give at least one example of each of the above for the following languages: