# Introsort Multiple choice Questions and Answers (MCQs)

DOWNLOAD FREE PDF <<CLICK HERE>>

## Introsort Multiple choice Questions and Answers (MCQs)

Congratulations - you have completed Introsort Multiple choice Questions and Answers (MCQs).

You scored %%SCORE%% out of %%TOTAL%%.

Your performance has been rated as %%RATING%%

Your answers are highlighted below.
 Question 16 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
What will be the output of the given C++ code?

#include <bits/stdc++.h>  using namespace std; int main() { int arr[] = {1, 3, 4, 2, 5}; int n = sizeof(arr)/sizeof(arr); sort(arr,  arr+n,  greater<int>()); int a; for (a = 0; a < n; a++) cout << arr[a] << " "; return 0; }
 A 1 2 3 4 5 B 1 3 4 2 5 C 5 4 3 2 1 D error
Question 16 Explanation:
The given program sorts the input in descending order. It is due to the third parameter i.e. greater() which is passed to the function sort().

 Question 17 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
What will be the output of the given C++ code?

#include <bits/stdc++.h>  using namespace std; int main() { int arr[] = {1,  3, 4, 2, 5}; int n = sizeof(arr)/sizeof(arr); sort(arr,  arr+n); int a; for ( a = 0; a< n; a++) cout << arr[a] << " "; return 0; }
 A 1 2 3 4 5 B 1 3 4 2 5 C 5 4 3 2 1 D error
Question 17 Explanation:
The given program sorts the input in ascending order. Function sort() uses two parameters in the form of address of the first and last element of the array to sort the array.

 Question 18 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
What will be the output of the given C++ code?

#include <bits/stdc++.h>  using namespace std; int main() { 	int arr[] = {1,  3, 4, 2, 5}; 	int n = sizeof(arr)/sizeof(arr); 	sort(arr+2,  arr+n,  greater<int>()); int a; 	for (int a = 0; a < n; a++) 		cout << arr[a] << " "; 	return 0; }
 A 1 2 3 4 5 B 1 5 4 3 2 C 5 4 3 2 1 D 1 3 5 4 2
Question 18 Explanation:
As the first parameter to function sort() is arr+2 so the sorting begins from the third element i.e. 4. Also as there is a third argument greater () to the function sort() so the sorting will be done in descending order.

Once you are finished, click the button below. Any items you have not completed will be marked incorrect.
There are 18 questions to complete.

DOWNLOAD FREE PDF <<CLICK HERE>>