Ktu Students: Answer All Questions. Each Question Carries 3 Marks
Ktu Students: Answer All Questions. Each Question Carries 3 Marks
1. Explain the declaration of array variable in Java. What is dynamic initialization? Give
examples.
2. What is meant by polymorphism? Briefly explain the types of polymorphism.
3. What is the output of the following code? Justify.
class Test {
public static void main(String a[]) {
byte b = 50;
b = b * 2;
System.out.print(b);
}
}
4. Write a note on the access control keywords in Java.
PART-B
Answer any two full questions. Each question carries 9 marks.
KTU STUDENTS
b) Explain parameter passing in Java, with suitable examples.
7. a) Describe the use of constructor in Java, with suitable examples.
b) Describe the looping control statements in Java, with examples.
PART-C
(5)
(4)
(5)
PART-D
Answer any two full questions. Each question carries 9 marks.
12. a) Explain how multiple threads are created in a program, with example. (5)
b) Write a Java program that accepts N integers through console and sort them in
ascending order. (4)
13. a) Explain exception handling mechanism, with suitable examples. (5)
b) Write a Java program that counts the number of words in a text file. (4)
14. a) What is dynamic method despatch? Give examples. (4)
b) Write a program to create a package named mypack, containing a class
RightTriangle in which a static method check whether three given sides of a triangle
forms a right-angled triangle and returns that information. Import this package in
another class. (5)
KTU STUDENTS