Sei sulla pagina 1di 9

Nitte Meenakshi Institute of Technology

(AN AUTONOMOUS INSTITUTION, AFFILIATED TO VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELGAUM) ,


(A Unit of Nitte Education Trust, Mangalore)
PB No. 6429, Yelahanka, Bangalore 560-064, Karnataka, Telephone: 080- 22167860, Fax: 080 – 22167805

Department of Computer Science and Engineering

Question Bank(2016-17)
Semester: 6th Semester CSE Date:21/03/2017
Subject and Code: Application Development using JAVA 14CS61
Name of Faculty : B.A Mohan/ Afroz Pasha/Ramyashree B R/Asst. Prof/ CSE,

Sl Questions Marks (CO,PO’s) Bloom


No ’s
Level
UNIT-1

1 What is meant by instance variable hiding? How to overcome it? 4 (1,3) 1

2 How “compile once and run anywhere” is implemented in JAVA? 5M 4 (1,3) 1

3 Create a Java Class “Shape” with constructor to initialize the one 8 (1,3) 3
parameter “dimension”. Now create three sub classes of Shape with
following methods . 8M
(i) “Circle” with methods to calculate the area and circumference of the
circle with dimension as radius.
(ii) “Square” with methods to calculate the area and length of diagonal of
the square with dimension as length of one side.
(iii) “Sphere” with methods to calculate the volume and surface area of the
sphere with dimension as radius of the sphere.
Write appropriate main method to create object of each class and test every
method.

4 List and explain the JAVA Buzzwords. 8 (1,3) 1,2


5 Give the meaning of “public static void main(String args[])? Explain the 6 (1,3) 1,2
process of compiling and running the JAVA application, with the help of
“Hello World” program
6 Declare a stack class of integers. Demonstrate the use of this class in JAVA 7 (1,3) 3
to push & pop integers from stack object.

7 Illustrate the use of static method in Java with an appropriate example. 5 (1,3) 3
8 Illustrate the concept of inner classes with an example. 6 (1,3) 3
10 Demonstrate the two uses of super in JAVA with example programs 6 (1,3) 3
11 Define a superclass Room with fields; length, breadth and a method area to 8 (1,3) 3
find area of the room .Inherit this superclass members into another class
called BedRoom. The class BedRoom must have a method to find volume of
the Room. Create an object of BedRoom class & invoke the methods area()
and volume() for the object created.
12 What do you mean by method overriding. Give an example where a subclass 5 (1,3) 1,2
overrides display() method of a superclass.
13 Compare and contrast the following 6 (1,3) 1
i)Method overriding and method overloading
ii)abstract and final classes
14 Override area() method of Figure class to find area of a rectangle and area 6 (1,3) 3
of a triangle using run-time polymorphism concept. Figure class has two
fields; a parameterized constructor & an area() function
15 Define an Abstract class figure with an abstract method area () & extend 10 (1,3) 3
this class to find area of a rectangle & a triangle.
16 Implement an abstract class named Person and two subclasses named 10 (1,3) 3
Student and Employee in Java. A person has a name, address, phone
number and e-mail address. A student has a class status (freshman,
sophomore, junior or senior). Define the status as a constant. An employee
has an office, salary and date-hired. Implement the above classes in Java.
Provide Constructors for classes to initialize private variables. Override the
toString method in each class to display the class name and the person’s
name. Write an application to create objects of type Student and Employee
and print the person’s name and the class name of the objects.
17 What is Dynamic method dispatch? Explain with an example program. 6 (1,3) 1,2
18 Declare a class called employee having employee_id and employee_name as 7 (1,3) 3
members. Extend class employee to have a subclass called salary having
designation and monthly_salary as members.
Define following:
- Required constructors
- A method to find and display all details of employees drawing salary
more than Rs. 20000/-.
- Method main for creating an array for storing these details given as
command line arguments and showing usage of above methods
19 Describe the following features of java: 7 (1,3) 1
1)Multithreaded,2)Architecture-neutral 3)Interpreted 4)High performance
5) Distributed 6) Portable 7) Dynamic
20 Explain & illustrate by examples use of final, finally and method finalize. 6 (1,3) 1,3
21 Illustrate by examples the three uses of final keyword in JAVA 6 (1,3) 1,3
22 Declare a class called book having author_name as private data 8 (1,3)
member. Extend book class to have two sub classes called book_publication
& paper_publication.Each of these classes have private member called title.
Write a completeprogram to show usage of dynamic method dispatch
(dynamic polymorphism) to display book or paper publications of given
author.Use command line arguments for inputting data.
Sl UNIT 2 Marks (CO,PO) Bloom’s
No. level
1 Define an interface area and implement this interface to find area of 6 (2,3) 3
a rectangle & a triangle.
2 Give the general syntax for defining and implementing an interface 5 (2,3) 1,3
with an example
3 Declare an Interface Intstack with push() pop() methods. Implement 8 (2,3) 3
this Interface in a Fixedstack class. Create two objects of Fixedstack
class & perform push(),pop operations.
4 Explain interface in JAVA. How do interfaces support 5 (2,3) 1,2
polymorphism?
5 Demonstrates a program that illustrates interface inheritance. 6 (2,3) 3
Interface P is extended by P1and P2. Interface P12 inherits from
both P1 and P2.Each interface declares one constant and one
method. class Q implements P12.Instantiate Q and invoke each of
its methods. Each method displays one of the constants.
6 Differentiate between abstract class and interface. 4 (2,3) 1,2
7 Give general form of the package statement. Give an example 5 (2,3) 1,2
package creation statement.

8 Give general form of a multileveled package statement. What is the 7 (2,3) 1,2
significance of the CLASSPATH environment variable in
creating/using a package?

9 Give the general form of the import statement. Illustrate a Java 6 (2,3) 1,2
program that creates a package and uses it.

10 Define a package called algorithms which contains two sub 7 (2,3) 3


packages for Sorting and Searching. Design a java program for
searching and sorting of ‘N’ integers and place these programs in
sub packages.
11 What are access specifiers? Draw a table showing all the access 6 (2,3) 1,2,3
specifiers and their accessibility in the class, package, subclasses and
other packages.
12 Explain the following terms with respect to exception handling. 6 (2,3) 1,2
i)try ii)catch iii) throw iv)finally
13 Explain Exception handling in JAVA. Write an application that 6 (2,3) 1,2,3
generates custom exception if any value from its command line
arguments is negative.
14 Demonstarte a java program to handle divide-by- zero exception 5 (2,3) 3
Write a java program to catch divide-by-zero and Array out-of- 6 (2,3) 3
bound exceptions.
15 Write a program with nested try statements monitoring different 6 (2,3) 3
types of errors
16 Explain the constructors & methods added to Thread class in 7 (2,3) 1,2,3
JDK1.4 to support chained exceptions. Write a java program
handling chained exceptions where NullPointerException is the
cause of ArithmeticException.
17 Write an application for Bank with instance variables acno, name, 7 (2,3) 3
balance. Instance methods deposit(amt), withdraw(amt). If balance
is less than 500 then throw user defined exception “insufficient
balance”.
18 Define an exception called “NoMatchException” that is thrown 6 (2,3) 3
when a string is not equal to “NMIT”. Develop a JAVA Program
that uses this exception.
19 Distinguish between checked and unchecked exceptions 4 (2,3) 1
20 List any six JAVA’s built –in exceptions and give their meaning 6 (2,3) 1,2
21 Give output of the following program for value of y=0 and y=2: 6 (2,3) 3
public class Test {

public static void main(String args[]) {


try {

System.out.println("calling method a");

a();

System.out.println("return from method a");


} catch(ArithmeticException e) {

System.out.println("main: catch");
} finally {

System.out.println("main: finally");
}
}
public static void a() {
try {
int x=8,y=0;
int z=x/y;
System.out.println("value of z="+z);
} catch(NumberFormatException e) {

System.out.println("method a:catch");
} finally {

System.out.println("method a:finally");
} }}
Sl UNIT 3 Marks (CO,PO) Bloom’s
No. level
1 Distinguish between process-based multitasking & thread-based 4 (3, 2,3) 1
multitasking
2 What is a thread? Describe the complete life cycle of thread with 6 (3, 2,3) 1,2
example.
3 Illustrate the two different ways of creating a thread in JAVA 6 (3, 2,3) 3
4 Design a program to create two threads so one thread will print odd 6 (3, 2,3) 3
numbers where as second thread will print even numbers between 1
to 20 numbers
5 Develop a java program to Create a main thread displaying 5 (3, 2,3) 3
numbers from 1 to 5.Change the name of the main thread to
MyThread & display new thread name, its priority & the name of
its group
6 Demonstrate a JAVA multithreaded program for 6 (3, 2,3) 3
i)isAlive( ) ii)join( )
7 Develop a program to spawn three threads named ‘One’, ’Two’ 7 (3, 2,3) 3
and ‘Three’. Threads display the numbers from 1 to 3. Display the
name, priority & group name of threads
8 Write a java program to demonstrate two threads at different 7 (3, 2,3) 3
priorities. The threads should be started & allowed to run for ten
seconds. Each thread should execute a loop. After 10 seconds the
main thread should stop both threads and should display the
number of times each thread made it through the loop
9 What is meant by ‘race condition’ of threads in java? Illustrate this 8 (3, 2,3) 1,3
with the help of an example. How to overcome race condition?
Modify your code for this
10 Explain Inter-thread communication. How to achieve inter thread 6 (3, 2,3) 1,3
communication in JAVA?
11 Write a java program for synchronized inter-thread communication 8 (3, 2,3) 3
of producer/consumer problem. It has four class :Q, the queue that
need to be synchronized; producer, the threaded object producing
queue entries; consumer, the threaded object consuming queue
entries ; and pc, the class that creates the single queue, producer&
consumer
12 Demonstrate a JAVA multithreaded program for suspending, 6 (3, 2,3) 3
resuming and stopping a thread.

13 Discuss the two types of applet classes with example 4 (4,3) 1


14 Explain the process of c3ompiling and running the JAVA Applet (4,3) 1,3
application, with the help of “Hello World” program using
command prompt.
15 Give the skeleton of an AWT-based applet & explain each method 8 (4,3) 2,3
in the skeleton. Design a simple applet that sets the foreground and
background color & outputs a string.
16 Compare architecture of an applet with a console-based program 4 (4,3) 1
17 Design a simple banner Applet that scrolls a message from right to 7 (4,3) 3
left, across the applet’s window.
18 Explain the syntax of HTML APPLET tag in detail. Design an 8 (4,3) 1,2,3
applet to display a text in applet window as well as a text in the
status window.
19 Design a parameterized applet to display the following parameters 10 (4,3) 3
in applet window.
Fontname : Courier
Fontsize : 14
Leading: 2.0
AcountActive : true
20 Design an applet to display its code base and Document Base. 6 (4,3) 2,3
Explain its working.
21 Discuss the life cycle of an applet with a program example 6 (4,3) 1,3
Sl UNIT 4 Marks (CO,PO) Bloom’s
No. level
1 Explain the event delegate model. 5 (3, 2,3) 1,2
2 Design an applet to demonstrate the mouse event handlers 8 (3, 2,3) 3
implementing the appropriate Event listener interfaces.
3 Design an applet to demonstrate key event handlers implementing 6 (3, 2,3) 3
the appropriate Event Listener interfaces.
4 Design an applet to implement key Listener interface to handle 8 (3, 2,3) 3
special keys such as arrow or function keys.
5 Design an applet that displays a message in the status bar of an 7 (3, 2,3) 3
applet viewer or browser when the mouse is clicked or dragged by
extending MouseAdapter and MouseMotion Adapter classes
6 Explain the following event classes 6 (3, 2,3) 1,2
i)ActionEvent ii)AdjustmentEvent
7 Enlist the different methods in Windows Listener. What is the use 6 (3, 2,3) 1,2
of WindowAdapter?
8 How inner class can simplify the code when using event adapter 7 (3, 2,3) 1,2,3
classes? Illustrate with an example.
9 Briefly explain the role of 8 (3, 2,3) 1,2
i)Event Classes ii)Sources of events iii)Adapter classes iv)Event
listeners
10 Discuss the different types of Event Listener interfaces 10 (3, 2,3) 1,2
11 Expalin any four Event classes 8 (3, 2,3) 1
12 What are the two key features of Swing that makes it different from 5 (4,3) 1,2
AWT? Explain.
13 What do you mean by Model-Delegate Architecture of Swing? 6 (4,3) 1,2
Compare this architecture with MVC Architecture.
14 Design a simple Swing application that uses Swing components 5 (4,3) 3
JFrame and JLabel
15 Design a simple Swing application to handle the events generated by 6 (4,3) 3
Swing push buttons
16 Design a Swing-based Applet containing two push buttons named 8 (4,3) 3
“Alpha” and “Beta” and a Label displaying the message when a
button is pressed
17 How JLabel component can be used to display text and/or an icon? 6 (4,3) 3
Illustrate the concept by designing an applet to display a label
containing both an icon and a string
18 Demonstrate handling of action event generated by a icon-based 7 (4,3) 3
button through an Applet. The GUI should contain four push
buttons and a label. Each button should display an icon. When any
button is pressed the name of the icon should be displayed in the
label.
19 Illustrate the use of JToggleButton by designing an Applet-based 6 (4,3) 3
GUI
20 Design a Swing-based applet that contains four check buttons 8 (4,3) 3
named “C”, “JAVA”, “C”, “PERL” and a label. When the user
selects a check box display the message in the label
21 Which of the Swing buttons represents a group of mutually 7 (4,3) 1,2,3
exclusive buttons? Demonstrate its use by creating a group of three
buttons.
22 Design a GUI containing a tabbed pane. The first tab is titled 8 (4,3) 3
“Cities” and contains four buttons. Each button displays name of a
city. The second tab is titled “Colors” and contains three check
boxes. Each check box the name of a color. The third tab is titled
“Flavors” and contains one combo box. This enables the user to
select one of the three flavours
23 Design a Scroll pane with a JPanel object containing 400 buttons 5 (4,3) 3
arranged into 20 columns.
24 Implement an Applet that holds a list of cities. Each time a city is 7 (4,3) 3
selected in the list, city name should be displayed in a label. Also
explain the components and methods used in the design.
25 Design an Applet with a Combo Box that contains entries for 7 (4,3) 3
“France”, “Germany”, “Italy” and “Japan”. When a country is
selected, an icon-based label should be updated to display the flag
for that country.
26 What are the steps required to set up a table that can be used to 6 (4,3) 3
display data? Explain the classes and methods used for the same.
27 Write a program to create a Table with the column heading 8 (4,3) 3
“Fname”, “Lname” and “Age” and insert at least five records in the
table and display.
28 Write a program to create an applet with four buttons labelled with 6 (4,3) 3
your four favourite colors. When a button is clicked the background
must change to corresponding color.
Sl UNIT 5 Marks (CO,PO) Bloom’s
No. level
1 What are the advantages/Design Goals of Collection Framework. 4 (5, 2,3) 1,2
2 Discuss the core methods that all collections will support. 6 (5, 2,3) 1,2
3 Bring out the differences between list interface and set interface. 4 (5, 2,3) 1
4 Develop a program to create ArrayList for objects of type String 6 (5, 2,3) 3
and demonstrate methods for adding and removing objects from the
ArrayList.
5 Develop a program to convert from ArrayList to Array. 6 (5, 2,3) 3
6 What is the use of void ensureCapacity(int cap) and void 6 (5, 2,3) 1,2
trimToSize( )?
7 Develop a program to demonstrate the methods supported by 8 (5, 2,3) 3
LinkedList.
8 Write the steps for using iterator in programs. 6 (5, 2,3) 2
9 What is the difference between iterator and ListIterator? Also 6 (5, 2,3) 1,2
specify methods unique to list iterator.
10 Develop a program to demonstrate iterator for printing list of 8 (5, 2,3) 3
elements.
11 Explain different methods supported by the iterators. 6 (5, 2,3) 1,2
12 Write the steps for connecting to database using jdbc. 8 (5, 2,3) 1,2,3
13 Develop a Java Program to implement Client Server (Client 8 (5, 2,3) 3
requests a file, Server responds to client with contents of that file
which is then displayed on the screen by Client - Socket
Programming)
14 Explain the 4 JDBC drivers. 6 (5, 2,3) 3
15 What is the difference between statement and preparedstatement. 5 (5, 2,3) 1,2
16 List and explain different methods of ResultSet Interface. 4 (5, 2,3) 1,2,3
17 Write and explain code segments to; connect to the DBMS, create & 6 (5, 2,3) 1,2
execute SQL statement and process the data returned by DBMS.
18 Develop a code segment to execute the query SELECT FirstName, 6 (5, 2,3) 3
LastName FROM Customers and display the records fetched using
a scrollable virtual cursor
19 Develop a code snippet to execute a transaction consisting of at least 8 (5, 2,3) 3
two SQL statements.
20 Explain the life cycle of a Servlet. What are the types of servlets. 8 (5, 2,3) 1,2,3
21 Design a Servlet program to demonstrate doGet() and doPost() 6 (5, 2,3) 3
methods
22 Design a Java Servlet Program to implement a Dynamic HTML 8 (5, 2,3) 3
using Servlet (user name and password should be accepted using
HTML and displayed using a Servlet)

Potrebbero piacerti anche