Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question1: You are using a language that does not support recursion. What data s

ID: 3634261 • Letter: Q

Question


Question1:
You are using a language that does not support recursion. What data structure would you use to traverse a binary search tree in order?

1. Set Next(newNode) to location
2. Set Back(location) to newNode
3. Set Next(Back(location)) to newNode 4. Set Back(newNode) to Back(location)


a) queue
b) list
c) stack
d) can't traverse a tree in order without recursion

Question 2
int z(int k, int n)
{
if (n == k)
return k
else
{
if (n > k)
return z(k, n-k);
else return z(k-n, n);
}
}
Based on the function defined above, what is the value of z(6,8)?

a) 1
b) 2
c) 3
d) 4

Q3:

A recursive version of an insert operation that takes the external pointer of a list as a parameter works only if
Question 3 options:
a) the list is passed by value
b) the list is passed by reference
c) it doesn't matter how the list

Q4:
The three-question testing method is based on what computing technique?
Question 4 options:
a) top-down design
b) object-oriented design
c) induction
d) divide/conquer
Q5:
When writing a recursive algorithm, what is the first step?
Question 5 options:
a) determining the size
b) getting an exact problem definition
c) choosing the base case
d) choosing the recursive case

Q6:
When you have an exact definition of a recursive problem, what is the next step?
Question 6 options:
a) determining the size
b) getting an exact problem definition
c) choosing the base case
d) choosing the recursive case

Q7:
It is good to use recursion when
Question 7 options:
a) The depth of recursive calls is relatively shallow.
b) The recursive version does about the same amount of work as the nonrecursive.
c) The recursive version is shorter and simpler than the nonrecursive solution.
d) Recursion is never a good idea.
e) a, b, and c are true.
Q8:
What is stored on an activation record?
Question 8 options:
a) parameters
b) local variables
c) register values
d) return address
e) a, b, c, and d are all stored on the activation record.
Q9:
The data structure that keeps track of activation records during the execution of a program.
Question 9 options:
a) run-time queue
b) run-time stack
c) linked list
d) heap
Q10:
What happens in the QuickSort algorithm if the items are already sorted?
Question 10 options:
a) a compile error
b) a run-time error
c) QuickSort executes in log time
d) QuickSort executes in linear time

Explanation / Answer

1)      Z(k,n) Z(6,8) n>k -> 8-6,6 = 2,6; 2,4;2,2; So Z(6,8) = 2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote