Third Round - 5 Java/C++ Coding Problems
Q1: Write java code to print n terms of the following series and also print the sum and average of the series.
115, 112, 108, 103 . . .
Q2: Write a method that will return the Nth largest number from a data of M numbers in the most efficient way using either selection or bubble sort.
Q3: Write a method to print n x n pattern as given below if n = 5, where 1 <= n <= 12
10
12 13
15 16 17
19 20 21 22
24 25 26 27 28
Q4: What is inheritance? How is Circle related to Cylinder in terms of inheritance? Create java classes for Circle and Cylinder with proper constructors, getters, and setters methods. Also, write method(s) to find the area of the circle and method(s) to find volume of the cylinder.
Q5: Write a program to print following n x n pattern, where 1 <= n <=26
1 2 3 4 5
2 3 4 5 1
3 4 5 1 2
4 5 1 2 3
5 1 2 3 4