Cs508 Collection of Old Papers
Cs508 Collection of Old Papers
Cs508 Collection of Old Papers
StudentID/LoginID
Name
PVC Name/Code
Date 27-03-2006
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.
• After taking the paper you can either go home to complete your paper or use PVC
labs.
• The duration of this take home examination is three days of the examination. i.e.
for cs508 it is till 29th of March 2006
• On third day (on the last day) upload the solved examination paper on the
assignments page of your course. You are allowed to use the lab facilities of the
campuses, books and handouts and any other references material available to you.
• The examination papers submitted after the due date will be marked as zero
• Plagiarism or cheating by the students will be dealt severely by Virtual University
therefore it is strongly recommended that you do your own work.
int a = 0;
void main()
{
double w;
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:
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.
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++.
Give at least one example of each of the above for the following languages:
(i) C++
(ii) Java
(iii) Javascript
(iv) PHP
(v) C#
http://vujannat.ning.com
BEST SITE TO HELP STUDENTS
FINALTERM EXAMINATION
FALL 2006 Marks: 60
CS508 - MODERN PROGRAMMING LANGUAGES Time: 120min
(Session - 1 )
StudentID/LoginID: ______________________________
► Char
► Elements
► Indices
► Long
► 2
► 3
► 4
► 10
If you want an argument to a function to always be passed by reference, you can prepend
► Two
► Three
► Four
► Backward
► Forward
► Up
► Horizontal
What is meant by binding time? What are the five possible binding times? Explain each
briefly.
What are the enumeration and subrange types? Differentiate these two in points.
b) Differentiate between the implicit and explicit type conversion with respect to Java. (5)
b) Explain the Prolog features regarding its applications in real world. (5)
WWW.vujannat.ning.Com
Connecting VU Students
CS508
Final Term Examination – Spring 2006
Time Allowed: 150 Minutes
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)
a = 15;
x = a++ + --a;
<?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;
}
?>
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.
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)
CS508- Modern Programming Languages
Midterm Fall2005
www.vujannat.ning.com
Q.1: Discuss the significance of readability as the language evaluation criterion.
Readability:
Q.2: Convert the following code in C in to equivalent LISP code using the most appropriate
constructs:
Q.3: Identify the mistake(s) in the following Ada code segment. After correcting it, convert it into
equivalent C and LISP code:
Q.4: We studied several reasons to study programming languages. With that context in mind
discuss:
(a) Increased capacity to express programming concepts
(b) Improved background for choosing appropriate languages and
show the output.
Q.5: For the following SNOBOL program, explain the meaning of each line
Q.6: Discuss the difference between enumeration types of C and Ada. Which is better and why?
www.vujannat.ning.com
TRUE
FALSE
Convert the following C code into equivalent LISP code using the most appropriate
constructs:
switch (VAR) {
case ‘M’ :
case ‘P’ :
case ‘L’ :
case ‘C’ :
case ‘S’ :
cout << “THIS IS A MPL CS COURSE”;
break;
case ‘F’ :
case ‘O’ :
case ‘L’ :
case ‘L’ :
case ‘O’ :
case ‘W’:
cout << “FOLLOW”;
break;
default:
cout << “ANY OTHER”;
}
Compile Time
Design Time
Link Time
Run Time
case ch is
when ‘A’ | ‘E’ | ‘I’ | ‘O’ | ‘U’ =>
putline(“this is an uppercase vowel”);
when ‘J’ .. ‘N’ =>
putline(“between uppercase J and N”);
when others =>
putline(“something else”);
end case;
TRUE
FALSE
Scientific Applications
Business Applications
Special Purpose Languages
None of these