Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please heal me with these 9 Python Multiple Choices questions. Thank you so much. Question 1 1 pts Select all of the true statements from

Please heal me with these 9 Python Multiple Choices questions. Thank you so much.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Question 1 1 pts Select all of the true statements from the list below. Every programming language provides the same built-in data structures. A data structure can only implement a single abstract data type. A data structure exists as concrete code, while an ADT is a conceptual definition of a type of data and its operations. An abstract data type defines a kind of data to be stored and the allowed operations on that data. Question 2 1 pts Match each abstract data type on the left-hand side with the operation that it supports. Set/Multiset Choose Removes a specified value Iterates through all values one at a time Accesses a value by its index Accesses a value by its corresponding key List Map [Choose Iterable [Choose] Question 3 1 pts Which of the following are operations that we defined for the Stack ADT? extend push is_empty iterate length enqueue Opop Question 4 1 pts Which of the following are operations we defined for the Queue ADT? enqueue append is_empty dequeue Opop size Question 5 1 pts Suppose we have correctly implemented our Stack class. What will be the output of the following? S = Stack s.push('Paul') s.push('Karen') s.push('Michelle') print(s.pop) s.push('Tom') print(s.pop ) print(s.pop) print(s.pop) Michelle Paul Karen Tom Michelle Tom Karen Paul Paul Karen Michelle Tom Michelle Tom Michelle Karen Paul Question 6 1 pts Suppose we have correctly implemented our Queue class. What will be the output of the following? q = Queue q.enqueue('Paul') q.enqueue('Karen') 9. enqueue('Michelle') print(q.dequeue) q.enqueue('Tom') print(q.dequeue) print(q.dequeue) print(q.dequeue) Paul Karen Michelle Tom Paul Karen Tom Michelle Michelle Tom Karen Paul Tom Michelle Karen Paul Question 7 1 pts Suppose we have imported the stack class with the implementation we gave in the readings, and we are executing some code. The state of memory is as depicted in this memory model diagram: id 10 Stack -main.. _items id 20 s lid 10 id 20 I list id34 lid 32 is id 31 id31 lid 33 int INT Which one of the following fragments of code could have lead to this state of affairs? S = Stack s.push(5) s.pop s.push(6) s.push(3) s.push(1) S = Stack S.push(1) s.push(3) S.push(5) S[-1] = 6 S = Stack s.push(1) s.push(3) s.push(5) s.pop s.push(6) S = Stack S.push(1) s.push(3) s.push(6) S = Stack s._items = [1, 3, 5] S[-1] = 6 Question 8 1 pts Suppose we have two stacks: the first stack si has some values in it, while the second stack s2 is empty. Suppose we run the following code: while not si.is_emptyO: s2.push(s1.pop) After running this code, si is empty. What do we know about the contents of sz? This code would not finish successfully; an error would be raised while running the code. Os2 has the same values stored in the same order as 51 originally had them. Os2 has the same values stored in the reverse order as 51 originally had them. Os2 contains only None values, because Stack.pop doesn't actually return anything. s2 is empty. Impossible to tell from the information provided. Question 9 1 pts Suppose we have two queues: the first queue 91 has some values in it, while the second queue q2 is empty. Suppose we run the following code: while not 41.is_emptyO: 92. enqueue(q1. dequeue) After running this code, 91 is empty. What do we know about the contents of 92 ? This code would not finish successfully; an error would be raised while running the code. O q2 has the same values stored in the same order as q1 originally had them O q2 has the same values stored in the reverse order as q1 originally had them. 92 contains only None values, because Queue.dequeue doesn't actually return anything. O q2 is empty. Impossible to tell from the information provided

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

Did I choose this value, or did I copy it from someone else?

Answered: 1 week ago

Question

=+2. What different types of products exist in the book industry?

Answered: 1 week ago