100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
DSA 1 Quiz 2 Retake Questions and Answers Graded A+ $13.49   Add to cart

Exam (elaborations)

DSA 1 Quiz 2 Retake Questions and Answers Graded A+

 7 views  0 purchase
  • Course
  • DSA
  • Institution
  • DSA

Exam of 7 pages for the course DSA at DSA (DSA 1 Quiz 2 Retake)

Preview 2 out of 7  pages

  • August 29, 2024
  • 7
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • DSA
  • DSA
avatar-seller
Dreamer252
DSA 1 Quiz 2 Retake

A class defined as abstract must also have abstract methods - answerfalse

Insertion sort is an example of an Abstract Data Type - answerfalse

The Java Collections Framework contains both interfaces and abstract classes. What is
the main difference between these two things?
I. Interfaces are one way Java uses to implement multiple inheritance.
II. Abstract classes describe what something is. Interfaces describe what something can
do.
III. A class can only inherit from one superclass but can implement many different
interfaces - answerI, II, and III

The Comparator interface requires that one method be implemented to allow total
ordering of a collection: sort() - answerFalse

Both .equals() and .compare() are methods inherited from the super class Object -
answerFalse

Suppose we have a vector whose initial capacity is 7 (and initial size 0). Also suppose
that this vector doubles in size any time we try to insert an element that no longer has
space to be inserted. If we start with a size of 0 and insert 25 elements, how many times
will the vector resize? - answer2

Which of the following statements about vectors is not true - answerUnlike insert,
removing from the front of the vector is very fast, because we don't need to shift
elements

Which of the following statements will compile without errors?
I. List<String> myList = new vector<String>();
II. List<Integer> myList2 = new ArrayList < >();
III. Vector<Double> myList3 = new List<Double>();
IV. List<Double> myList4 = New Vector<Integer>(); - answerI and II

If you remove an element from an ArrayList object, the capacity automatically
decreases - answerfalse

Assume a singly linked list implemented using a Node class with two fields data (int)
and nextNode (node). A List class holds the field head (first node in the list). The linked
list contains six nodes holding 20, 11, 13, 19, 12, 14 in that order. What is the result to
the linked list of the following instructions?

, Node newNode = new Node();
newNode.data = 99;
newNode.nextNode = head.nextNode.nextNode;
head.nextNode.nextNode = newNoe - answerThe value 99 is inserted into the linked list
after 13 and before 19???

Assume a singly linked list implemented using a Node class with two fields data (int)
and nextNode (node). A List class holds the field head (first node in the list).
What is the value of nextNode in the last node of the list? - answernull

consider the following code:
public class ListNode {
public int data;
public ListNode next;
}
public class List{
// method of list class
public void Strip(ListNode p){
// precondition: p references the first node of a nonempty list
while(p!=null){
while((p.next!=null)**(p.next.data == p.data))
p.next = p.next.next;
p = p.next
}
}
}

Suppose that L represents the following list:
..... - answerJust know its like 5 2 1 I think

Assume a singly linked list implemented using a Node class with two fields data (int)
and nextNode (node). A List class holds the field head (first node in the list). The linked
list contains six nodes holding 20, 11, 13, 19, 12, 14 in that order. What will the
statement head.nextNode.nextNode.nextNode = null; accomplish? - answerIt will result
in the list ending after 19

Assume a singly linked list implemented using a Node class with two fields data (int)
and nextNode (node). A List class holds the field head (first node in the list). The linked
list contains six nodes holding 20, 11, 13, 19, 12, 14 in that order. What will be returned
by return head.nextNode.nextNode.nextNode.data? - answer19

When a list is copied to a stack (front to back of list) then the stack is copied back to
another list (using insertAtFront()), how do the two lists' orders compare? - answerThey
are the same order because of the insertAtFront()

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 Dreamer252. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

78075 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
$13.49
  • (0)
  Add to cart