Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
15 views3 pages

2 Marks Java 4

The document is a model answer for the Summer 2019 Java Programming examination by the Maharashtra State Board of Technical Education. It includes important instructions for examiners on assessing answers, a list of questions with corresponding model answers, and explanations of key Java concepts such as platform independence, inheritance types, and stream classes. The document emphasizes flexibility in evaluating candidates' understanding rather than strict adherence to model answers.

Uploaded by

hemrajpache
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)
15 views3 pages

2 Marks Java 4

The document is a model answer for the Summer 2019 Java Programming examination by the Maharashtra State Board of Technical Education. It includes important instructions for examiners on assessing answers, a list of questions with corresponding model answers, and explanations of key Java concepts such as platform independence, inheritance types, and stream classes. The document emphasizes flexibility in evaluating candidates' understanding rather than strict adherence to model answers.

Uploaded by

hemrajpache
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
You are on page 1/ 3

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)

SUMMER – 2019 EXAMINATION


MODEL ANSWER
Subject: Java Programming Subject Code: 22412

Important Instructions to examiners:


1) The answers should be examined by key words and not as word-to-word as given in the model
answer scheme.
2) The model answer and the answer written by candidate may vary but the examiner may try to
assess the understanding level of the candidate.
3) The language errors such as grammatical, spelling errors should not be given more Importance
(Not applicable for subject English and Communication Skills).
4) While assessing figures, examiner may give credit for principal components indicated in the
figure. The figures drawn by candidate and model answer may vary. The examiner may give
credit for any equivalent figure drawn.
5) Credits may be given step wise for numerical problems. In some cases, the assumed constant
values may vary and there may be some difference in the candidate’s answers and model
answer.
6) In case of some questions credit may be given by judgement on part of examiner of relevant
answer based on candidate’s understanding.
7) For programming language papers, credit may be given to any other program based on
equivalent concept.

Q. Sub Answer Marking


No Q.N. Scheme
.
1. Attempt any FIVE of the following: 10
a) List any eight features of Java. 2M
Ans. Features of Java:
1. Data Abstraction and Encapsulation
2. Inheritance
3. Polymorphism
4. Platform independence Any
5. Portability eight
6. Robust features
2M
7. Supports multithreading
8. Supports distributed applications
9. Secure
10. Architectural neutral
11. Dynamic
b) State use of finalize( ) method with its syntax. 2M
Ans. Use of finalize( ):
Sometimes an object will need to perform some action when it is

Page 1 / 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)

SUMMER – 2019 EXAMINATION


MODEL ANSWER
Subject: Java Programming Subject Code: 22412

destroyed. Eg. If an object holding some non java resources such as


file handle or window character font, then before the object is
garbage collected these resources should be freed. To handle such
situations java provide a mechanism called finalization. In Use 1M
finalization, specific actions that are to be done when an object is
garbage collected can be defined. To add finalizer to a class define
the finalize() method. The java run-time calls this method whenever it
is about to recycle an object.

Syntax: Syntax
protected void finalize() { 1M
}
c) Name the wrapper class methods for the following: 2M
(i) To convert string objects to primitive int.
(ii) To convert primitive int to string objects.
Ans. (i) To convert string objects to primitive int:
String str=”5”;
int value = Integer.parseInt(str); 1M for
each
(ii) To convert primitive int to string objects: method
int value=5;
String str=Integer.toString(value);
d) List the types of inheritances in Java. 2M
(Note: Any four types shall be considered)
Ans. Types of inheritances in Java:
i. Single level inheritance Any
ii. Multilevel inheritance four
iii. Hierarchical inheritance types
iv. Multiple inheritance ½M
v. Hybrid inheritance each

e) Write the syntax of try-catch-finally blocks. 2M


Ans. try{
//Statements to be monitored for any exception
} catch(ThrowableInstance1 obj) { Correct
//Statements to execute if this type of exception occurs syntax
} catch(ThrowableInstance2 obj2) { 2M
//Statements
}finally{

Page 2 / 23
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2005 Certified)

SUMMER – 2019 EXAMINATION


MODEL ANSWER
Subject: Java Programming Subject Code: 22412

//Statements which should be executed even if any exception happens


}
f) Give the syntax of < param > tag to pass parameters to an applet. 2M
Ans.
Syntax:
<param name=”name” value=”value”> Correct
syntax
Example: 2M
<param name=”color” value=”red”>

g) Define stream class. List its types. 2M


Ans. Definition of stream class:
An I/O Stream represents an input source or an output destination. A
stream can represent many different kinds of sources and
destinations, including disk files, devices, other programs, and Definitio
memory arrays. Streams support many different kinds of data, n 1M
including simple bytes, primitive data types, localized characters, and
objects. Java’s stream based I/O is built upon four abstract classes:
InputStream, OutputStream, Reader, Writer.

Types of stream classes:


i. Byte stream classes Types
ii. Character stream classes. 1M

2. Attempt any THREE of the following: 12


a) Explain the concept of platform independence and portability 4M
with respect to Java language.
(Note: Any other relevant diagram shall be considered).
Ans. Java is a platform independent language. This is possible because
when a java program is compiled, an intermediate code called the
byte code is obtained rather than the machine code. Byte code is a
highly optimized set of instructions designed to be executed by the Explana
JVM which is the interpreter for the byte code. Byte code is not a tion 3M
machine specific code. Byte code is a universal code and can be
moved anywhere to any platform. Therefore java is portable, as it
can be carried to any platform. JVM is a virtual machine which exists
inside the computer memory and is a simulated computer within a
computer which does all the functions of a computer. Only the JVM
needs to be implemented for each platform. Although the details of
the JVM will defer from platform to platform, all interpret the same
Page 3 / 23

You might also like