Menu

[Solved]40 Stack 3 Existing Elements Push Pop Double Push Pop Double Push Many Elements Stack Conc Q37119940

40. On a stack with 3 existing elements, push, then pop, thendouble push, then pop, then double push again?

How many elements are on the stack at conclusion of theoperation?  

6,5,4,7

  • A user wants to return an element from any given position in adata set.
    • Which ADT is needed to accomplish this using get()operation?

List, stack, queue, string

  • Under which condition is a first object considered to be aduplicate of a second object?

First.equals(second) returns true andnull

First.equals(second) returns null

First.equals(second) returns true

First.equals(second) returns false

  • What is the output of the python code ?

A = { 1 ;”A”; 2;”B”, 3;”C”}

B= {4;”D”, 5;”E”}

a.update(b)

print(a)

  • What is a data structure relationship to a data type?

                  1. A data structure contains functions and data type is necessaryto implement algorithms

                  2. A data structure classifies the data and a data type organizesthe data.

                 3. A data structure is necessary to implement algorithms, and adata type contains functions

                4. A data structure organizes the data, and a data type classifiesthe data

  • What is the difference between a list and a deque?

A deck item is immutable while itemsare not

A List can easily add items and removeitems from the front, while a deque cannot

A deque can easily add items andremove items from the front while a list cannot

A list can modify its content and adeque cannot.

  • What is the logical first step in an algorithm that determinesthe number of positive values in a given pre-populated list ofitems

Initialize the results to 0

Check that the given list contains atleast one number

Initialize the results to an emptylist

Set the current number to 1

  • Given a non-empty list of numbers and two declared variables,result and current. What is the logical first step in an algorithmthat sorts and determines the minimum value in the list.

Set current to the first value of thegiven list

Initialize results to 0

Set current to 0

Initialize result to an empty list

Expert Answer


Answer to 40. On a stack with 3 existing elements, push, then pop, then double push, then pop, then double push again? How many el… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *