Explore topic-wise MCQs in C++ Programming.

This section includes 9 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

Which header file is required to use accumulate() function?

A. <algorithm>
B. <numeric>
C. <vector>
D. <iostream>
Answer» C. <vector>
2.

Which function can be used to find the sum of a vector container?

A. findsum()
B. accumulate()
C. calcsum()
D. checksum()
Answer» C. calcsum()
3.

What is the property of partial sort function provided by the STL algorithm?

A. sorts the elements before the middle element in ascending order and remaining elements are left without any specific order
B. sorts the elements before the middle element in descending order and remaining elements are left without any specific order
C. sorts the elements after the middle element in ascending order and remaining elements are left without any specific order
D. sorts the elements after the middle element in descending order and remaining elements are left without any specific order
Answer» B. sorts the elements before the middle element in descending order and remaining elements are left without any specific order
4.

What is the property of stable sort function provided by the STL algorithm?

A. sorts the elements of a sequence in ascending order preserving the relative order of equivalent elements
B. sorts the elements of a sequence in descending order preserving the relative order of equivalent elements
C. arranges the sequence randomly preserving the relative order of equivalent elements
D. same as sort function of STL algorithm
Answer» B. sorts the elements of a sequence in descending order preserving the relative order of equivalent elements
5.

What is the use of random_shuffle() function of STL algorithm?

A. To generate the random sequence in a range
B. To generate a sequence in a given range and arrange them in random order
C. To rearrange given sequence randomly
D. To select any random number from the given sequence.
Answer» D. To select any random number from the given sequence.
6.

Which of the following is a Non-modifying Sequence Operation?

A. swap()
B. transform()
C. remove()
D. search()
Answer» E.
7.

Which of the following is a Modifying Sequence Operation?

A. all_of()
B. any_of()
C. equal()
D. swap()
Answer» E.
8.

How many types of sequence operations are provided by the C++ algorithm STL?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
9.

Which of the header file is used to implement algorithms provided by C++ STL?

A. <algorithm>
B. <header>
C. <algos>
D. <Algorithm>
Answer» B. <header>