What Will Be The Output Of The Given C Codep Pre Langc #754
What will be the output of the given C++ code?</p> <pre><code class="language-c"> #include <bits/stdc++.h> using namespace std; int main() { int arr[] = {1, 3,4,2,5}; int n = sizeof(arr)/sizeof(arr[0]); sort(arr+2, arr+n, greater<int>()); int a; for (int a = 0; a < n; a++) cout << arr[a] << " "; return 0; } </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Sorting - Introsort - Quiz No.2.
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[0]); sort(arr+2, arr+n, greater<int>()); int a; for (int a = 0; a < n; a++) cout << arr[a] << " "; return 0; }
1 2 3 4 5
1 5 4 3 2
5 4 3 2 1
1 3 5 4 2
Similar question(s) are as followings:
Online Quizzes of gs122 Data Communication and Computer Network
Sorting - Insertion Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.3
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - LSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes