-
What is the purpose of a left child node and a right child node?
Skill/Topic: TreeA) The left child node has a key that is less than the key of its parent node. The right child node has a key that is greater than the key of its parent node
-
A doubly linked list is a linked list consisting of nodes that have both the previous and next elements.
Skill/Topic: Linked ListA) TrueB) False
-
How do you assign an address to an element of a pointer array ?
Skill/Topic: ArrayA) by using the address operator, which is the ampersand (&), in an assignment statementB) by using the address operator, which is the asterisks (*), in an assignment statementC) by using the address operator, which is the Double-asterisks (**), in an assignment statementD) None of the above Explanation: You assign a memory address to an element of a pointer array by using the address...
-
A Pointer is a Variable.
Skill/Topic: Variables and PointersA) FalseB) TrueExplanation: A pointer is a variable and can be used as an element of a structure and as an attribute of a class in some programming languages such as C++, but not Java. However, the contents of a pointer is a memory address of another location of memory, which is usually the memory address of another variable, element of a structure, or attribute of...
-
The pop() member function determines if the stack is empty by calling the _____ member function.
Skill/Topic: Stacks using Linked ListA) removeback()B) isEmpty()C) removedfront()Explanation: The pop() member function must determine if the stack is empty, or it will attempt to remove a node that isn’t on the stack. The pop() member function determines if the stack is empty by calling the isEmpty() member function, which you must define as part of the StackLinkedList class.
-
A leaf node does not have any child nodes.
Skill/Topic: TreeA) TrueB) FalseExplanation: A leaf node is the last node on a branch and does not have any child nodes
-
StackLinkedList class inherits the LinkedList class.
Skill/Topic: Stacks using Linked ListA) TrueB) False
-
Definitions of member functions for the LinkedList class are contained in?
Skill/Topic: Linked ListA) LinkedList.h fileB) LinkedList.cpp fileC) LinkedList.txt fileD) LinkedListDemo.cpp file Explanation: Definitions of member functions for the LinkedList class are contained in the LinkedList.cpp file
-
data; temp = temp->Next; }}?">
Identify the error in the following example of the use of a displayNodesReverse() member function void displayNodesReverse(){ cout
Skill/Topic: Linked ListA) Syntax of displayNodesReverse() is wrongB) Node*temp should be NULLC) Wrong use of paranthesisD) temp should be equal to temp->previous Explanation: The displayNodesReverse() member function displays the contents of a linked list in reverse order,beginning with the node at the back of the linked list and continuing until the first node is displayed.So Previous should be...
-
The LinkedList constructor is a member function that is called when an instance of the LinkedList is removed.
Skill/Topic: Linked ListA) TrueB) FalseExplanation: The LinkedList constructor is a member function that is called when an instance of the LinkedList is declared
-
The LinkedList class specification is defined in the source file.
Skill/Topic: Linked ListA) TrueB) FalseExplanation: The LinkedList class specification is defined in the header file, and the implementation is defined in the source file.
-
What member function places a new node at the end of the linked list?
Skill/Topic: Linked ListA) appendNode()B) addNode()C) displayNode()D) structNode()Explanation: The appendNode() member function places a new node at the end of the linked list. The appendNode() requires an integer representing the current data of the node.
-
A node can reference more than one data element.
Skill/Topic: Linked ListA) TrueB) FalseExplanation: Yes, a node can reference more than one data element if the current data element of the node is a pointer to a group of data such as an instance of a class, a structure, or an array.
-
A Node has ___ elements.
Skill/Topic: Linked ListA) NoneB) OneC) TwoD) ThreeExplanation: A node has three elements. These are the current data and pointers to the previous node and the next node on the linked list
-
Why is the isEmpty() member method called?
Skill/Topic: QueueA) The isEmpty() member method is called within the dequeue process to determine if there is an item in the queue to be removed.
-
The _______ process places data at the back of the queue.
Skill/Topic: QueueA) enqueueB) dequeueC) priority queue
-
Items on a priority queue can jump to the front of the line if they have priority.
Skill/Topic: QueueA) TrueB) FalseExplanation: A priority queue is similar to a simple queue in that items are organized in a line and processed sequentially. However, items on a priority queue can jump to the front of the line if they have priority. Priority is a value that is associated with each item placed in the queue.
-
Priority queue organizes items in a line where the first item is at the beginning of the line and the last item is at the back of the line.
Skill/Topic: QueueA) TrueB) FalseExplanation: A simple queue organizes items in a line where the first item is at the beginning of the line and the last item is at the back of the line. Each item is processed in the order in which it appears in the queue. The first item in line is processed first, followed by the second item and then the third until the last item on the line is processed.
-
Data in a queue is accessible.
Skill/Topic: QueueA) First in First outB) First in last outC) Last in First outExplanation: Data in a queue is accessible in a First in First out (FIFO) Concept
-
Constructor is a member method of a class that is called when an instance of the class is declared.
Skill/Topic: Stacks using an ArrayA) TrueB) FalseExplanation: A constructor is a member method of a class that is called when an instance of the class is declared. A destructor is a member method of a class that is called when the instance of the class falls out of scope.
Data Structures Interview Questions
Ans