HackerRank Stack Quiz-3

Question 1

Time: 00:00:00
 Given below is a pseudo code that uses a stack. What will be the output for the given  input - PrepInsta :- declare a stack of characters;

If ( there are characters in the word to read) 

{    

         read a character;    

         push the character on the stack; 



If (the stack not empty) 

{    

          pop a character off the stack;    

         write the character to the screen;

}

PrepInsta

PrepInsta

atsnIperP

atsnIperP

PrepInstaatsnIperP

PrepInstaatsnIperP

atsnIperPatsnIperP

atsnIperPatsnIperP

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Which data structure can we use  for implementing a recursive algorithm

Queue

Queue

Stack

Stack

Hash function

Hash function

Tree

Tree

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
 What is the worst case time complexity for push operation on a stack

O(1)

O(1)

O(log n)

O(log n)

O(n)

O(n)

none of the above

none of the above

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
 Let's do some operation on the stack of size 6.

Push(1);

Pop();

Push(2);

Push(3);

Pop();

Push(4);

Pop();

Push(5);

Push(6);

Pop();

Pop();

after the completion of all operation, the number of elements present in stack are

 

8

8

6

6

2

2

1

1

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Which data structure is used to solve the Tower of Hanoi ?

Queue

Queue

Tree

Tree

Binary Search

Binary Search

Stack

Stack

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
How will the stack search look if they move the word "PREPINSTA" ?

P     R     E     P     I     N     S     T     A

P     R     E     P     I     N     S     T     A

A     T     S     N     I     P     E     R     P

A     T     S     N     I     P     E     R     P

 A     T     S     N     I     P     E     R     P     I     N     S     T     A

 A     T     S     N     I     P     E     R     P     I     N     S     T     A

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%