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
ایڇ۔ٹی۔ٹی۔پی۔ایس کی اصطلاح کا کیا مطلب ہے؟
- Hyper Text Transfer Protocol Secure
- Hyper Text Translation Protocol Service
- Hyper Text Translation Protocol Secure
- Hyper Text Transfer Protocol Service
اس سوال کو وضاحت کے ساتھ پڑھیں
کیپچا کا بنیادی مقصد کیا ہے؟
- To speed up website loading times
- To verify that the user is human
- To improve image quality
- To block internet access
اس سوال کو وضاحت کے ساتھ پڑھیں
درج ذیل میں سے کون سا پرنٹر نہیں ہے؟
- Pixel printer
- Laser
- Dot matrix
- Inkjet printer
اس سوال کو وضاحت کے ساتھ پڑھیں
کمپیوٹر پراسیس ینالاگ اور ڈیجیٹل سگنل دونوں ______ ہے؟
- Hybrid
- Analogue
- Digital
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
کمپیوٹر کو دی گئی ہدایات کس زبان میں دی جاتی ہیں؟
- Assembly Language
- High-Level Language
- Machine Language
- Scripting Language