Skip to content
main-logo
  • +91 637-050-2482
  • santuitreturns@gmail.com
Menu
Menu
  • Home
  • Income Tax
    • Income From Salary
    • Profit or gain from Business/Profession.
    • Capital Gain
    • Income From Other Sources
    • 80C to 80U
    • TDS & TCS
    • ITR FORMS
  • International Taxation
    • Transfer Pricing
    • Non-Resident Taxation
    • Foreign Tax Credit (FTC)
    • Model Tax Convention
    • Base Erosion and Profit Shifting (BEPS)
  • GST
  • Accounting
  • MCQs
    • NEET
    • NEET QUIZ TEST
    • NEET PG MCQ’s
    • NEET PG QUIZ TEST
    • Civil Engineering
    • Mechanical Engineering MCQs
    • CHSL EXAM
      • Logical Reasoning
  • Others
    • Job Tips
  • CA Courses
    • CA Inter/IPCC

TOP MCQs on Data Structure with Answers

Posted on November 17, 2023

1. Reversing a word using stack can be used to find if the given word is a palindrome or not.

a) True
b) False

View Answer

Answer: a

Explanation: 

This application of stack can also be used to find if the given word is a palindrome because, if the reversed is same as that of the original word, the given word is a palindrome.
erting an infix expression to a postfix expression, when an operand is read, it is placed on to the output. When an operator is read, it is placed in the operator stack.

2. Which is the most appropriate data structure for reversing a word?

a) queue
b) stack
c) tree
d) graph

View Answer

Answer: b

Explanation:

Stack is the most appropriate data structure for reversing a word because stack follows LIFO principle.

3. Operations required for reversing a word or a string using stack are push() and pop().

a) True
b) False

View Answer

Answer: a

Explanation:

Push operation inserts a character into the stack and pop operation pops the top of the stack.

4. What is the time complexity of reversing a word using stack algorithm?

a) O (N log N)
b) O (N2)
c) O (N)
d) O (M log N)

View Answer

Answer: c

Explanation:

The time complexity of reversing a stack is mathematically found to be O (N) where N is the input.

5. What will be the word obtained if the word “abbcabb” is reversed using a stack?

a) bbabbca
b) abbcabb
c) bbacbba
d) bbacabb

View Answer

Answer: c

Explanation:

The string “abbcabb” is pushed on to the stack. If the characters are popped one by one, the word obtained will be bbacbba.

6. How many stacks are required for reversing a word algorithm?

a) one
b) two
c) three
d) four

View Answer

Answer: a

Explanation:

 Only 1 stack is required for reversing a word using stack. In that stack, push and pop operations are carried out.

7. What will be result if the given stack is popped? The word pat is pushed on to the stack if the given stack is popped

a) pat
b) tap
c) atp
d) apt

View Answer

Answer: b

Explanation:

The word ‘pat’ is pushed on to the stack. When the characters of the stack are popped one by one, the word ‘tap’ is obtained.

8. What will be output if the following sequence of operations are executed?
Push(a,s);
Push(b,s);
Pop(b);
Push(c,s);

a) abc
b) b
c) ac
d) acb

View Answer

Answer: b

Explanation:

The element ‘b’ is popped out of the stack. Hence the output of the following sequence of operations will be ‘b’.

 

9. What are the set of functions that are to be executed to get the following output? cat

a) push(c, s); push(a, s); push(t, s);
pop(s); pop(s); pop(s);
b) push(c,s); pop(s); push(a,s); pop(s);push(t,s);pop(s);
c) pop(c ); pop(a); pop(t);
d) push(c,s); push(a,s); pop(t);

View Answer

Answer: b

Explanation:

 During push operation, the characters ‘c’, ’a’, ’t’ are inserted into the stack and popped immediately after push.

10. How will your stack look like if the word ‘java’ is pushed?

a)Word java is pushed into the stack – option a
b)Word java is pushed into the stack – option b
c)Word java is pushed into the stack – option c
d)Word java is pushed into the stack – option d

View Answer

Answer: a

Explanation:

When a character is pushed, it stays on the top of the stack. While popping, the word occurs in reverse order since stack follows LIFO principle.

11. Find the error (if any) in the following code snippet for pop operation.
void pop() //removing an element from a stack
{
     printf(“%s”, stack[top++]);
}

a) run time error
b) compile time error
c) pop operation is performed, but top moved in wrong direction
d) pop operation is performed properly

View Answer

Answer: c

Explanation:

The statement printf(“%s”, stack[top++]) does a pop, but top gets incremented which is not correct. The statement stack[top++] should be replaced with stack[top–] in order to pop an operand and maintain stack properly.

    You May Also Like...

  • Top Stories About Minajhola Shiva Temple, Chandrapur, Rayagada [new]
  • Know About Famous Chilika Lake And Its Stories[New]
  • Top Story About Ghatgan Tarini Temple, Keonjhar District
  • Famous Rayagada Maa Majhighariani Temple [ Top Story]
  • Avoid Top 5 Major Mistakes While Changing Careers
  • Positive / Negative Impacts of Social Media on Students
  • 1000+ Words Essay on Covid-19 and Its Impact
  • Why Kantara Movie is Most Watchable Divine movie?

Leave a Reply Cancel reply

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

Quick Links

  • Home
  • About Us
  • Privacy Policy
  • Terms of Use
  • Disclaimer
  • Contact Us

Categories

  • Income Tax
  • International Taxation
  • GST
  • MCQs
  • Others
  • CA Courses

Latest Posts

  • Five changes in ITR forms of FY 2024-25 (AY 2025-26)
  • Form 10-IEA: Option to Choose Old Tax Regime
  • What is Section 54EC of the Income Tax Act?
  • What is Section 54F of the Income Tax Act?
©2025 Online Solves. All rights Reserved | Developed by AlgoPage IT Solutions Pvt. Ltd.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT