1 ICS313: Fundamentals of Programming Languages
Second Semester 2012/2013 Final Exam-Form(A)
Exam Date: 18/May/2013 Exam Duration: 120 minutes
Student Name: _________________________________ Student ID:_____________
Find your section from the table below:
Instructor Name Day/Time Section Check
Dr. Salah O. Hagahmoodi MWS / 11:00-11:50 AM 102
Asfa Praveen MWS / 9:00-9:50 AM 101
Asfa Praveen TU / 11:00-12:20 AM 103
Asfa Praveen TU / 9:30-10:50 AM 104
Instructions:
1. Including this cover page, this exam booklet contains 11 pages. Check if you have missing pages.
2. Any form of cheating on the examination will result in a zero grade.
3. Please write your solutions in the spaces provided on the exam. You may use the blank areas and backs of the exam pages for scratch work.
The following is forbidden during the exam: :
Mobile use.
Questions after the first quarter of the exam time.
Leaving the exam room for any reason.
Borrowing tools from other students
Max Score Student Score
Question 1 10
Question 2 10
Question 3 10
Question 4 15
Total 45
Good Luck! Kingdom of Saudi Arabia
Ministry of Higher Education University of Hail
College of Computer Science and Engineering Department of Computer Science and Software
2
Question#1 [1*10=10 Marks]
For the following questions, put check (√) for the one correct answer.
1. The design and evaluation of which language is highly suitable for Scientific Application domain?
Fortran COBOL
LISP None
2. Describe the meaning of a program by executing its statements on a machine is called?
Operational Semantics Denotational Semantics
Axiomatic Semantics None
3. Precedence and associativity rules can be overriden with ---?
Unary operators Parentheses
Arithmetic operators None
4. --- transfers execution control to a specified place in the program?
Iterative Statements Selection Statements Unconditional Branching None
5. --- skips the remainder of the current iteration, but does not exit the loop?
goto break
continue last
6. If the --- expression is absent in “for” loop, it is an infinite loop?
First Second
Third None
7. The binding of actual parameters to formal parameters is by---?
Name Position
3
8. Which is also called pass-by-copy?
Pass-by-value Pass-by-result
Pass-by-Reference Pass-by-Value-Result
9. In most language parameter communication takes place thru the---?
Static stack Run-time stack
Run-time Heap None
10.--- provide a way to grant access to private members of a class?
Private Public
Protected Friends
11.--- are implicitly called when the object’s lifetime ends?
Constructors Destructors
Both None
12.Parameterized ADTs allow designing an ADT that can store any type elements is called---?
Generic classes Abstract class
Both None
13.--- Methodcannot be overridden?
Abstract Virtual
Final Friends
14.In Java, a --- method is implicitly called when the garbage collector is about to reclaim the storage occupied by the object?
Finalize Abstract
Friends None
15.An abstract class is one that includes at least one --- method?
Constructors Destructors
4
Question#2 [1*10=10 Marks]
Write “T” for True and “F” for False statements.
1 Data and programs stored in Control Unit.
2 The original purpose of Axiomatic Semantics is formal program verification.
3 An expression in which the result is determined without evaluating all of the operands and/or operators is known as Short Circuit Evaluation.
4 Ada has a posttest version, but no pretest.
5 Java has no goto.
6 If the “then” reserved word is not used, the control expression is placed in parentheses.
7 In Java, all parameters are passed by reference.
8 In C++, default parameters must appear first in the list of formal parameters.
9 In overloaded subprogram, every version of an overloaded subprogram has the same protocol.
10 All of the class instances of a class share a single copy of the member functions.
11 Each instance of a class has its own copy of the class data members.
12 In Java, all objects are allocated from the heap and accessed through reference variables.
13 Polymorphism may require static type checking of parameters and the return value.
14 In Java, multiple inheritance supported only.
5 Question#3 (Attempt any five questions) [2*5=10 Marks]
Q1. The entire collection of methods of an object is called its
--- or ---.
Answer:
a) --- b) ---
Q2. Messages have two parts: (a) --- and (b) ---.
Answer:
a) --- b) ---
Q3. An interface can include only --- and ---.
Answer:
a) --- b) ---
Q4. In Java, Static binding is used if the method is --- or ---.
Answer:
a) --- b) ---
Q5. Perl and Ruby have two pretest logical loops, --- and ---.
Answer:
6
Q6. In Java 5.0, most common generic types are the collection types,
such as --- and ---.
Answer:
a) --- b) ---
Q7. A DLL is a collection of --- and ---
that are individually linked to an executing program.
Answer:
a) --- b) ---
Q8. The parameter profile (aka signature) of a subprogram is the
---, ---, and --- of its parameters.
Answer:
a) b) c)
---Q9. Java and Perl have unconditional labeled exits (---in Java,
--- in Perl).
Answer:
7
Q10.A counting iterative statement has a loop variable, and a means of specifying the ---and ---, and ---values.
Answer:
a) --- b) --- c) ---
Q11. How C++ provides information hiding?
Answer:
Information Hiding
a) --- b) --- c) ---
Q12. Mention Compilation process phases?
Answer:
a)
b)
c)
d)
---Q13. What a selection statement do?
Answer:
---8
Q14. Mention the two possible solutions to the functional side effect problem?
Answer:
a) ---
b) ---
Q15. What is the different between a coroutine and a subprogram?
Answer:
---9 Question#4 (Attempt any three questions) [3*5=15 Marks]
Q1. Draw the diagram of von Neumann Architecture.
Answer:
Q2. Write the two types of Logically-Controlled Loops in C and C++
with one example.
Answer:
1. --- 2. ---
10
Q3. Draw the models of Parameter Passing?
Answer:
Q4. What is Multiple Inheritance? Write advantage and disadvantage
of it.
Answer:
Multiple inheritance ---.
• Disadvantages of multiple inheritance:
1.
---
2.
---
• Advantage:
1.
11
Q5. Write any two features of Pass-by-Result (Out Mode)?
Answer:
1.
---
2.
---
Q6. Write two general categories of selection statements with one example.
Answer:
1. ---
Example:
---
---2. ---
Example:
---