šŸ•·ļø Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 103 (from laksa045)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ā„¹ļø Skipped - page is already crawled

šŸ“„
INDEXABLE
āœ…
CRAWLED
14 hours ago
šŸ¤–
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://www.geeksforgeeks.org/cpp/queue-cpp-stl/
Last Crawled2026-04-16 20:21:14 (14 hours ago)
First Indexed2025-06-15 22:26:40 (10 months ago)
HTTP Status Code200
Meta TitleQueue in C++ STL - GeeksforGeeks
Meta DescriptionYour All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more., Your All-in-One Learning Portal. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
Meta Canonicalnull
Boilerpipe Text
Last Updated : 13 Apr, 2026 A queue is a container adapter that stores elements in FIFO (First In, First Out) order. The elements that are inserted first should be removed first. This is possible by inserting elements at one end (called back) and deleting them from the other end (called front) of the data structure. Queue in C++ Output Front element: 10 Back element: 5 Front element after pop: 5 Syntax Queue is defined as the std::queue class template inside <queue> header file. queue<T> q; where, T: DataType of elements in the queue. q: Name assigned to the queue. Basic Operations Here are the basic operations that can be performed on a queue: 1. Inserting Elements New elements can only be inserted at back of the queue using push() function. The process of inserting elements in a queue is also called enqueue. #include <iostream> #include <queue> using namespace std ; int main (){ queue < int > q ; // Pushing elements into the queue q . push ( 3 ); q . push ( 4 ); q . push ( 5 ); return 0 ; } 2. Accessing Elements Only the front and back elements of the queue can be accessed by using front() and back() functions respectively. Output 3 5 3. Deleting Elements Elements can only be deleted from the front of the queue using the pop() function. The process of deleting elements from a queue is also called dequeue. Output 4 5 Note: In a queue, elements can only be inserted at the back and removed from the front. It does not provide access to middle elements, so deleting an element from the middle is not directly possible. 4. empty() This checks whether the queue is empty. It returns true if the queue has no elements; otherwise, it returns false. Output Queue is empty Queue is not empty. Front element: 100 5. Size of queue The size() function in a queue returns the number of elements currently in the queue. It helps to determine how many items are stored without modifying the queue. Output Size of queue: 2 Size of queue: 1 Pseudo Traversal Since only the front and back element can be accessed in a queue, we cannot directly traverse it. On the other hand, we can create a copy of the queue, access the front element, and then delete it, and continue this process until the copied queue is empty, we can effectively traverse all the elements of the queue. Try It Yourself Output 3 4 5 All Member Functions Following is the list of all member functions of std::queue class in C++: Functions Description front() Access the front element of the queue. back() Access the end element of the queue. empty() Check whether a queue is empty or not. size() Returns the number of elements in the queue. push() Adding an element at the back of the queue. push_range() Adding multiple elements at the end of queue. emplace() Constructs and inserts an element at the back of the queue. pop() Delete the front element of the queue. swap() Swap two queues. Queue in C++ STL Visit Course Suggested Quiz 6 Questions Can the queue STL in C++ be used to store elements of a user-defined data type? A Yes B No Which of the following is not a member function of the queue STL in C++? A empty() B size() C get() D push() Which of the following is/are not a valid way to initialize a queue in C++? A queue<int> q; B queue<int> q(5); C queue<int> q({1, 2, 3}); D queue<int> q(q2); What will be the output of the following C++ code? #include <iostream> #include <queue> using namespace std ; int main () { queue < int > myqueue ; myqueue . push ( 30 ); myqueue . push ( 40 ); myqueue . push ( 10 ); myqueue . push ( 50 ); cout << myqueue . back (); return 0 ; } A 30 B 40 C 10 D 50 What will be the output of the following C++ program? #include <iostream> #include <queue> using namespace std ; int main () { queue < int > myqueue ; myqueue . push ( 80 ); myqueue . push ( 70 ); myqueue . push ( 60 ); myqueue . push ( 50 ); if ( myqueue . front () > myqueue . back ()) { cout << myqueue . front () - myqueue . back (); } else if ( myqueue . front () < myqueue . back ()) { cout << myqueue . back () - myqueue . front (); } else cout << "0" ; } A 50 B 70 C 30 D 130 Which of the following is used to insert an element into a std::queue in C++ STL? A insert() B push() C add() D enqueue() Quiz Completed Successfully Your Score : 0 / 6 Accuracy : 0% Login to View Explanation 1 /6 Comment Article Tags: Explore C++ Basics Core Concepts OOP Standard Template Library(STL) Practice & Problems
Markdown
[![geeksforgeeks](https://media.geeksforgeeks.org/gfg-gg-logo.svg)](https://www.geeksforgeeks.org/) ![search icon](https://media.geeksforgeeks.org/auth-dashboard-uploads/Property=Light---Default.svg) - Sign In - [Courses]() - [Tutorials]() - [Interview Prep]() - [C++ Tutorial](https://www.geeksforgeeks.org/cpp/c-plus-plus/) - [Interview Questions](https://www.geeksforgeeks.org/cpp/cpp-interview-questions/) - [Examples](https://www.geeksforgeeks.org/cpp/cpp-programming-examples/) - [Quizzes](https://www.geeksforgeeks.org/cpp/c-programming-multiple-choice-questions/) - [Projects](https://www.geeksforgeeks.org/cpp/top-50-cpp-project-ideas-for-beginners-advanced/) - [Cheatsheet](https://www.geeksforgeeks.org/cpp/cpp-cheatsheet/) - [OOP](https://www.geeksforgeeks.org/cpp/object-oriented-programming-in-cpp/) - [Exception Handling](https://www.geeksforgeeks.org/cpp/exception-handling-c/) - [STL](https://www.geeksforgeeks.org/cpp/the-c-standard-template-library-stl/) - [DSA C++](https://www.geeksforgeeks.org/cpp/learn-dsa-in-cpp/) # Queue in C++ STL Last Updated : 13 Apr, 2026 A queue is a [container adapter](https://www.geeksforgeeks.org/cpp/container-adapter-in-cpp/) that stores elements in FIFO (First In, First Out) order. - The elements that are inserted first should be removed first. - This is possible by inserting elements at one end (called back) and deleting them from the other end (called front) of the data structure. ![dequeue\_operation\_in\_queue\_1](https://media.geeksforgeeks.org/wp-content/uploads/20250930145226252614/dequeue_operation_in_queue_1.webp) Queue in C++ C++ `` ``` #include <iostream> ``` ``` #include <queue> ``` ``` using namespace std; ``` ``` ​ ``` ``` int main() ``` ``` { ``` ``` queue<int> q; ``` ``` q.push(10); ``` ``` q.push(5); ``` ``` ​ ``` ``` // Accessing the front and back elements ``` ``` cout << "Front element: " << q.front() << endl; ``` ``` cout << "Back element: " << q.back() << endl; ``` ``` ​ ``` ``` // Removing an element from the front ``` ``` q.pop(); ``` ``` ​ ``` ``` cout << "Front element after pop: " << q.front() << endl; ``` ``` return 0; ``` ``` } ``` **Output** ``` Front element: 10 Back element: 5 Front element after pop: 5 ``` ## Syntax Queue is defined as the std::queue class template inside \<queue\> header file. > queue\<T\> q; where, - ****T:**** DataType of elements in the queue. - ****q:**** Name assigned to the queue. ## Basic Operations Here are the basic operations that can be performed on a queue: ### 1\. Inserting Elements - New elements can only be inserted at back of the queue using [push()](https://www.geeksforgeeks.org/cpp/queue-push-and-queue-pop-in-cpp-stl/) function. - The process of inserting elements in a queue is also called enqueue. C++ `` ### 2\. Accessing Elements Only the front and back elements of the queue can be accessed by using [front()](https://www.geeksforgeeks.org/cpp/queuefront-queueback-c-stl/) and [back()](https://www.geeksforgeeks.org/cpp/queuefront-queueback-c-stl/) functions respectively. C++ `` ``` #include <iostream> ``` ``` #include <queue> ``` ``` using namespace std; ``` ``` ​ ``` ``` int main() ``` ``` { ``` ``` queue<int> q; ``` ``` q.push(3); ``` ``` q.push(4); ``` ``` q.push(5); ``` ``` ​ ``` ``` // Accessing the front and back elements ``` ``` cout << q.front() << endl; ``` ``` cout << q.back(); ``` ``` ``` ``` return 0; ``` ``` } ``` **Output** ``` 3 5 ``` ### 3\. Deleting Elements - Elements can only be deleted from the front of the queue using the [pop()](https://www.geeksforgeeks.org/cpp/queue-push-and-queue-pop-in-cpp-stl/) function. - The process of deleting elements from a queue is also called dequeue. C++ `` ``` #include <iostream> ``` ``` #include <queue> ``` ``` using namespace std; ``` ``` ​ ``` ``` int main(){ ``` ``` queue<int> q; ``` ``` q.push(3); ``` ``` q.push(4); ``` ``` q.push(5); ``` ``` ​ ``` ``` // Deleting elements from the front of the queue ``` ``` q.pop(); ``` ``` ​ ``` ``` while (!q.empty()){ ``` ``` cout << q.front() << " "; ``` ``` q.pop(); ``` ``` } ``` ``` return 0; ``` ``` } ``` **Output** ``` 4 5 ``` > ****Note:**** In a queue, elements can only be inserted at the back and removed from the front. It does not provide access to middle elements, so deleting an element from the middle is not directly possible. ### 4\. empty() - This checks whether the queue is empty. - It returns true if the queue has no elements; otherwise, it returns false. C++ `` ``` #include <iostream> ``` ``` #include <queue> ``` ``` using namespace std; ``` ``` ​ ``` ``` int main(){ ``` ``` ​ ``` ``` queue<int> q; ``` ``` if (q.empty()){ ``` ``` cout << "Queue is empty " << endl; ``` ``` } ``` ``` q.push(100); ``` ``` if (!q.empty()){ ``` ``` cout << "Queue is not empty. Front element: " << q.front() << endl; ``` ``` } ``` ``` return 0; ``` ``` } ``` **Output** ``` Queue is empty Queue is not empty. Front element: 100 ``` ### 5\. Size of queue - The size() function in a queue returns the number of elements currently in the queue. - It helps to determine how many items are stored without modifying the queue. C++ `` ``` #include <iostream> ``` ``` #include <queue> ``` ``` using namespace std; ``` ``` ​ ``` ``` int main() ``` ``` { ``` ``` ​ ``` ``` queue<int> q; ``` ``` q.push(10); ``` ``` q.push(5); ``` ``` cout << "Size of queue: " << q.size() << endl; ``` ``` q.pop(); ``` ``` cout << "Size of queue: " << q.size() << endl; ``` ``` return 0; ``` ``` } ``` **Output** ``` Size of queue: 2 Size of queue: 1 ``` ## Pseudo Traversal - Since only the front and back element can be accessed in a queue, we cannot directly traverse it. - On the other hand, we can create a copy of the queue, access the front element, and then delete it, and continue this process until the copied queue is empty, we can effectively traverse all the elements of the queue. C++ `` ``` #include <iostream> ``` ``` #include <queue> ``` ``` using namespace std; ``` ``` ​ ``` ``` int main(){ ``` ``` queue<int> q; ``` ``` q.push(3); ``` ``` q.push(4); ``` ``` q.push(5); ``` ``` ​ ``` ``` // Create a copy ``` ``` queue<int> temp(q); ``` ``` ​ ``` ``` while (!temp.empty()) ``` ``` { ``` ``` cout << temp.front() << " "; ``` ``` temp.pop(); ``` ``` } ``` ``` return 0; ``` ``` } ``` [Try It Yourself ![redirect icon](https://media.geeksforgeeks.org/auth-dashboard-uploads/Group-arrow.svg)](https://www.geeksforgeeks.org/problems/c-stl-set-5-queue/1) **Output** ``` 3 4 5 ``` ## All Member Functions Following is the list of all member functions of std::queue class in C++: | ****Functions**** | ****Description**** | |---|---| | [front()](https://www.geeksforgeeks.org/cpp/queuefront-queueback-c-stl/) | Access the front element of the queue. | | [back()](https://www.geeksforgeeks.org/cpp/queuefront-queueback-c-stl/) | Access the end element of the queue. | | [empty()](https://www.geeksforgeeks.org/cpp/queueempty-queuesize-c-stl/) | Check whether a queue is empty or not. | | [size()](https://www.geeksforgeeks.org/cpp/queueempty-queuesize-c-stl/) | Returns the number of elements in the queue. | | [push()](https://www.geeksforgeeks.org/cpp/queue-push-and-queue-pop-in-cpp-stl/) | Adding an element at the back of the queue. | | ****push\_range()**** | Adding multiple elements at the end of queue. | | [****emplace()****](https://www.geeksforgeeks.org/cpp/queueemplace-c-stl/) | Constructs and inserts an element at the back of the queue. | | [pop()](https://www.geeksforgeeks.org/cpp/queue-push-and-queue-pop-in-cpp-stl/) | Delete the front element of the queue. | | [swap()](https://www.geeksforgeeks.org/cpp/queue-swap-cpp-stl/) | Swap two queues. | Queue in C++ STL [Visit Course![course link icon](https://media.geeksforgeeks.org/auth-dashboard-uploads/Vector11.svg)](https://www.geeksforgeeks.org/courses/cpp-https://www.geeksforgeeks.org/courses/cpp-programming-basic-to-advanced?utm_source=geeksforgeeks&utm_medium=article_tab_visit_course&utm_campaign=gfg_cppfoundationprogramming-basic-to-advanced?utm_source=geeksforgeeks&utm_medium=article_tab_visit_course&utm_campaign=gfg_cppfoundation) Suggested Quiz ![reset](https://media.geeksforgeeks.org/auth-dashboard-uploads/Reset-icon---Light.svg) 6 Questions Can the queue STL in C++ be used to store elements of a user-defined data type? - A Yes - B No Which of the following is not a member function of the queue STL in C++? - A empty() - B size() - C get() - D push() Which of the following is/are not a valid way to initialize a ****queue**** in C++? - A queue\<int\> q; - B queue\<int\> q(5); - C queue\<int\> q({1, 2, 3}); - D queue\<int\> q(q2); What will be the output of the following C++ code? C++ `` - A 30 - B 40 - C 10 - D 50 What will be the output of the following C++ program? C++ `` - A 50 - B 70 - C 30 - D 130 Which of the following is used to insert an element into a std::queue in C++ STL? - A insert() - B push() - C add() - D enqueue() ![success](https://media.geeksforgeeks.org/auth-dashboard-uploads/sucess-img.png) Quiz Completed Successfully Your Score :0/6 Accuracy :0% Login to View Explanation **1**/6 \< Previous Next \> Comment [K](https://www.geeksforgeeks.org/user/kartik/) [kartik](https://www.geeksforgeeks.org/user/kartik/) 321 Article Tags: Article Tags: [C++](https://www.geeksforgeeks.org/category/programming-language/cpp/) [STL](https://www.geeksforgeeks.org/tag/stl/) [cpp-containers-library](https://www.geeksforgeeks.org/tag/cpp-containers-library/) [cpp-queue](https://www.geeksforgeeks.org/tag/cpp-queue/) ### Explore [![GeeksforGeeks](https://media.geeksforgeeks.org/auth-dashboard-uploads/gfgFooterLogo.png)](https://www.geeksforgeeks.org/) ![location](https://media.geeksforgeeks.org/img-practice/Location-1685004904.svg) Corporate & Communications Address: A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305) ![location](https://media.geeksforgeeks.org/img-practice/Location-1685004904.svg) Registered Address: K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305 [![GFG App on Play Store](https://media.geeksforgeeks.org/auth-dashboard-uploads/googleplay-%281%29.png)](https://geeksforgeeksapp.page.link/gfg-app)[![GFG App on App Store](https://media.geeksforgeeks.org/auth-dashboard-uploads/appstore-%281%29.png)](https://geeksforgeeksapp.page.link/gfg-app) - Company - [About Us](https://www.geeksforgeeks.org/about/) - [Legal](https://www.geeksforgeeks.org/legal/) - [Privacy Policy](https://www.geeksforgeeks.org/legal/privacy-policy/) - [Contact Us](https://www.geeksforgeeks.org/about/contact-us/) - [Advertise with us](https://www.geeksforgeeks.org/advertise-with-us/) - [GFG Corporate Solution](https://www.geeksforgeeks.org/gfg-corporate-solution/) - [Campus Training Program](https://www.geeksforgeeks.org/campus-training-program/) - Explore - [POTD](https://www.geeksforgeeks.org/problem-of-the-day) - [Job-A-Thon](https://practice.geeksforgeeks.org/events/rec/job-a-thon/) - [Blogs](https://www.geeksforgeeks.org/category/blogs/?type=recent) - [Nation Skill Up](https://www.geeksforgeeks.org/nation-skill-up/) - Tutorials - [Programming Languages](https://www.geeksforgeeks.org/computer-science-fundamentals/programming-language-tutorials/) - [DSA](https://www.geeksforgeeks.org/dsa/dsa-tutorial-learn-data-structures-and-algorithms/) - [Web Technology](https://www.geeksforgeeks.org/web-tech/web-technology/) - [AI, ML & Data Science](https://www.geeksforgeeks.org/machine-learning/ai-ml-and-data-science-tutorial-learn-ai-ml-and-data-science/) - [DevOps](https://www.geeksforgeeks.org/devops/devops-tutorial/) - [CS Core Subjects](https://www.geeksforgeeks.org/gate/gate-exam-tutorial/) - [Interview Preparation](https://www.geeksforgeeks.org/aptitude/interview-corner/) - [Software and Tools](https://www.geeksforgeeks.org/websites-apps/software-and-tools-a-to-z-list/) - Courses - [ML and Data Science](https://www.geeksforgeeks.org/courses/category/machine-learning-data-science) - [DSA and Placements](https://www.geeksforgeeks.org/courses/category/dsa-placements) - [Web Development](https://www.geeksforgeeks.org/courses/category/development-testing) - [Programming Languages](https://www.geeksforgeeks.org/courses/category/programming-languages) - [DevOps & Cloud](https://www.geeksforgeeks.org/courses/category/cloud-devops) - [GATE](https://www.geeksforgeeks.org/courses/category/gate) - [Trending Technologies](https://www.geeksforgeeks.org/courses/category/trending-technologies/) - Videos - [DSA](https://www.geeksforgeeks.org/videos/category/sde-sheet/) - [Python](https://www.geeksforgeeks.org/videos/category/python/) - [Java](https://www.geeksforgeeks.org/videos/category/java-w6y5f4/) - [C++](https://www.geeksforgeeks.org/videos/category/c/) - [Web Development](https://www.geeksforgeeks.org/videos/category/web-development/) - [Data Science](https://www.geeksforgeeks.org/videos/category/data-science/) - [CS Subjects](https://www.geeksforgeeks.org/videos/category/cs-subjects/) - Preparation Corner - [Interview Corner](https://www.geeksforgeeks.org/interview-prep/interview-corner/) - [Aptitude](https://www.geeksforgeeks.org/aptitude/aptitude-questions-and-answers/) - [Puzzles](https://www.geeksforgeeks.org/aptitude/puzzles/) - [GfG 160](https://www.geeksforgeeks.org/courses/gfg-160-series) - [System Design](https://www.geeksforgeeks.org/system-design/system-design-tutorial/) [@GeeksforGeeks, Sanchhaya Education Private Limited](https://www.geeksforgeeks.org/), [All rights reserved](https://www.geeksforgeeks.org/copyright-information/) ![]()
Readable Markdown
Last Updated : 13 Apr, 2026 A queue is a [container adapter](https://www.geeksforgeeks.org/cpp/container-adapter-in-cpp/) that stores elements in FIFO (First In, First Out) order. - The elements that are inserted first should be removed first. - This is possible by inserting elements at one end (called back) and deleting them from the other end (called front) of the data structure. ![dequeue\_operation\_in\_queue\_1](https://media.geeksforgeeks.org/wp-content/uploads/20250930145226252614/dequeue_operation_in_queue_1.webp) Queue in C++ **Output** ``` Front element: 10 Back element: 5 Front element after pop: 5 ``` ## Syntax Queue is defined as the std::queue class template inside \<queue\> header file. > queue\<T\> q; where, - ****T:**** DataType of elements in the queue. - ****q:**** Name assigned to the queue. ## Basic Operations Here are the basic operations that can be performed on a queue: ### 1\. Inserting Elements - New elements can only be inserted at back of the queue using [push()](https://www.geeksforgeeks.org/cpp/queue-push-and-queue-pop-in-cpp-stl/) function. - The process of inserting elements in a queue is also called enqueue. `` ### 2\. Accessing Elements Only the front and back elements of the queue can be accessed by using [front()](https://www.geeksforgeeks.org/cpp/queuefront-queueback-c-stl/) and [back()](https://www.geeksforgeeks.org/cpp/queuefront-queueback-c-stl/) functions respectively. **Output** ``` 3 5 ``` ### 3\. Deleting Elements - Elements can only be deleted from the front of the queue using the [pop()](https://www.geeksforgeeks.org/cpp/queue-push-and-queue-pop-in-cpp-stl/) function. - The process of deleting elements from a queue is also called dequeue. **Output** ``` 4 5 ``` > ****Note:**** In a queue, elements can only be inserted at the back and removed from the front. It does not provide access to middle elements, so deleting an element from the middle is not directly possible. ### 4\. empty() - This checks whether the queue is empty. - It returns true if the queue has no elements; otherwise, it returns false. **Output** ``` Queue is empty Queue is not empty. Front element: 100 ``` ### 5\. Size of queue - The size() function in a queue returns the number of elements currently in the queue. - It helps to determine how many items are stored without modifying the queue. **Output** ``` Size of queue: 2 Size of queue: 1 ``` ## Pseudo Traversal - Since only the front and back element can be accessed in a queue, we cannot directly traverse it. - On the other hand, we can create a copy of the queue, access the front element, and then delete it, and continue this process until the copied queue is empty, we can effectively traverse all the elements of the queue. [Try It Yourself ![redirect icon](https://media.geeksforgeeks.org/auth-dashboard-uploads/Group-arrow.svg)](https://www.geeksforgeeks.org/problems/c-stl-set-5-queue/1) **Output** ``` 3 4 5 ``` ## All Member Functions Following is the list of all member functions of std::queue class in C++: | ****Functions**** | ****Description**** | |---|---| | [front()](https://www.geeksforgeeks.org/cpp/queuefront-queueback-c-stl/) | Access the front element of the queue. | | [back()](https://www.geeksforgeeks.org/cpp/queuefront-queueback-c-stl/) | Access the end element of the queue. | | [empty()](https://www.geeksforgeeks.org/cpp/queueempty-queuesize-c-stl/) | Check whether a queue is empty or not. | | [size()](https://www.geeksforgeeks.org/cpp/queueempty-queuesize-c-stl/) | Returns the number of elements in the queue. | | [push()](https://www.geeksforgeeks.org/cpp/queue-push-and-queue-pop-in-cpp-stl/) | Adding an element at the back of the queue. | | ****push\_range()**** | Adding multiple elements at the end of queue. | | [****emplace()****](https://www.geeksforgeeks.org/cpp/queueemplace-c-stl/) | Constructs and inserts an element at the back of the queue. | | [pop()](https://www.geeksforgeeks.org/cpp/queue-push-and-queue-pop-in-cpp-stl/) | Delete the front element of the queue. | | [swap()](https://www.geeksforgeeks.org/cpp/queue-swap-cpp-stl/) | Swap two queues. | Queue in C++ STL [Visit Course![course link icon](https://media.geeksforgeeks.org/auth-dashboard-uploads/Vector11.svg)](https://www.geeksforgeeks.org/courses/cpp-https://www.geeksforgeeks.org/courses/cpp-programming-basic-to-advanced?utm_source=geeksforgeeks&utm_medium=article_tab_visit_course&utm_campaign=gfg_cppfoundationprogramming-basic-to-advanced?utm_source=geeksforgeeks&utm_medium=article_tab_visit_course&utm_campaign=gfg_cppfoundation) Suggested Quiz 6 Questions Can the queue STL in C++ be used to store elements of a user-defined data type? - A Yes - B No Which of the following is not a member function of the queue STL in C++? - A empty() - B size() - C get() - D push() Which of the following is/are not a valid way to initialize a ****queue**** in C++? - A queue\<int\> q; - B queue\<int\> q(5); - C queue\<int\> q({1, 2, 3}); - D queue\<int\> q(q2); What will be the output of the following C++ code? `` - A 30 - B 40 - C 10 - D 50 What will be the output of the following C++ program? `` - A 50 - B 70 - C 30 - D 130 Which of the following is used to insert an element into a std::queue in C++ STL? - A insert() - B push() - C add() - D enqueue() ![success](https://media.geeksforgeeks.org/auth-dashboard-uploads/sucess-img.png) Quiz Completed Successfully Your Score :0/6 Accuracy :0% Login to View Explanation **1**/6 Comment Article Tags: ### Explore
Shard103 (laksa)
Root Hash12046344915360636903
Unparsed URLorg,geeksforgeeks!www,/cpp/queue-cpp-stl/ s443