CS508 Final Term Examination 2006
Modern Programming Languages Question Paper
Spring - Session 4
Time Allowed: 150 Minutes
CS508 - Modern Programming Languages - Q. No. 1 M - 1
A) Write a program in java script that prompts the student for his name and age. Then displays “Hello guy”, to the student in alert box and gives him the message in message box “U shouldn’t be a student of graduation” if his / her age>40. (10)
B) What is the difference between javascript and PHP? (5)
CS508 - Modern Programming Languages - Q. No. 2 M - 3
A) Given are the statements of C# (5)
a = 15;
x = a++ + --a;
Find the value of ‘x’ by executing the given statement
(i) from left to right
(ii) from right to left
B) How we can handle Aliasing problem in JAVA? Give examples (5)
CS508 - Modern Programming Languages - Q. No. 3 M - 3
Convert the following code of PHP into C#
<?php
$a = array(0 => 5, 1 => 6, 2 => 7, 3 => 8, 4 => 9);
$b = $a[4];
switch ($b)
{
case 5:
echo “b equal to 5”;
break;
case 6:
echo “b equal to 6”;
break;
case 7:
echo “b equal to 7”;
break;
case 8:
echo “b equal to 8”;
break;
case 9:
echo “b equal to 9”;
break;
default:
echo “Doesn’t match the number”;
break;
}
?>
CS508 - Modern Programming Languages - Q. No. 4 M - 1
Write a program in Ada that prints Excellent to a gpa value>= 3.5, prints Good to a gpa value in the range of 3-3.5,
prints Satisfactory to a gpa value in the range of 2-3.
CS508 - Modern Programming Languages - Q. No. 5 M - 1
A) How do Ada and COBOL differ by syntax and semantics in referencing a record element? Give examples of each (5)
B) Define and explain “throws Clause” and the “finally Clause” with respect to exception handling in Java. (5)