• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 3 out of 27 pages
Exam (elaborations)

Asu Cse 240 Midterm Complete Question Set With Verified Solutions Graded A+

Document preview thumbnail
Preview 3 out of 27 pages

Asu Cse 240 Midterm Complete Question Set With Verified Solutions Graded A+

Content preview

ASU CSE 240 MIDTERM
COMPLETE QUESTION SET WITH VERIFIED
SOLUTIONS GRADED A+

Question 1.
When inserting a data into a binary search tree, the data should be inserted

ANSWER
at the position to keep the entire tree as a binary search tree.



Question 2.
Given this snippet of code, identify what is the stopping condition and return value?
void deleteList(struct contact* node) {
if (node == NULL) return;
else {
deleteList(node->next);
free(node);
}
}

ANSWER
deleteList(node->next);



Question 3.
In the following query language statement, which function acts as the filter function?
var myQuery = from b in Books where b.price < 80 orderby b.title select b;

ANSWER
C.
where



Question 4.
The reason that we need to call fflush() or cin.ignore() is because the previous

ANSWER
input leaves a character in the file buffer.






,Question 5.
What is the best of deleting all the nodes in a binary tree pointed to by the root pointer?

ANSWER
Traverse the tree and delete each node individually.



Question 6.
Given the information below, which of the following snippet of codes will insert a new node in the
second place in the linked-list. Assume the linked-list contains already at least one node.
struct Terminal {
char name[30];
char location[32];
struct Terminal* next;
} *head, *p, *q;

ANSWER
p = (struct contact *) malloc(sizeof(struct contact));
...
p->next = head->next;
head->next = p;



Question 7.
Given the Scheme code below, answer the following questions related the Fantastic Four abstract
approach.
(define dtob(lambda(N) ; line 1
(if (= 0)(list0) ; line 2
(append (dtob (quotient N 2)) ; line 3
(list (remainder N 2)))))) ; line 4
(1) What line of code defines the stopping condition and the return value? Choose [Size1]
(2) What line of code contains the size-M problem, where M < N? Choose [SizeM]
(3) What lines of code define the step that construct the solution to size-N problem? Choose [SizeM_N

ANSWER
(1) What line of code defines the stopping condition and the return value? Choose Correct Line
2
(2) What line of code contains the size-M problem, where M < N? Choose Correct Line 3
(3) What lines of code define the step that construct the solution to size-N problem? Choose
Correct Lines 3 & 4






, Question 8.
What is the return value of the code below?
(define lst '(3 5 2 9))
(min (min (car lst) (cadr lst)) (min (caddr lst) (cadddr lst)))

ANSWER
2



Question 9.
Given the Scheme code as follows. What is the output?
(define not-gate (lambda(x) (if (= x 0) 1 0)))
(define onescomplement (lambda (a-list) (map not-gate a-list))) (onescomplement '(0 1 0 2 0 3))

ANSWER
CorrectA.
(1 0 1 0 1 0)



Question 10.
If a function calls another function, the local variables in these two functions use the memory from

ANSWER
different stack frames.



Question 11.
We use "Pass by Constant Reference" when:

ANSWER
Function does not want to modify the value, the value is expensive to copy and NULL is not
valid



Question 12.
A fact starts with a relationship followed by a list of arguments. The arguments of a fact

ANSWER
can have a structure similar to that of a fact.

Document information

Uploaded on
October 16, 2026
Number of pages
27
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$17.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
TopGradeInsider
4.1
(14)
Sold
194
Followers
1
Items
63129
Last sold
22 hours ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions