Loops/Queue/Stack(s) Flashcards

1
Q

What is a loop

A

a basic control flow structure that allows the repeated execution of a block of code as long as a specified condition is met.

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

What is a Queue

A

a fundamental data structure that allows for the storage and retrieval of data in a specific order.

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

what is a stack

A

linear data structure that stores items in a Last-In, first-Out or First-In, Last-Out manner. a new element is added at one end and an element is removed from that end only.

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

Is this a loop, Queue, or stack?
queue = [“Amar”, “Akbar”, “Anthony”]

A

queue

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

Is this a loop, Queue, or stack?
For i in range(10)
if i == 7:
break:
print(i)

A

loop

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

Is this a loop, Queue, or stack?
myStack = []

> > > myStack.append(‘a’)
myStack.append(‘b’)

> > > myStack
[‘a’, ‘b’]

> > > myStack.pop()
‘c’
myStack.pop()
‘b’

A

stack

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