0% found this document useful (0 votes)
2 views2 pages

Java 1

This document is an examination paper for B.Tech (CSE/IT)/MCA students at DIT University, covering Java Programming Fundamentals. It consists of two sections, with Section 1 requiring students to answer five questions and Section 2 requiring four questions, each with various topics related to Java programming concepts. The total duration of the exam is 3 hours, and the total marks available are 100.

Uploaded by

aiko12473
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Java 1

This document is an examination paper for B.Tech (CSE/IT)/MCA students at DIT University, covering Java Programming Fundamentals. It consists of two sections, with Section 1 requiring students to answer five questions and Section 2 requiring four questions, each with various topics related to Java programming concepts. The total duration of the exam is 3 hours, and the total marks available are 100.

Uploaded by

aiko12473
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Paper Code: CSF203/CAN603 (Back)

Printed Page 1 of 2

DIT UNIVERSITY DEHRADUN


[Link] (CSE/IT)/MCA END TERM EXAMINATION, EVEN SEM 2024-25
Roll No.

Subject Name: Java Programming Fundamentals/Introduction to Java Programming

Time: 3 Hours Total Marks: 100


Note: No student is allowed to leave the examination hall before the completion of the exam.
Answers from a section must be written together and must not be mixed with answers from other section.
________________________________________________________________________________________________

SECTION 1: Attempt any five questions in SECTION 1: [5 x 8= 40]

Q.1.1) a. What is exception? Describe the various types of exceptions. [5]


b. Explain the differences between exception and error. [3]

Q.1.2) a. How many types of variables are there in Java? Explain with examples. [3]
b. What is data hiding? Explain encapsulation with the help of suitable example. [5]

Q.1.3) a. Explain the relationship between encapsulation and access modifiers? [4]
b. Explain the accessibility scope of public, private, protected and default modifiers. [4]

Q.1.4) a. Explain why java is called architecture neutral and portable language. [2]
b. Explain the functioning of following methods of StringBuilder along with example:
append(), insert(), delete(),reverse(), replace(), capacity() [6]

Q.1.5) Analyze the following codes. If any error is found, mention it with reason, otherwise write the
output: [2*4 = 8]
class Main { public class Main {
public static void main(String args[]) { public static void main(String[] args)
try { {
Object obj = new Integer(10); String s1 = "Hello";
String str = (String) obj; String s2 = [Link]();
[Link](str); [Link](" World");
} catch (ClassCastException e) { [Link](s1 + " " + s2);
[Link] ("Exception }}
caught: "); }}}
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args)
String str = "classroom"; {
[Link]([Link]('r')); }} String str = "Java Programming";
[Link]([Link](5)); }}

Q.1.6) a. Explain the difference between abstract class and interface in Java. [5]
b. What is instantiation in Java? Explain the steps of instantiation. [3]

SECTION 2: Attempt any four questions in SECTION 2: [4 x 15= 60]


Paper Code: CSF203/CAN603 (Back)
Printed Page 2 of 2

Q.2.1) a. Can methods declared as static and final be overridden? Explain with reason? [5]
b. Explain why are Java strings immutable? [3]
c. What is constructor overloading? Explain differences between constructor overloading and method
overloading with suitable examples . [7]

Q.2.2) a. Why does Java not support multiple inheritance with classes? [4]
b. Explain the difference between final, finally and finalize with proper examples [6]
c. Explain the mechanism of dynamic method dispatch with a suitable example. [5]

Q.2.3) a. Write a Java program that reads a 3-by-4 matrix and finds the largest element in each column. Here is
sample run: [8]
3 8 1 5 Largest elements is at column 0 is 6
6 2 9 7 Largest elements is at column 1 is 8
4 3 5 6 Largest elements is at column 2 is 9
Largest elements is at column 3 is 7

b. Develop a Java program that reads a series of integers and calculates both the sum and the average of
the entered numbers. Assume that the input ends with number 0. [7]

Example: Input 4 8 2 6 10 0 → Sum: 30, Average: 6.0

Q.2.4) a. What are the advantages and disadvantages of cloning? Write a java code for cloning of an object
using [Link](). [8]

b. Elaborate the difference between the throw and throws with suitable code. [7]

Q.2.5) a. What is abstract method? Explain the use of abstract method in java with an example. [5]

b. Explain the differences between primitive and non-primitive datatypes in java. [3]

c. Develop a Java program that attempts to access an invalid array index, causing an
ArrayIndexOutOfBoundsException, and handle it appropriately. [7]

-----END OF PAPER ----

You might also like