Explore topic-wise MCQs in C++ Programming.

This section includes 4 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.

What is the use of fill() function in array class?

A. To fill an array with a given single value
B. To delete all the elements that are equal to the given value
C. To replace all the elements of the array which are equal to the given value
D. To check whether given element fills the array or not
Answer» B. To delete all the elements that are equal to the given value
2.

What is the use of empty() function in array classes?

A. To check whether the size of an array is zero or not
B. To check whether an array is empty or not
C. To check how many elements are there in the array
D. To check whether an array contains negative elements or not
Answer» B. To check whether an array is empty or not
3.

What is the syntax of swap()?

A. swap(arr1, arr2);
B. arr1.swap(arr2);
C. swap<int, int>(arr1, arr2);
D. swap[arr1, arr2];
Answer» C. swap<int, int>(arr1, arr2);
4.

What is the use of swap() function in array class?

A. Swaps two elements of an array given elements
B. Swaps two arrays
C. Swaps two elements given indices of elements
D. Swaps same elements of the array if required
Answer» C. Swaps two elements given indices of elements