Question: The stack pop operation Question 9 options: removes from the stack the number of elements specified by its integer parameter removes all items currently on
The stack pop operation
Question 9 options:
| removes from the stack the number of elements specified by its integer parameter | |
| removes all items currently on the stack | |
| extracts one element from the stack and returns it | |
| does not exist: There is no such stack operation |
Question 10 (2 points)

Consider a class that uses the following variables to implement an array-based stack: String [ ] s = new String[100]; int top = 0; The boolean method to check for an empty stack can be written as:
Question 10 options:
| if (s == null) return true; else return false; | |
| if (s.length == 0) return true; else return false; | |
| return top; | |
| if (top == 0) return true; else return false; |
Question 11 (1 point)

The operation for removing an item from a queue is called
Question 11 options:
| disqueue | |
| enqueue | |
| dequeue | |
| extract |
Question 12 (1 point)

A queue based on a linked list uses the following code class Node{ String element; Node next; Node (String el, Node n) { element = el; next = n; } } Node front = null, rear = null; What is the right code for String remove() operation? Such an operation removes and returns an element from the queue.
Question 12 options:
| if (front == null) throw new RuntimeException("Empty"); String temp = front.element; front = front.next; if (front == null) front = rear; return temp; | |
| if (rear== null) throw new RuntimeException("Empty"); String temp = rear.element; rear = rear.next; if (front == null) rear = null; return temp; | |
| if (front == null) throw new RuntimeException("Empty"); String temp = front.element; front = front.next; if (front == null) rear = null; return temp; | |
| if (front == rear) throw new RuntimeException("Empty"); String temp = front.element; front = front.next; if (front == null) rear = null; return temp; |
Question 13 (1 point)

The predecessor of a node in a binary tree is called its
Question 13 options:
| precursor | |
| progenitor | |
| ancestor | |
| parent |
Question 14 (1 point)

In a binary tree,
Question 14 options:
| there must be exactly one node with no predecessor | |
| there may be at most two nodes with no predecessor | |
| there must be at most one node with no predecessor | |
| there may be any number of nodes with no predecessor |
Question 15 (1 point)
![array-based stack: String [ ] s = new String[100]; int top =](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f96bc3e6338_08366f96bc3d8c9a.jpg)
The successor of a node in a binary tree is called its
Question 15 options:
| neighbor | |
| descendant | |
| neighbor | |
| child |
Question 16 (1 point)

An empty binary tree has height
Question 16 options:
| -1 | |
| 1 | |
| 0 | |
| None of the above: the height of an empty binary tree is not defined. |
Question 17 (2 points)

An AVL tree is
Question 17 options:
| a priority queue with a balance condition | |
| a binary search tree in which the heights of the subtrees at each node differ by at most one | |
| a binary tree in which the left and right subtree have heights that differ by at most one | |
| a binary tree in which each child is greater than its parent |
Question 18 (2 points)

A priority queue is
Question 18 options:
| a binary search tree in which the heights of the subtrees at each node differ by at most one | |
| is an AVL tree in which the root is the minimum element | |
| is a collection that allows elements to be added, but only allows the minimum element to be removed | |
| is a binary search tree that stores elements according to their natural order |
Question 19 (1 point)

A complete binary tree with N nodes has depth approximately equal to
Question 19 options:
| log N | |
| 2N | |
| N | |
| N2 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
