Stacks & Queues

Stacks & Queues

11th Grade

20 Qs

quiz-placeholder

Similar activities

Understanding Stacks and Queues

Understanding Stacks and Queues

11th Grade

15 Qs

INFORMATIKA  10 SMT 1 PAS HAL 060

INFORMATIKA 10 SMT 1 PAS HAL 060

9th - 12th Grade

15 Qs

7. Data Structures

7. Data Structures

11th Grade

15 Qs

KIỂM TRA 15 PHÚT STACK VÀ QUEUE

KIỂM TRA 15 PHÚT STACK VÀ QUEUE

11th Grade

16 Qs

Data Structures & Algorithm

Data Structures & Algorithm

11th Grade

20 Qs

Berpikir Komputasional Informatika X

Berpikir Komputasional Informatika X

9th - 12th Grade

15 Qs

soal berpikir komputasional kelas 8 gasal

soal berpikir komputasional kelas 8 gasal

8th Grade - University

20 Qs

Ulangan Bab 2 Berpikir Komputasional

Ulangan Bab 2 Berpikir Komputasional

10th - 12th Grade

20 Qs

Stacks & Queues

Stacks & Queues

Assessment

Quiz

Computers

11th Grade

Hard

Created by

Matt Hunt

Used 34+ 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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?