Chapter |
Chapter Name & Questions |
GTU Exam |
Marks |
|
1 |
The History and Evolution of Java |
|
|
|
|
|
|
|
|
May/Jun-12 |
7 |
|
|
|
|
2 |
An Overview of Java |
|
|
|
|
|
|
|
- Define polymorphism with its need. Define and explain static and dynamic binding using program.
|
Dec-10 |
7 |
|
|
|
|
|
- Define polymorphism with its need. Define and explain static and dynamic binding using program.
|
Jan-13 |
7 |
3 |
Data Types, Variables, and Arrays |
|
|
|
|
|
|
|
|
Nov/Dec-11 |
2 |
|
|
|
|
4 |
Operators |
|
|
|
|
|
|
|
- Explain short circuited operators and shift operators.
|
Jun-11 |
7 |
|
|
|
|
|
- Explain short circuited operators, shift operators and this reference.
|
May-13 |
7 |
5 |
Control Statements |
|
|
|
|
|
|
6 |
Introducing Classes |
|
|
|
|
|
|
|
- Differentiate between constructor and method of class. Define method overloading and its purpose. Write a program to demonstrate the constructor overloading.
|
Dec-11, May/June-12 |
7 |
|
|
|
|
|
- Explain this reference, key word static and garbagecollection.
|
Jun-11 |
7 |
|
|
|
|
|
- Explain Java garbage collection mechanism.
|
Nov/Dec-11 |
4 |
|
|
|
|
|
|
Nov/Dec-11 |
3 |
|
|
|
|
|
|
Nov/Dec-11 |
2 |
|
|
|
|
7 |
A Closer Look at Methods and Classes |
|
|
|
|
|
|
|
- Define and write a program to differentiate betweenpass by value and pass by reference.
|
Dec-10 |
7 |
|
|
|
|
|
- Explain method overriding and method overloading with the help of examples
|
Jun-11 |
7 |
|
|
|
|
|
|
Jun-11 |
3 |
|
|
|
|
|
- Explain inner class and working of concatenation operator + by giving examples.
|
Jun-11 |
7 |
|
|
|
|
|
- Design a class named Fan to represent a fan. The class contains:- Three constants named SLOW, MEDIUM and FAST with values 1,2 and 3 to
denote the fan speed.
– An int data field named speed that specifies the speed of the fan (default
SLOW).
– A boolean data field named f_on that specifies whether the fan is on(default
false).
– A double data field named radius that specifies the radius of the fan (default
4).
– A data field named color that specifies the colorof the fan (default blue).
– A no-arg constructor that creates a default fan.
– A parameterized constructor initializes the fan objects to given values.
– A method named display() will display descriptionfor the fan. If the fan is on, the display() method displays speed, color and radius. If the fan is not on, the method returns fan color and radius along with the message “fan is off”. Write a test program that creates two Fan objects. One with default values and the other with medium speed, radius 6, color brown,and turned on status true. Display the descriptions for two created Fan objects.
|
Nov/Dec-11 |
7 |
|
|
|
|
|
- Define the Rectangle class that contains:Two double fields x and y that specify the center of the rectangle, the data field
width and height , A no-arg constructor that creates the default rectangle with (0,0) for (x,y) and 1 for both width and height. A parameterized constructor creates a rectangle with the specified x,y,height and width.
A method getArea() that returns the area of the rectangle.
A method getPerimeter() that returns the perimeter of the rectangle.
A method contains(double x, double y) that returns true if the specified point
(x,y) is inside this rectangle.
Write a test program that creates two rectangle objects. One with default values
and other with user specified values. Test all the methods of the class for both
the objects.
|
Nov/Dec-11 |
7 |
|
|
|
|
|
- Give output of the following program:public class Test {
public static void main(String args[]) {
Count myCount = new Count();
int times=0;
for(int i=0;i<100;i++)
increment(myCount,times);
System.out.println(“count is “+myCount.count);
System.out.println(“times is “+times);
}
public static void increment(Count c,int times) {
c.count++;
times++;
}
}
class Count {
public int count;
Count(int c){ count=c; }
Count(){ count=1; }
}
|
Nov/Dec-11 |
3 |
|
|
|
|
|
- It is required to compute SPI (semester performance index) of n students of your college for their registered subjects in a semester. Declare a class called student having following data members: id_no , no_of_subjects_registered, subject_code , subject_credits, grade_obtained and spi. – Define constructor and calculate_spi methods. – Define main to instantiate an array for objects of class student to process data of n students to be given as command line arguments.
|
May-13 |
7 |
|
- (i) JVM is platform dependent. Justify. (ii) There is no destructor in Java. Justify.
|
May-13 |
7 |
8 |
Inheritance |
|
|
|
|
|
|
|
- Explain single level and multiple inheritances in java. Write a program to demonstrate combination of both types of inheritance as shown in figure 1. i.e.hybrid inheritance
|
Dec-10 |
7 |
|
|
|
|
|
- Write a program to demonstrate the multipath inheritance for the classes having relations as shown in figure 2. A->(B,C)->D
|
Dec-10 |
7 |
|
|
|
|
|
- Differentiate between abstract class and interface specifying matrices of differences. Write a program to define abstract class, with two methods addition() and subtraction(). addition() is abstract method. Implement the abstract method and call that method using a program(s).
|
Dec-10 |
7 |
|
|
|
|
|
- Explain final and super by giving examples.
|
Jun-11 |
7 |
|
|
|
|
|
- Declare a class called employee having employee_id and employee_name as 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.
|
Jun-11 |
7 |
|
|
|
|
|
- Explain method overriding and method overloading with the help of examples
|
Dec-11, May/June-12 |
7 |
|
|
|
|
|
- Describe abstractclass called Shapewhich has three subclasses say Triangle,Rectangle,Circle. Define one method area() in the abstract class and override this area()in these three subclasses to calculate for specific object i.e. area() of Triangle subclass should calculate area of triangle etc. Same for Rectangleand Circle
|
May/Jun-12 |
7 |
|
|
|
|
|
- Explain the followings:(i) Dynamic Method Dispatch with example
(ii) this, super, final
|
Nov/Dec-11 |
|
|
|
|
|
|
- State whether the following statements are true or false:(i) The elements in an array must be of primitive data types.
(ii) When invoking a constructor from a subclass, its super class’s no-arg
constructor is always invoked.
(iii) A protected data or method can be accessed by any class in the same
package.
(iv) A method can change the length of an array passed as a parameter.
|
Nov/Dec-11 |
4 |
|
|
|
|
|
- State whether the following statements are true or false:(i) An abstract class contains constructors.
|
Nov/Dec-11 |
1 |
|
- Explain Cosmic superclass and its methods
|
Nov/Dec-11 |
2 |
|
|
|
|
|
- The abstract Vegetable class has three subclasses named Potato, Brinjal andTomato. Write an application that demonstrates how to establish this class
hierarchy. Declare one instance variable of type String that indicates the color of
a vegetable. Create and display instances of these objects. Override the
toString() method of Object to return a string withthe name of the vegetable
and its color.
|
Nov/Dec-11 |
7 |
|
|
|
|
|
- The abstract Vegetable class has three subclasses named Potato, Brinjal andTomato. Write an application that demonstrates how to establish this class
hierarchy. Declare one instance variable of type String that indicates the color of
a vegetable. Create and display instances of these objects. Override the
toString() method of Object to return a string withthe name of the vegetable
and its color.
|
Jan-13 |
7 |
|
-
The Transport interface declares a deliver () method. The abstract class Animal is the super class of the Tiger, Camel, Deer and Donkey classes. The Transport interface is implemented by the Camel and Donkey classes. Write a test program that initialize an array of four Animal objects. If the object implements the Transport interface, the deliver () method is invoked.
|
Jan-13 |
7 |
|
- List OOP characteristics and describe inheritance with examples.
|
May-13 |
7 |
|
- Declare a class called book having author_name as private data 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 complete program 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.
|
May-13 |
7 |
|
- Explain super, instanceof and volatile.
|
May-13 |
7 |
9 |
Packages and Interfaces |
|
|
|
|
|
|
|
- Explain package and interface by giving examples.
|
Jun-11 |
7 |
|
|
|
|
|
- Explain interface in JAVA. How do interfaces support polymorphism?
|
May/Jun-12 |
7 |
|
|
|
|
|
- Write a program that illustrates interface inheritance. Interface P is extended by P1 and P2. Interface P12inherits 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
|
May/Jun-12 |
7 |
|
|
|
|
|
- Explain package in java. List out all packages withshort description
|
May/Jun-12 |
7 |
|
|
|
|
|
- State whether the following statements are true or false:(i) An interface can extend an abstract class.
|
Nov/Dec-11 |
1 |
|
|
|
|
|
- The Transport interface declares a deliver() method. The abstract class Animalis the superclass of the Tiger, Camel, Deer and Donkey classes. The Transport
interface is implemented by the Camel and Donkey classes. Write a test
program that initialize an array of four Animal objects. If the object implements
the Transport interface, the deliver() method is invoked.
|
Nov/Dec-11 |
7 |
|
|
|
|
|
- Explain packages, their use, adapter classes and their needs & applications. Give examples.
|
May-13 |
4 |
|
- Explain interface and its usage.
|
May-13 |
4 |
10 |
Exception Handling |
|
|
|
|
|
|
|
- Explain the importance of Exception handling in java. Write a program to handle NoSuchMethodException, ArrayIndexOutofBoundsException using try-catch-finally and throw.
|
Dec-10 |
7 |
|
|
|
|
|
- Enlist and explain the difference between error andexception. Write a program to handle InterruptedException, IllegalArgumentException using try-cat-finally and throw.
|
Dec-10 |
7 |
|
|
|
|
|
- Write a method for computing x^y by doing repetitive multiplication. x and y are of type integer and are to be given as command line arguments. Raise and handle exception(s) for invalid values of x and y. Also define method main. Use finally in above program and explain its usage.
|
Jun-11 |
7 |
|
|
|
|
|
- Explain Exception handling in JAVA. Write an application that generates custom exception if any value from its command linearguments is negative.
|
May/Jun 12 |
7 |
|
|
|
|
|
|
Nov/Dec-11 |
6 |
|
|
|
|
|
- Explain interprocess communication mechanism (wait(), notify() andnotifyall()) being used by java to avoid polling.
|
Nov/Dec-11 |
4 |
|
|
|
|
|
- State whether the following statements are true or false:(i) The catch block is the preferred means for releasing resources to prevent resource leaks.
|
Nov/Dec-11 |
1 |
|
|
|
|
|
- (ii) Give output of the following program for valueof y=0 and y=2: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”);
} }}
|
Nov/Dec-11 |
4 |
|
|
|
|
|
-
What is the use following java keywords
super, transient, finally, final, static, throw, throws
|
Jan-13 |
7 |
|
- Explain exception handling in JAVA. Write a program that generates custom exception if any integer value given from its command line arguments is negative.
|
Jan-13 |
7 |
|
- Explain the importance of exception handling in java. Which key words are used to handle exceptions? Write a program to explain the use of these keywords.
|
Jan-13 |
7 |
|
- Explain & illustrate by examples use of final, finally and method finalize.
|
May-13 |
7 |
|
- Declare a class called coordinate to represent 3 dimensional Cartesian coordinates( x, y and z). Define following methods: – constructor – display, to print values of members – add_coordinates, to add three such coordinate objects to produce a resultant coordinate object. Generate and handle exception if x, y and z coordinates of the result are zero. – main, to show use of above methods.
|
May-13 |
7 |
11 |
Multithreaded Programming |
|
|
|
|
|
|
|
- Write a program of writing binary file using multithreading. Demonstrate use of join() and yield() interrupt().
|
Dec-10 |
7 |
|
|
|
|
|
- Explain: wait, sleep and synchronize
|
Jun-11 |
7 |
|
|
|
|
|
- Write a complete multi-threaded program to meet following requirements:- Read matrix [A] m x n
– Create m number of threads
– Each thread computes summation of elements of one row, i.e. i throw of the matrix is processed by i th thread. Where 0 <= i < m.
– Print the results.
|
Jun-11 |
7 |
|
|
|
|
|
- It is required to have total two threads, both capable of acting as a produce as well as a consumer. If first thread acts as a producer then, the second thread becomes the consumer and vice-versa. They communicate with each other through a buffer, storing one integer number. One of the threads initiates the communication by sending 1 to the other thread. Thesecond thread, on receiving 1 sends 2 to the first thread. On receiving 2, the first thread sends three integer numbers, one by one to the second thread. The second thread consumes the numbers by displaying them. Both threads terminate after that. Note that both threads must be capable of initiating the communication. Write complete multi-threaded program to meet aboverequirements.
|
Jun-11 |
7 |
|
|
|
|
|
- Why synchronization is required in multithreaded programming and how can we implement it in program?
|
May/Jun-12 |
7 |
|
|
|
|
|
- Explain Thread Life Cycle in detail. Write a code to create Thread in JAVA.
|
May/Jun-12 |
7 |
|
|
|
|
|
- Explain the life cycle of a thread.
|
Nov/Dec-1 |
4 |
|
|
|
|
|
|
Jan-13 |
7 |
|
- Why synchronization is required in multithreaded programming. Write a program that uses thread synchronization to guarantee data integrity in a multithreaded application.
|
Jan-13 |
7 |
|
- Write a complete multi-threaded program to meet following requirements: o Two threads of same type are to be instantiated in the method main. o Each thread acts as a producer as well as a consumer. o A shared buffer can store only one integer information along with the source & destination of the information at a time. o The information produced is to be consumed by appropriate consumer. o Both producers produce information for both consumers. o Each thread produces 5 information.
|
May-13 |
7 |
|
- It is required to add two MxN sized matrices having integer elements to produce a third resultant matrix of size MxN. Write a complete multi-threaded program to meet following requirements: – Accept all required arguments from the command line. – Instantiate M threads – with id 0 to M -1 respectively, each thread performing addition of elements on the row specified by its id to produce corresponding row of the resultant matrix.
|
May-13 |
7 |
|
- Explain wait, notify, synchronized and native methods.
|
May-13 |
7 |
14 |
Generics |
|
|
|
|
|
|
|
- Define generics in java. Write a program to demonstrate generic interface and generic method.
|
Dec-10 |
7 |
|
|
|
|
|
- Define generics in java. Write a program to demonstrate generic class and generic constructor.
|
Dec-10 |
7 |
|
|
|
|
|
- Explain Generics in java with demo program.
|
May/Jun-12 |
7 |
|
|
|
|
|
- What are the benefits of using generic types?
|
Nov/Dec-11 |
2 |
|
|
|
|
|
- Illustrate by example – generic programming.
|
May-13 |
4 |
15 |
String Handling |
|
|
|
|
|
|
|
- Differentiate String class and StringBuffer class with explanation of its methods.
|
May/Jun-12 |
7 |
|
|
|
|
17 |
java Collection Framework |
|
|
|
|
|
|
|
- Write a program to add (keyword, URL) list for a web crawler in suitable data structure in concurrent manner but one processat a time, and retrieving data from the data structure in concurrent manner.
|
Dec-10 |
7 |
|
|
|
|
|
- Explain utility class Hashtable and instanceof operator by giving examples.
|
Jun-11 |
7 |
|
|
|
|
|
|
Nov/Dec-11 |
1 |
|
|
Nov/Dec-11 |
4 |
|
|
|
|
|
|
Jan-13 |
7 |
|
- i) What are generics and how are they used? ii) Differentiate between Enumeration and Iterator.
|
Jan-13 |
7 |
|
- Eplain: utility class Hashtable with example.
|
May-13 |
7 |
19 |
Input/Output: Exploring java |
|
|
|
|
|
|
|
- Write a program to create directories (/home/abc/bcd/def/ghi/jkl) in the home directory /home/abc and list the files and directories showing file/directory, file size. Read-write-execute permissions. Write destructor to destroy the data of a class.
|
Dec-10 |
7 |
|
|
|
|
|
- Write a program to replace all “word1” by “word2” from a file1, and output is written to file2 file and display the no. of replacement.
|
Dec-10 |
7 |
|
|
|
|
|
- Write a program to replace all “word1” by “word2” to a file without using temporary file and display the no. of replacement.
|
Dec-10 |
7 |
|
|
|
|
|
- Explain File constructors, any two methods of classFile and method seek.
|
Jun-11 |
7 |
|
|
|
|
|
- Write a program using BufferedInputStream, FileInputStream, BufferedOutputStream, FileOutputStream to copy Content of one file File1.txtinto another file File2.txt.
|
May/Jun-12 |
7 |
|
|
|
|
|
- Write a program to display the bytes of a file in reverse sequence. Provide the name of the file as a command line argument. (Use RandomAccessFile)
|
May/Jun-12 |
7 |
|
|
|
|
|
- Write a program that takes input for filename and search word from command-line arguments and checks whether that file exists or not. If exists, the programwill display those lines from a file that contains given search word.
|
Nov/Dec-11 |
7 |
|
|
|
|
|
- Write a program that counts the no. of words in a text file. The file name is
passed as a command line argument. The program should check whether the fileexists or not. The words in the file are separated by white space characters
|
Nov/Dec-11 |
7 |
|
|
|
|
|
- Write a program to check that whether the name given from command line is file or not? If it is a file then print the size of file and if it is directory then it should display the name of all files in it.
|
Jan-13 |
7 |
|
- Write a program that counts the no. of words in a text file. The file name is passed as a command line argument. The program should check whether the file exists or not. The words in the file are separated by white space characters.
|
Jan-13 |
7 |
|
- Compare byte streams and character streams.
|
May-13 |
4 |
20 |
Networking |
|
|
|
|
|
|
|
|
|
|
21 |
The Applet Class |
|
|
|
|
|
|
|
- Explain various methods called during execution cycle of the applet. Also explain boarder layout.
|
Jun-11 |
7 |
|
|
|
|
|
- Differentiate Applet and Application.
|
May/Jun-12 |
7 |
|
|
|
|
|
- Write an applet that contains three buttons OK,CANCEL and HELP and one textfield. if OK is pressed shown on the status bar-“OK is pressed” and the text field should turn red. When CANCEL is pressed -shown on the status bar-“ CANCEL is pressed “and text field should turn green. When HELP is pressed- shown on the status bar-“HELP is pressed” and the text field should turn yellow.
|
May/Jun-12 |
7 |
|
|
|
|
|
- Explain Applet life cycle with demo program.
|
May/Jun-12 |
7 |
|
|
|
|
|
- Which methods are called by an applet viewer orbrowser during the lifetime
of an applet? When are they invoked?
|
Nov/Dec-11 |
4 |
|
|
|
|
|
- Differentiate Applet and Application.
|
Nov/Dec-11 |
2 |
|
|
|
|
|
- Write an applet that draws four horizontal bars of equal size & of different
colors such that they cover up the whole applet area. The applet should operate
correctly even if it is resized.
|
Nov/Dec-11 |
7 |
|
|
|
|
|
- Write an applet that tracks the position of the mouse when it is dragged or
moved. At the current mouse position, it displays message (x, y) showing
current position of the mouse. The message should disappear as soon as the user
releases the mouse.
|
Nov/Dec-11 |
7 |
|
|
|
|
|
- Differentiate the followings:
i) Applet and Application ii) String class and StringBuffer class iii) Constructor and Method
|
Jan-13 |
7 |
|
- Write an applet that draws four horizontal bars of equal size & of different colors such that they cover up the whole applet area. The applet should operate correctly even if it is resized.
|
Jan-13 |
7 |
|
- Write a complete GUI based program to implement a queue of strings in an applet. Select components and layout of your choice.
|
May-13 |
7 |
|
- Explain life cycle of an applet. Also illustrate how to provide parameters to applet through html.
|
May-13 |
7 |
22 |
Event Handling |
|
|
|
|
|
|
|
- Write an event handling program to handle e-mail sending form using your creativity.
|
Dec-10 |
7 |
|
|
|
|
|
- Write an event handling program to handle feedback form of GTU examination system using your creativity.
|
Dec-10 |
7 |
|
|
|
|
|
- Write a program to create a frame with exit capabilities. Handle events for mouse pressed, mouse released, mouse clicked and mouse dragged by displaying appropriate message describing the eventat the coordinates where the event has taken place.
|
Jun-11 |
7 |
|
|
|
|
|
- Explain event handling and different event types ofJava.
|
Jun-11 |
7 |
|
|
|
|
|
- Write a complete program to create a frame for providing GUI to implement a stack for storing integer numbers. There are twobuttons called PUSH & POP and a text field. Clicking of button PUSH pushes the number entered in the text field onto the stack. The click of button POP pops an element from the stack and displays that in the text field.
|
Jun-11 |
7 |
|
|
|
|
|
- Write an applet that contains three buttons OK,CANCEL and HELP and one textfield. if OK is pressed shown on the status bar-“OK is pressed” and the text field should turn red. When CANCEL is pressed -shown on the status bar-“ CANCEL is pressed “and text field should turn green. When HELP is pressed- shown on the status bar-“HELP is pressed” and the text field should turn yellow.
|
May/Jun-12 |
7 |
|
|
|
|
|
- Explain Event Handling in java and describe methodsof mouse event and key event.
|
May/Jun-12 |
7 |
|
|
|
|
|
- What is an event source? What are the three responsibilities of eventsources?
|
Nov/Dec-11 |
4 |
|
|
|
|
|
|
Jan-13 |
7 |
|
- (a) i) Explain the life cycle of an applet ii) How the concept of adapter classes is used in event handling?
|
Jan-13 |
7 |
23 |
Introducing the AWT: Working with Windows, Graphics |
|
|
|
|
|
|
|
- Write a program to create a frame with exit capabilities. Handle events for mouse pressed, mouse released, mouse clicked and mouse dragged by displaying appropriate message describing the eventat the coordinates where the event has taken place.
|
Jun-11 |
7 |
|
|
|
|
|
- Write a complete program to create a frame for providing GUI to implement a stack for storing integer numbers. There are twobuttons called PUSH & POP and a text field. Clicking of button PUSH pushes the number entered in the text field onto the stack. The click of button POP pops an element from the stack and displays that in the text field.
|
Jun-11 |
7 |
|
|
|
|
|
- Write a complete program to create a frame for providing GUI to implement a stack for storing integer numbers. There are two buttons called PUSH & POP and a text field. Clicking of button PUSH pushes the number entered in the text field onto the stack. The click of button POP pops an element from the stack and displays that in the text field.
|
Jan-13 |
7 |
|
- Write a complete program to have a GUI based simple calculator in a frame supporting addition & subtraction. There are buttons for 0 to 9 digits and for arithmetic operations. Select layout of your choice.
|
May-13 |
7 |
24 |
Using AWT Controls, Layout Managers, and Menus |
|
|
|
|
|
|
|
- Name three types of layout managers and briefly explain their operations.
|
Nov/Dec-11 |
4 |
|
|
|
|
|
|
May-13 |
4 |
28 |
Java Beans |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
Introducing Swing |
|
|
Thank you sir
This is very useful site for all the student
Again Thannk you for help
Was this answer helpful?
LikeDislike