Rotate Matrix Rings
Given a matrix of order M*N and a value K, write a program to rotate each ring of the matrix clockwise by K elements. If in any ring has less than or equal to K elements, then don’t rotate that ring.Input
For example, if the given M and N are 4 and 4 respectively. If the matrix elements are
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
If the given K is 3. Rotate each ring of the matrix by 3 elements.
In the above matrix, the elements (1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5) is a ring, similarly, the elements (6, 7, 11, 10) will make a ring.
Therefore, by rotating each ring in clockwise direction by 3 elements will give (13, 9, 5, 1, 2, 3, 4, 8, 12, 16, 15, 14) and (10, 6, 7, 11). So the output should be
13 9 5 1
14 7 11 2
15 6 10 3
16 12 8 4
Sample Input
3 4
1 2 3 4
10 11 12 5
9 8 7 6
2
Sample Output
9 10 1 2
8 11 12 3
7 6 5 4
Write a program that will arrange the elements of a 10 integer array in descending order.
Discuss the relative advantages of point-to-point interconnection compared to bus interconnection
Write a program using constructor overloading to implement the following tasks:
1.Print sides of a cube
2.Print radius and height of the cylinder
3.Calculate the volume of a cube
4.Calculate thevolume of a cylinder
Write a program to find a maximum number between/among two and three numbers using constructor
overloading
1. >>> 2- 2
2. >>> 2 -(2-)
File "<stdin>", line 1
2 -(2-)
^
SyntaxError: invalid syntax
3. >>> (0+1)-9(1/2)
<stdin>:1: SyntaxWarning: 'int' object is not callable; perhaps you missed a comma?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
Give explanation to these results experimented in python above.
Write a program in C++ to open and read the contents of the Text1.txt using the file stream class.
Close the file and again open to update the contents of given file Text1.txt.
Text1.txt : I am enjoying learning OOPS concepts
After update
Text1.txt: I am enjoying learning OOPS concepts
Now learnt C++; Java is my next target.
Write a program in C++ to accept date in dd:mm:yyyy format. Store these values in MyDate Class
with members as day, month and year. Convert this date into one variable “Duration” of the current
years. This duration means number of days passed in the current year since Jan 1.
Hint :Use type conversion method from class type to basic type conversions.
Note: consider days in February as 28 for all years.
Output expected:
Enter Date : 05:04:2021
No of days since Jan 1 of the current year : 90
Write a python program to achieve Advanced Encryption Standard 128 bit key length encoding and decoding of text.
Program should be algorithm based rather than using any library function. Write both ENCODING and DECODING.
Input text
“To be, or not to be, that is the question: Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles
And by opposing end them. To die—to sleep,
No more; and by a sleep to say we end
The heart-ache and the thousand natural shocks
That flesh is heir to: 'tis a consummation
Devoutly to be wish'd. To die, to sleep;
To sleep, perchance to dream—ay, there's the rub:
For in that sleep of death what dreams may come,
When we have shuffled off this mortal coil,
Must give us pause—there's the respect
That makes calamity of so long life.
When he himself might his quietus make
With this regard their currents turn awry
And lose the name of action.”