Finding of the 4 larger (bigger) numbers from the list
like{1245,4587,2145,1163,29987,65783.....}



Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}..

Answer / santhosh

int Max = 4;
List<int> lst = new List<int>(new int[] { 1, 12,
2, 11, 15, 3, 14, 4, 5, 6, 7, 8, 9, 10 });
lst.Sort();
if (Max <= lst.Count)
Console.WriteLine(string.Format("The {0} th
Maximum value is {1}.", Max, lst[lst.Count - Max]));
else
Console.WriteLine(string.Format("This list
contain less items. So you could not find the {0}th highest
value from the list.", Max));

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

What is interface? When and where is it used?

0 Answers  


What is the difference between the C & C++?

9 Answers   HCL,


#include <iostream> using namespace std; int main() { int a = 3; int c[5][5]; for (int x=0;x<5;x++) { for (int y=0;y<5;y++) { c[x][y] = x*y; } } cout << c[a][2]; }

1 Answers  


What is persistence in oop?

0 Answers  


Can static class have constructor?

0 Answers  






Can we define a class within the interface?

0 Answers  


Why and when is a virtual destructor needed?

5 Answers  


is java purely oop Language?

49 Answers   HCL, Infosys, TCS,


Name a typical usage of polymorphism

3 Answers  


how to find no of instances of an object in .NET?

1 Answers   Infosys,


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

0 Answers  


3. Differentiate verification and validation.

1 Answers  


Categories