
Stacks & Queues

Quiz
•
Computers
•
11th Grade
•
Hard
Matt Hunt
Used 33+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What method is used to return the top of the stack?
remove (element)
pop()
pop (position)
peek()
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A stack is implemented in Python using the built-in list data structure. What Python method is used to implement push() function?
insert()
append()
add()
delete()
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A stack is implemented in Python using the built-in list data structure. Complete this code of function size() within the Stack class.
class Stack:
def __init__(self):
self.items = [ ]
def size(self):
…………………
return len(self.items)
stack.length
return len(stack)
return length(self.items)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A stack is implemented in Python using the built-in list data structure. Complete this code of function peek() within the Stack class.
class Stack:
def __init__(self):
self.items = [ ]
def peek(self):
…………………
return self.items[len(self.items)]
return self.items[stack.length]
return self.items[stack.length-1]
return self.items[len(self.items)-1]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following operations are performed on a Stack.
s=Stack()
s.push(‘a’)
s.push(‘b’)
s.pop()
s.push(‘c’)
s.peek()
What is the top of the Stack s when these operations are complete?
'a'
'b'
'c'
Stack is empty
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following operations are performed on a Stack.
s=Stack()
s.push(‘a’)
s.push(‘b’)
s.push(‘c’)
while not s.isEmpty():
s.pop()
s.pop()
What is the top of the Stack s when these operations are complete?
'a'
'b'
Empty stack
Error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
stack colours=(‘Red’, ‘Green’, ‘Blue’)
What is the value of top of the stack colours?
-1
'Red'
'Green'
'Blue'
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Computational Thinking Quiz

Quiz
•
9th - 12th Grade
15 questions
UTS INFORMATIKA PILIHAN GANDA SEMESTER 1

Quiz
•
9th - 12th Grade
15 questions
Year 12 Programming

Quiz
•
11th - 12th Grade
20 questions
Latihan PSAS Kelas 9

Quiz
•
9th Grade - University
15 questions
REMEDI UH INFORMATIKA BAB 2 "BERPIKIR KOMPUTASIONAL"

Quiz
•
10th Grade - University
15 questions
Data Structures and Algorithms Quiz No.1

Quiz
•
1st Grade - Professio...
16 questions
The Internet

Quiz
•
6th Grade - University
20 questions
Sains Komputer Tingkatan 5 - 3.1.2 Atur Cara dan Carta Alir

Quiz
•
10th - 12th Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade