100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSE240 Final Exam (Answered) 100% Correct. 2024/2025. $11.99   Add to cart

Exam (elaborations)

CSE240 Final Exam (Answered) 100% Correct. 2024/2025.

 9 views  0 purchase
  • Course
  • Institution

CSE240 Final Exam (Answered) 100% Correct. 2024/2025. Given this snippet of code, identify the stopping condition and the return value. void deleteList(struct contact* node) { if (node == NULL) return; else { deleteList(node->next); free(node); } } if (node == NULL) return; A merge-sor...

[Show more]

Preview 2 out of 6  pages

  • November 4, 2024
  • 6
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
avatar-seller
CSE240 Final Exam (Answered) 100%
Correct. 2024/2025.
Given this snippet of code, identify the stopping condition and the return value.
void deleteList(struct contact* node) {
if (node == NULL) return;
else {
deleteList(node->next);
free(node);
}
}

if (node == NULL) return;

A merge-sort is typically implemented using

a function with two recursive calls.

A tail-recursive function is structurally equivalent to

a while loop

Which recursive functions require us to define more than one size-m problem?

Hanoi tower,Mergesort function

What is the time complexity of the insertion sort algorithm?

O(n*n)

The function searching a binary search tree can be easily implemented using a

a recursive function with two recursive calls.

The search algorithm will be more efficient if a binary search tree is

a balanced binary tree.

The complexity of searching a balanced binary search tree is the order of

O(lg n)

What are the key features of object orientation in programming languages? Select all that apply.

Dynamic memory allocation, Encapsulation of state

The purpose of the scope resolution operator is to allow a function to be

placed outside the class.

Which C/C++ operations will acquire memory from heap? Select all that apply. Choices: (malloc,
new, free, declaration)

malloc, new

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

different stack frames.

How is Java's garbage collection implemented?

It uses a reference counter to indicate if an object is still referenced by any variable.

What is the key difference between a static variable and a global variable?

They come from different parts of memory.

Given the snippet of code:
int x = 5;
int bar(int j) {
int *k = 0, m = 5;
k = &m;
return (j+m);
}
void main(void) {
static int i =0;
i++;
i = bar(i) + x;
}
Which variables obtain their memory from the stack? Select all that apply. Choices(I,j,k,m,x)

j,k,m

What is the best way of deleting a linked list of objects in C++?

Use a loop to delete every object in the linked list.

We need to write a destructor for a class, if

heap memory is used in the constructor of the class.

A piece of memory must be explicitly garbage-collected, if it comes from

heap

What is the best way of deleting an array created by "p = new StructType[size];" in C++?

delete[] p;

What members of a base class can be redefined in the derived classes?

virtual members

The semantics of multiple inheritance becomes complex and error prone, if the base classes have

overlapped members.

Given the code as follows:

main()
{
int i = 3, n;

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller ACADEMICAIDSTORE. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $11.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75632 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$11.99
  • (0)
  Add to cart