1. Write a Java program to find the maximum and minimum value of a 1-d array.
2. Write a Java program without using a second array to reverse elements of each row of a 2-d array of integer values.
e.g. 1 2 3 4 4 3 2 1
5 6 7 8 è 8 7 6 5
9 10 11 12 12 11 10 9
3. Write a java program to print the Pascal’s Triangle using a 2-d array.
4. Write a Java program to convert an array to an ArrayList, and an ArrayList to an array.
5. Write a Java program to arrange the elements of a given array of integers where all negative integers appear before all the positive integers.
ii) Write an SQL query that returns the titles of articles authored by 'Robert Tarjan'.
b) Consider the relations Authors(auID,name) and Authoring(articleID,authorID), containing
information on names of authors, and who is authoring which papers, respectively.
i) Write an SQL query that returns for each article, its ID, title and the number of authors.
ii) Write an SQL query that returns the titles of articles authored by 'Robert Tarjan'.
iii) Write an SQL query that returns the number of co-authors of 'Robert Tarjan'. (I.e., the number of
authors who have written at least one article together with him.)
b) Consider the relations Authors(auID,name) and Authoring(articleID,authorID), containing
information on names of authors, and who is authoring which papers, respectively.
i) Write an SQL query that returns for each article, its ID, title and the number of authors.
ii) Write an SQL query that returns the titles of articles authored by 'Robert Tarjan'.
iii) Write an SQL query that returns the number of co-authors of 'Robert Tarjan'. (I.e., the number of
authors who have written at least one article together with him.)
#Write a program using two-dimensional arrays that lists the odd numbers and even numbers separately in a given 12 input values.
Sample input/ output dialogue:
enter twelve numbers
13 15 20 13 35 40 16 18 20 18 20 19
odds
13 15 13 35 19
Even
20 40 16 18 20 18 20
A Pythagorean Triplets is a set of three integers a, b, c such that a2+b2=C2. In the given limit L. Find the number of Pythagorean Triplets R that can be formed (such that a<b<c).
Create a class called time that has separate int member data for hours, minutes, and
seconds. One constructor should initialize this data to 0, and another should initialize it
to fixed values. Another member function should display it, in 11:59:59 format. The final
member function should add two objects of type time passed as arguments. A main() program should create two initialized time objects (should they be const?) and one that isn’t initialized. Then it should add the two initialized values together, leaving the result in the third time variable. Finally it should display the value of this third variable. Make appropriate member functions const.
Implement your own version of the priority queue data structure using java with OOPs principles mentioned functionalities: enqueue, Dequeue (highest priority), peek(highest priority), contains, size, center, sort reverse, iterator, traverse/print.
Use of similar data structures already present in the language/framework is not allowed.
Implement your own version of queue data structure using java with OOPs principles mentioned functionalities: enqueue, Dequeue , peek, contains, size, center, sort reverse, iterator, traverse/print.
Use of similar data structures already present in the language/framework is not allowed.
Area and Perimeter of square
you are given a side of square as input.Write a program to find the perimeter and area of square.
input
the input is an integer representing the length of the side of the square
output
the first line of the output should contain area of the square, and the second line of the output should contain the perimeter of the square as per the format shown in the sample output.
explanation
given the length of the side is 2 .
as the area of square is side*side and perimeter of the square is 4*side
the output should be
area of the square is : 4
perimeter of the square is : 8
sample input 1
3
sample output 1
area of the square is : 9
perimeter of the square is : 12
sample input 2
4
sample output 2
area of the square is : 16
perimeter of the square is : 16