Why do we need to synchronize the thread? Justify with an example. An array with an odd number of elements is said to be centered if all elements (except the middle one) are strictly greater than the value of the middle element. Note that only arrays with an odd number of elements have a middle element. Write a function that accepts an integer array and returns 1 if it is a centered array, otherwise it returns 0?
How does JSP differ with Servlet and show the life cycle of Servlet? How do you create and read the cookies and session using JSP? Illustrate with an example.
Describe any two types of layout manager. Using swing components design a form with three buttons with captions "RED", "BLUE" and "GREEN" respectively. Then write a program to handle the event such that when the user click the button, the color of that button will be the same as its caption.
Attempt any Eight questions
[8x5=40]List the steps to create RMI application. Differentiate between RMI and CORBA.
Write a JavaFX application with components, buttons, textfields and labels, arranged in a VBox or HBox layout.
Assume a table MOVIE(id, title, genre). Now using JDBC, perform the following queries.
a. Add any three records to the MOVIE table.
b. Using prepared statement, update the genre to "Comedy" having title "Jatra"
When do we need internal frame? How do you create table using swing?
What do you mean by JSP implicit objects? Discuss about Java Mail API.
Describe the role of Result Sets. What is wrong in the following code?
public class Point
{
int p;
public void setP(int p)
{
p = p;
}
}
Write a TCP client - server system in which the client program sends two integers to a server program which returns the greatest among them.
Suppose that 9 integers are written in a file named "magic.txt" in the arrangement of 3 x 3 separated by space in. Write a program, whether the integers in all rows, all columns and both diagonals sum to the same constant or not.
Write a program to create a menu named "File" with menu items "New", "Save" and "Exit".