Exam 2: Study (Vocab) Flashcards

1
Q

Which is a situation that can apply to the stack data structure?

A

The “undo” button in a word processing software like Microsoft Word.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In a stack, the operation that inserts an element in the stack is called as __.

A

Push

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In a stack, ___ is the term that describes a situation when a user attempts to remove element from the empty stack.

A

Underflow of Stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you check if a stack is empty?

A

Check if the stack size is greater than 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which data structure can be used to implement a stack in C++?

A

Array and linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the term used by most book to describe the basic operation to remove an element from a stack?

A

Pop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What happens when you try to pop an element from an empty Stack?

A

It causes an underflow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which is not a real-world example of “stack”?

A

Order of customer service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which is not an application of queue data structure?

A

sharing resource among multiple consumers simultaneously

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In terms of computer science, placing an item in a queue is known as ___.

A

enqueue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which is incorrect about linked list implementation of queue?

A

In pop operation, the node in the end is the first to be removed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which Queue operation retrieves the front element of a queue without removing it?

A

Peek

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following option is not correct?

A

Queue data structure can be used to implement Quick short algorithm but not least recently used (LRU) page fault algorithm.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the front of a queue?

A

The first element in the queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the pop() member function do in a queue?

A

Removes the front element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which of the following is an example of an iterative algorithm?

A

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.

17
Q

What is the primary purpose of an iteration algorithm?

A

To repeatedly execute a block of code

18
Q

Which is not one of the basic components of a repetition structure?

A

a delegate

19
Q

Which is not qualified for being an expression that defined the terminal value?

A

-5 < x < 0

20
Q

When a piece of code runs unintentionally forever, it is known as __

A

An infinite loops

21
Q

A recursion function is one that __.

A

call itself

22
Q

How can you prevent infinite recursion?

A

By ensuring that the recursive calls approach the base case.

23
Q

Which of the following is NOT a common characteristic of a recursive function?

A

Using a complex iterative loop.

24
Q

What is the fundamental concept behind recursion?

A

A function calling itself repeatedly until a base case is reached.

25