In data structures, what does unshift do?
ڈیٹا سٹرکچرز میں، ان شفٹ کیا کرتا ہے؟
- Adds an element to the beginning
- Removes the last element
- Removes the first element
- Adds an element to the end
Explanation
- In arrays or lists, unshift adds a new element to the start of the structure.
- The existing elements are shifted one position to the right to make space.
- The opposite operation is shift, which removes the first element.
- Unshift is useful when you need to prioritize new elements at the front.
- It is commonly used in queue implementations and array manipulations.
Related MCQs
ڈاس آپریٹنگ سسٹم کس پر مبنی ہے؟
- Graphical User Interface
- Command Line Interface (CLI)
- Touch User Interface
- Voice User Interface
اس سوال کو وضاحت کے ساتھ پڑھیں
- Fourth generation computer
- First generation computer
- Third generation computer
- Second generation computer
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
پاس ورڈ توڑنے یا اندازے سے معلوم کرنے کے عمل کو عام طور پر کیا کہا جاتا ہے؟
- Hacking
- Phishing
- Cracking
- Formatting
اس سوال کو وضاحت کے ساتھ پڑھیں
معیاری اے ایس سی آئی آئی میں کتنے حروف ہوتے ہیں؟
- 28
- 1024
- 512
- 128
- 928
اس سوال کو وضاحت کے ساتھ پڑھیں
سادہ زبان کو مشینی زبان میں تبدیل کرنے کے عمل کو کیا کہتے ہیں؟
- Compiler
- Modem
- Interpreter
- Translator