Exam 2: Study (Vocab) Flashcards
Which is a situation that can apply to the stack data structure?
The “undo” button in a word processing software like Microsoft Word.
In a stack, the operation that inserts an element in the stack is called as __.
Push
In a stack, ___ is the term that describes a situation when a user attempts to remove element from the empty stack.
Underflow of Stack
How can you check if a stack is empty?
Check if the stack size is greater than 0
Which data structure can be used to implement a stack in C++?
Array and linked list
What is the term used by most book to describe the basic operation to remove an element from a stack?
Pop
What happens when you try to pop an element from an empty Stack?
It causes an underflow
Which is not a real-world example of “stack”?
Order of customer service
Which is not an application of queue data structure?
sharing resource among multiple consumers simultaneously
In terms of computer science, placing an item in a queue is known as ___.
enqueue
Which is incorrect about linked list implementation of queue?
In pop operation, the node in the end is the first to be removed
Which Queue operation retrieves the front element of a queue without removing it?
Peek
Which of the following option is not correct?
Queue data structure can be used to implement Quick short algorithm but not least recently used (LRU) page fault algorithm.
What is the front of a queue?
The first element in the queue
What does the pop() member function do in a queue?
Removes the front element
Which of the following is an example of an iterative algorithm?
1) Finding the factorial of a number.
2) Moving a game character from left to right corner of the screen
3) Calculating the greatest common divisor (GCD).
4) Sorting an array using bubble sort.
What is the primary purpose of an iteration algorithm?
To repeatedly execute a block of code
Which is not one of the basic components of a repetition structure?
a delegate
Which is not qualified for being an expression that defined the terminal value?
-5 < x < 0
When a piece of code runs unintentionally forever, it is known as __
An infinite loops
A recursion function is one that __.
call itself
How can you prevent infinite recursion?
By ensuring that the recursive calls approach the base case.
Which of the following is NOT a common characteristic of a recursive function?
Using a complex iterative loop.
What is the fundamental concept behind recursion?
A function calling itself repeatedly until a base case is reached.