if you want to remove an article from website contact us from top.

    which of the following real world scenarios would you associate with a stack data structure?

    Mohammed

    Guys, does anyone know the answer?

    get which of the following real world scenarios would you associate with a stack data structure? from screen.

    Which of the following real world scenarios would you associate with a stack data structure?

    Click here👆to get an answer to your question ✍️ Which of the following real world scenarios would you associate with a stack data structure?

    Question

    Which of the following real world scenarios would you associate with a stack data structure?

    A

    piling up of chairs one above the other

    B

    people standing in a line to be serviced at a counter

    C

    offer services based on the priority of the customer

    D

    all of the mentioned

    Medium Open in App

    स्रोत : www.toppr.com

    Stack using Array Questions and Answers

    This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on “Stack using Array”. 1. Which of the following real world scenarios would you associate with a stack data structure? a) piling up of chairs one above the other b) people standing in a line to be serviced at a counter c) offer ... Read more

    Data Structure Questions and Answers – Stack using Array

    « Prev Next »

    This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on “Stack using Array”.

    1. Which of the following real world scenarios would you associate with a stack data structure?

    a) piling up of chairs one above the other

    b) people standing in a line to be serviced at a counter

    c) offer services based on the priority of the customer

    d) tatkal Ticket Booking in IRCTC

    View Answer

    2. What does the following function check for? (all necessary headers to be included and function is called from main)

    #define MAX 10

    typedef struct stack

    { int top; int item[MAX]; }stack;

    int function(stack *s)

    { if(s->top == -1) return 1; else return 0; } a) full stack b) invalid index c) empty stack d) infinite stack View Answer

    Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

    advertisement

    3. What does ‘stack underflow’ refer to?

    a) accessing item from an undefined stack

    b) adding items to a full stack

    c) removing items from an empty stack

    d) index out of bounds exception

    View Answer

    Check this: Computer Science MCQs | Programming MCQs

    4. What is the output of the following program?

    public class Stack {

    protected static final int CAPACITY = 100;

    protected int size,top = -1;

    protected Object stk[];

    public Stack() {

    stk = new Object[CAPACITY];

    }

    public void push(Object item)

    {

    if(size_of_stack==size)

    {

    System.out.println("Stack overflow");

    return; } else { top++; stk[top]=item; } } public Object pop() { if(top<0) { return -999; } else {

    Object ele=stk[top];

    top--; size_of_stack--; return ele; } } }

    public class StackDemo

    {

    public static void main(String args[])

    {

    Stack myStack = new Stack();

    myStack.push(10);

    Object element1 = myStack.pop();

    Object element2 = myStack.pop();

    System.out.println(element2);

    } } a) stack is full b) 20 c) 0 d) -999 View Answer advertisement

    5. What is the time complexity of pop() operation when the stack is implemented using an array?

    a) O(1) b) O(n) c) O(logn) d) O(nlogn) View Answer advertisement

    6. Which of the following array position will be occupied by a new element being pushed for a stack of size N elements(capacity of stack > N)?

    a) S[N-1] b) S[N] c) S[1] d) S[0] View Answer

    7. What happens when you pop from an empty stack while implementing using the Stack ADT in Java?

    a) Undefined error

    b) Compiler displays a warning

    c) EmptyStackException is thrown

    d) NoStackException is thrown

    View Answer

    8. What is the functionality of the following piece of Java code?

    Assume: ‘a’ is a non empty array of integers, the Stack class creates an array of specified size and provides a top pointer indicating TOS(top of stack), push and pop have normal meaning.

    public void some_function(int[] a)

    {

    Stack S=new Stack(a.length);

    int[] b=new int[a.length];

    for(int i=0;ifor(int i=0;i

    { S.push(a[i]); }

    {

    b[i]=(int)(S.pop());

    }

    System.out.println("output :");

    for(int i=0;i

    {

    System.out.println(b[i]);

    } }

    a) print alternate elements of array

    b) duplicate the given array

    c) parentheses matching

    d) reverse the array

    View Answer

    9. Array implementation of Stack is not dynamic, which of the following statements supports this argument?

    a) space allocation for array is fixed and cannot be changed during run-time

    b) user unable to give the input for stack operations

    c) a runtime exception halts execution

    d) improper program compilation

    View Answer

    10. Which of the following array element will return the top-of-the-stack-element for a stack of size N elements(capacity of stack > N)?

    a) S[N-1] b) S[N] c) S[N-2] d) S[N+1] View Answer

    Sanfoundry Global Education & Learning Series – Data Structure.

    To practice all areas of Data Structure, here is complete set of 1000+ Multiple Choice Questions and Answers.

    « Prev - Data Structure Questions and Answers – Circular Linked List

    » Next - Data Structure Questions and Answers – Stack using Linked List

    Next Steps:

    Get Free Certificate of Merit in Data Structure I

    Participate in Data Structure I Certification Contest

    Become a Top Ranker in Data Structure I

    Take Data Structure I Tests

    Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

    Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

    Related Posts:

    Practice Computer Science MCQs

    Apply for Computer Science Internship

    Buy Computer Science Books

    Practice Design & Analysis of Algorithms MCQ

    Practice Programming MCQs

    advertisement

    Recommended Articles:

    स्रोत : www.sanfoundry.com

    What are the real life applications of stack data structure?

    Answer (1 of 20): * Browsers use stack data structure to keep track of the last visited sites. * Call log in mobiles use stack.

    What are the real life applications of stack data structure?

    Ad by Amazon Web Services (AWS)

    AWS is how.

    AWS removes the complexity of building, training, and deploying machine learning models at any scale.

    20 Answers Saurabh Singh

    zzzzz...zz..zz..Author has 55 answers and 179.3K answer views6y

    Related

    What are some real-world applications of a stack data structure?

    Hash Table - used for fast data lookup - symbol table for compilers, database indexing, caches,Unique data representation.

    Trie - dictionary, such as one found on a mobile telephone for autocompletion and spell-checking.

    Suffix tree - fast full text searches used in most word processors.

    Stack - undo\redo operation in word processors, Expression evaluation and syntax parsing, many virtual machines like JVM are stack oriented.

    Queues - Transport and operations research where various entities are stored and held to be processed later ie the queue performs the function of a buffer.

    Priority queues - p Related questions

    What is the real time example of stack?

    What are the real applications of stacks and queues?

    What are practical applications of stacks?

    What are some in real life applications of Stack programming in C++?

    What are three real-life examples of the use of stacks?

    Abinaya Muthukrishnan

    B.E. in Computer Science & Learning to Program, M.Kumarasamy College of Engineering, Karur, Tamil Nadu, India (Graduated 2019)6y

    Related

    What are some real-world applications of a stack data structure?

    one of the real time example is working in microsoft word. if we type any string like hi, and if we are supposed to delete the string what we have entered(typed),the characters of the string are deleted in backward direction so that the characters are filled in the stack(here hi is filled in stack as i h). if we undo(ctrl+z), the first character comes out of stack and follows one by one(here h comes first,i next).

    Sponsored by JetBrains

    Write better C++ code with less effort.

    Boost your efficiency with refactorings, code analysis, unit test support, and an integrated debugger.

    Anonymous 8y Related

    What are some real-world applications of a stack data structure?

    The Forward and Previous buttons in a browser..

    Murtaza Chawala

    MCA in Technology & Computer Science, Maharashtra Institute of Technology (Graduated 2021)3y

    Real Life Applications of Stack:-

    Women’s Bangles

    Books,Clothes piled on top of each other

    Floors in a building.

    A Stack is a LIFO(Last in First Out) Data Structure which has some of the following use cases

    Browser back-forth button.

    Reversing a string

    Converting expressions(prefix-infix-postfix)

    Recursive functions.

    Maintaining any sort of LIFO data.

    Related questions

    What are some real-world applications of a queue data structure?

    What is the real-time application of stack, queue and linked list?

    What are the applications of queues and stacks in C++?

    What are some real world software examples of stacks, queues and deques?

    What is a stack in daily life?

    Punit Sharma

    Computer GeekAuthor has 106 answers and 236.7K answer views6y

    Related

    What are some real-world applications of a stack data structure?

    Real World applications in which order of Object matters stack are used for an example in following situation Stack is used

    During Function Calls because it Follows A LIFO Structure

    In Evaluating an Expression Stack is Used

    Converting an Infix to Postfix

    During Depth First Search (DFS) Stack is used

    Stack is used in some Scheduling Algorithms

    Sponsored by Aspose

    Need to add OCR functionalities within Java based application?

    Robust and reliable OCR API capable to extract text from BMP, JPEG and other image formats easily.

    Mohit Reddy Puli

    B.E. in Computer Science, Birla Institute of Technology and Science, Pilani (Graduated 2015)5y

    Browsers use stack data structure to keep track of the last visited sites.

    Call log in mobiles use stack.

    Suraj Dubey

    Author has 448 answers and 127.5K answer viewsJun 29

    Stack is a LIFO-based abstract data type and data structure (last in first out). It denotes that the last element to enter the stack will emerge first.

    Pushing and popping are possible with a stack. Push operations add elements to the stack's top, while Pop operations remove the element at the top of the stack.

    Real life applications of stack are-

    1. Expression Evaluation:-Infix, prefix, and postfix notation are evaluated using a stack data structure. The stack data structure can also be used to translate between infix, prefix, and postfix.

    2. Backtracking:- Backtracking is an algorithmic strategy

    Sponsored by Sencha

    Want to find out the right framework to build your web apps?

    Wondering which framework to choose? Here’s the guide on top framework comparisons. Check it out!

    Manav Patel

    Author has 330 answers and 80.2K answer viewsSep 1

    The linear data structure known as a stack is governed by the Last In First Out (LIFO) principle, which states that the component that is inserted last will be removed from it first. Consider a wedding buffet with platters as an example. Starting at the top of the stack, the plate that was most recently added is removed first. As a result, only one end of a stack is used for operations. They carry out three main responsibilities:

    स्रोत : www.quora.com

    Do you want to see answer or more ?
    Mohammed 2 month ago
    4

    Guys, does anyone know the answer?

    Click For Answer