ASU CSE 240 MIDTERM
TESTED QUESTIONS AND COMPLETE SOLUTIONS
Question 1.
If you want to change the insertion sort function with a size-(n-
1) problem, as discussed in the lecture, to a merge sort function, where do you need to make changes?
ANSWER
CorrectC.
In the definition of size-m problem
CorrectD.
In the code code that constructs the solution of size-n problem from the size-m problem.
Question 2.
A throw statement is associated with a specific exception handler through the
ANSWER
the data type implied by the throw value.
Question 3.
The complexity of searching an arbitrary binary search tree is the order of
ANSWER
O(n)
Question 4.
If a function calls another function, the local variables in these two functions use the memory from
ANSWER
different stack frames.
, Question 5.
The Scheme form (char? #\5) will return
ANSWER
true (#t)
Question 6.
One of the major differences between the imperative and functional programming languages is that
the functional programming languages do NOT
ANSWER
have side-effect.
Question 7.
Assume that Publication is the root class of an inheritance tree. You want to form a linked list of
different publications in the inheritance tree, including Book, Report, Newspaper, etc. What is the best
way to create a linked list using PublListNode and Publication classes?
ANSWER
The PublListNode class contains the Publication class.
Question 8.
If you want to create a linked list of Container nodes, which can contain Publication node, Book node,
Thesis node, and Report node, what type of pointer should be declared in the Container to point to all
these nodes?
ANSWER
A pointer to Publication node
TESTED QUESTIONS AND COMPLETE SOLUTIONS
Question 1.
If you want to change the insertion sort function with a size-(n-
1) problem, as discussed in the lecture, to a merge sort function, where do you need to make changes?
ANSWER
CorrectC.
In the definition of size-m problem
CorrectD.
In the code code that constructs the solution of size-n problem from the size-m problem.
Question 2.
A throw statement is associated with a specific exception handler through the
ANSWER
the data type implied by the throw value.
Question 3.
The complexity of searching an arbitrary binary search tree is the order of
ANSWER
O(n)
Question 4.
If a function calls another function, the local variables in these two functions use the memory from
ANSWER
different stack frames.
, Question 5.
The Scheme form (char? #\5) will return
ANSWER
true (#t)
Question 6.
One of the major differences between the imperative and functional programming languages is that
the functional programming languages do NOT
ANSWER
have side-effect.
Question 7.
Assume that Publication is the root class of an inheritance tree. You want to form a linked list of
different publications in the inheritance tree, including Book, Report, Newspaper, etc. What is the best
way to create a linked list using PublListNode and Publication classes?
ANSWER
The PublListNode class contains the Publication class.
Question 8.
If you want to create a linked list of Container nodes, which can contain Publication node, Book node,
Thesis node, and Report node, what type of pointer should be declared in the Container to point to all
these nodes?
ANSWER
A pointer to Publication node