0% found this document useful (0 votes)
66 views

Java Programming - 2025

This document is a model paper for the B.Sc Computer Science Java Programming course at Madurai Kamaraj University for Semester IV. It includes three sections: Section A with multiple-choice questions, Section B with short answer questions, and Section C with detailed explanations and programming tasks. Topics covered include Java features, OOP principles, exception handling, inheritance, and applet lifecycle.

Uploaded by

silasmacx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Java Programming - 2025

This document is a model paper for the B.Sc Computer Science Java Programming course at Madurai Kamaraj University for Semester IV. It includes three sections: Section A with multiple-choice questions, Section B with short answer questions, and Section C with detailed explanations and programming tasks. Topics covered include Java features, OOP principles, exception handling, inheritance, and applet lifecycle.

Uploaded by

silasmacx
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Madurai Kamaraj University

B.Sc Computer Science - Semester IV


Java Programming - Model Paper 2025

Section A – One Mark (10 x 1 = 10)

1. Who invented Java?


James Gosling

2. What is the extension of Java bytecode file?


.class

3. Which keyword is used to inherit a class?


extends

4. Java is a ________ typed language.


strongly

5. Which method is the entry point in Java?


main

6. Which keyword prevents method overriding?


final

7. What is the parent class of all Java classes?


Object

8. Which loop is guaranteed to execute at least once?


do-while

9. Which package is automatically imported in every Java program?


java.lang

10. JVM stands for ________.


Java Virtual Machine

Section B – Five Marks (5 x 5 = 25)


1. Explain features of Java.
- Platform Independent
- Object Oriented
- Secure and Robust
- Architecture Neutral
- High Performance with JIT Compiler

2. Write a Java program to find factorial using recursion.

int fact(int n) {
if(n == 0) return 1;
else return n * fact(n - 1);
}

3. Explain method overloading with example.


- Same method name with different parameters

int add(int a, int b) {...}


double add(double a, double b) {...}

4. Explain 'this' keyword in Java.


- Refers to the current object
- Used to resolve variable shadowing
- Used to call constructor within a constructor

5. Difference between Interface and Abstract Class.


- Interface: All methods abstract, no constructor
- Abstract: Can have concrete methods, constructors
- Interface supports multiple inheritance

Section C – Eight Marks (5 x 8 = 40)

1. Describe OOPs principles in detail with examples.


- Encapsulation: Binding data and methods
- Inheritance: Acquiring properties from parent
- Polymorphism: Same function, different forms
- Abstraction: Hiding implementation

class Animal {
void sound() { System.out.println("Sound"); }
}
class Dog extends Animal {
void sound() { System.out.println("Bark"); }
}

2. Explain exception handling in Java with try-catch-finally.


- Prevents program crash due to runtime errors
- try: code block to monitor
- catch: handles exception
- finally: always executed

try {
int x = 5 / 0;
} catch (ArithmeticException e) {
System.out.println("Error: " + e);
} finally {
System.out.println("Done");
}

3. Write a Java program to implement multilevel inheritance.

class A {
void showA() { System.out.println("A"); }
}
class B extends A {
void showB() { System.out.println("B"); }
}
class C extends B {
void showC() { System.out.println("C"); }
}

4. Discuss packages and access specifiers in Java.


- Packages group related classes
- Access Specifiers: public, private, protected, default
- public: Accessible everywhere
- private: Within class only
- protected: Within package + subclass
- default: Only within package

5. Explain Applet lifecycle with diagram.


- init(): Initialization
- start(): Starts execution
- stop(): Pause execution
- destroy(): Cleanup
- Draw GUI via paint()
init() → start() → paint() → stop() → destroy()

Download as PDF

You might also like