Question
Consider a `Stack` data structure implemented with
`push` and `pop` operations. What is the final state of the stack after the following sequence of operations? ``` Stack s; s.push(10); s.push(20); s.pop(); s.push(30); s.push(40); s.pop(); ```Solution
Dry Run (Stack: Last In, First Out): `s.push(10)`: Stack: `[10]` `s.push(20)`: Stack: `[10, 20]` `s.pop()`: Removes 20. Stack: `[10]` `s.push(30)`: Stack: `[10, 30]` `s.push(40)`: Stack: `[10, 30, 40]` `s.pop()`: Removes 40. Stack: `[10, 30]`
The half-life of an element is 5 years, what fraction of that radioactive substance will remain after 20 years?
Find the average of first 10 whole numbers.
Match List-I (City) with List-II (River Passing through the city) and select the correct answer using the codes given below the lists:
Which Indian has won the ”Ramon Magsaysay Award-2023”?
Consider the following statements:
1. If forty or more members support an Adjournment Motion, only then the related matter can be taken up for ...
Amit has 7 friends whom he wishes to invite to a dinner. Out of his 7 friends, 1 or more may accept the invitation. In how many different ways can Amit...
Which of the following statement is/are correct about “PM Rojgar Protsahan Yojana”?
I. Ministry of social justice and Empo...
Consider the following statements: DNA Barcoding can be a tool to:
1. assess the age of a plant or animal.
2. distinguish among species th...
Tri-service contingent of which one of the following countries participated in India's Republic Day parade in 2021?
Match List-I with List-II and select the correct answer using the code given below the lists: