Question Bank (Advance Java)
Question Bank (Advance Java)
Question Bank (Advance Java)
ADVANCE JAVA
QUESTION BANK
QUESTION BANK
Unit 1
1 Explain object oriented programming? Write down advantages and characteristics of
OOPS.
7 What is difference between constructors and normal methods? Explain with example
10 What will be the output of the program? Also give the reason.
(i) public class CommandArgs
{
public static void main(String [] args)
{
String s1 = args[1];
String s2 = args[2];
String s3 = args[3];
11 Write a program to determine the sum of the series: 1-1/2+1/3-1/4+..+1/n. (Take value
of n from the user)
12 Write a program to accept number through Command line and display its factorial.
13 Create a class Account with two overloaded constructors. The first constructor is used
for initializing, the name of account holder, the account number and the initial amount in
the account. The second constructor is used for initializing the name of the account
holder, the account number, the addresses, the type of account and the current balance.
The Account class is having methods Deposit (), Withdraw (), and Get_Balance(). Make
the necessary assumption for data members and return types of the methods. Create
objects of Account class and use them.
16 Create a Package ItemPack which includes Class ITEM with ItemCode, ItemName,
rate, quantity as attributes and a method displayItems().Accept the Item details using
Constructor .Also Create an Interface having method calculateAmount() with rate and
quantity as arguments. Create a class, which overrides these methods.
b. Static keyword
d. Object as argument
e. JDBC PreparedStatement
f. Resultset object
3 Write the steps for creating servlet program with example program.
4 What is the use of RequestDispatcher? Explain its methods with suitable example.
5 What are cookies? How to create and use cookies in java servlets?
6 What are the advantages and disadvantages of using cookies? Create an HTML file
AddCookies.html which contains four text boxes .When user enters the values in these
text boxes and press the submit button, the values will be sent to AddCookies.java
servlet and get saved in cookies.
9 Create an HTML form login.html that accepts the username and password and submits
to login.java servlet. Verify credentials and on success, set the username in the HTTP
Session and show a "Welcome <username>" message.
11 Create a Login.html page and verify the user in LoginServlet.java servlet. If the user is
valid then open the EmployeeForm.html otherwise display appropriate message in
Login.html page
17 What are JSP directives? Explain different types of directives with example.
20 Design a StudentBean class with Student details like firstname, lastname and age.
Display the Student details in JSP page using bean tags.
Create a JDBC web application to save registration details into registration table using JSP
22
MVC design pattern.
d) JSP Expressions
f) Page directive
4 What are the steps of creating web application using struts with ActionForm?
What is the role of Action Class? In which method of Action class the business logic is
6
executed? Explain with example.
8 Design a registration.jsp page with input for user registration details like
firstname,lastname,choose username,choose password,confirm password.After
submitting this details, display the details onto the display.jsp page using struts.
9 Write an action class for verifying the correct username and password. If login
successes then open successLogin.jsp and if login fails then open errorpage.jsp.
13 What is Action Mapping? Explain with the help of struts configuration file.
b) Struts tags
e) Struts flow
6 Explain the features of entity bean and also its life cycle.
9 Write a program to insert and fetch employee details using hibernate application.
Create a web application that inserts the user information like username,password,email
13
into user database using hibernate.
14 Create a web application that fetches the Student information from Student database using
hibernate.
d) EJB container
f) Hibernate Framework