Introduction to Java Programming Language
Instructions:
- The marks are indicated in the right-hand margin.
- There are NINE questions in this paper.
- Attempt FIVE questions in all.
- Question No. 1 is compulsory.
Which component makes Java bytecode executable on a particular operating system?
A constructor is automatically invoked when
Which statement terminates the current iteration of a loop and proceeds with the next iteration?
Which keyword refers to the current object?
Runtime polymorphism in Java is primarily achieved through
Which keyword explicitly generates an exception?
Event handling in Java commonly follows the
JDBC is primarily used for
AWT stands for
Which JDBC driver type is commonly called the thin driver?
Compare Java and C++ with respect to memory management, pointers, inheritance, platform independence, exception handling and object-oriented features. Identify the design choices that make Java different from C++.
A Java program is required to run on different operating systems without recompilation of the source code. Analyse the role of bytecode, JVM and JDK in achieving Java's platform-independent execution model.
Analyse Java's primitive data types and type conversion mechanisms. Construct suitable examples showing implicit widening and explicit narrowing conversion, including one case where data loss occurs.
Construct a Java program that prints a triangular pattern of numbers and analyse how the for loop controls the number of rows and columns.
Consider given code segment
“int a = 5;
int b = 2;
System.out.println(a++ + ++b * a);”
Determine the value printed by the program and show the evaluation sequence according to Java's operator and increment rules.A student record system stores marks of 50 students in an array. Construct a Java program to calculate the highest, lowest and average marks and analyse the time complexity of the operations.
Consider given code segment
“String s1 = "Java";
String s2 = new String("Java");”
Analyse the results of:
s1 == s2
s1.equals(s2)Construct overloaded methods for calculating the area of a circle, rectangle and triangle. Analyse how Java selects the appropriate method based on the parameter list.
In Java, subclass needs to invoke a constructor and method of its superclass. Construct a suitable program using super and analyse the order in which superclass and subclass constructors execute.
Compare checked and unchecked exceptions using suitable examples. Analyse how the compiler treats each category and discuss appropriate handling strategies.
Construct a thread life-cycle diagram showing the major states through which a Java thread can pass. Analyse transitions caused by start(), scheduling, waiting and termination.
A Java application creates several threads having different priorities. Analyse how thread priority is assigned and discuss why priority alone should not be treated as a guarantee of execution order.
Compare the four types of JDBC drivers with respect to architecture, dependence on native libraries, portability and typical use.
Construct an AWT application containing a frame, label, text field and button. Develop an event-handling mechanism that displays a message when the button is pressed.
Runtime Polymorphism
Constructors and Object Creation
Method Overriding
Applets and Applet Parameters
