MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
Winter – 19 EXAMINATION
Subject Name: Java Programming Model Answer 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: 10M
a Define Constructor. List its types. 2M
Ans Constructor: A constructor is a special member which initializes Definition:1Mark
an object immediately upon creation. It has the same name as Types: 1 Mark
class name in which it resides and it is syntactically similar to
any method. When a constructor is not defined, java executes a
default constructor which initializes all numeric members to zero
and other types to null or spaces. Once defined, constructor is
automatically called immediately after the object is created
before new operator completes.
Types of constructors:
1. Default constructor
2. Parameterized constructor
3. Copy constructor
b Define Class and Object. 2M
1|24
, MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
Ans Class: A class is a user defined data type which groups data Definition 1
members and its associated functions together. Mark each
Object: It is a basic unit of Object Oriented Programming and
represents the real life entities. A typical Java program creates
many objects, which as you know, interact by invoking methods.
c List the methods of File Input Stream Class. 2M
Ans • void close() Any Two Each
• int read() for 1 Mark
• int read(byte[] b)
• read(byte[] b, int off, int len)
• int available()
d Define error. List types of error. 2M
Ans • Errors are mistakes that can make a program go wrong. Errors Definition: 1m
may be logical or may be typing mistakes. An error may List: 1m
produce an incorrect output or may terminate the execution of
the program abruptly or even may cause the system to crash.
Errors are broadly classified into two categories:
1. Compile time errors
2. Runtime errors
e List any four Java API packages. 2M
Ans 1.java.lang 1/2 Marks for
2.java.util one Package
3.java.io
4.java.awt
5.java.net
6.ava.applet
f Define array. List its types. 2M
Ans An array is a homogeneous data type where it can hold only Definition 1
objects of one data type. Mark, List 1
Mark
Types of Array:
2|24
, MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
1)One-Dimensional
2)Two-Dimensional
g List access specifiers in Java. 2M
Ans 1)public Any 2, 1M for
each
2)private
3)friendly
4)protected
5)Private Protected
2. Attempt any Three of the following: 12M
a Differentiate between String and String Buffer. 4M
Ans Any 4 Points
String String Buffer c 4 Marks
String is a major class String Buffer is a peer class
of String
Length is fixed (immutable) Length is flexible (mutable)
Contents of object cannot be Contents of object can be
modified modified
Object can be created by Objects can be created by
assigning String constants calling constructor of String
enclosed in double quotes. Buffer class using “new”
Ex:- String s=”abc”; Ex:- StringBuffer s=new
StringBuffer (“abc”);
b Define a class circle having data members pi and radius.
Initialize and display values of data members also calculate
area of circle and display it.
Ans class abc correct
Program with
{ correct logic 4
Mark
3|24
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
Winter – 19 EXAMINATION
Subject Name: Java Programming Model Answer 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: 10M
a Define Constructor. List its types. 2M
Ans Constructor: A constructor is a special member which initializes Definition:1Mark
an object immediately upon creation. It has the same name as Types: 1 Mark
class name in which it resides and it is syntactically similar to
any method. When a constructor is not defined, java executes a
default constructor which initializes all numeric members to zero
and other types to null or spaces. Once defined, constructor is
automatically called immediately after the object is created
before new operator completes.
Types of constructors:
1. Default constructor
2. Parameterized constructor
3. Copy constructor
b Define Class and Object. 2M
1|24
, MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
Ans Class: A class is a user defined data type which groups data Definition 1
members and its associated functions together. Mark each
Object: It is a basic unit of Object Oriented Programming and
represents the real life entities. A typical Java program creates
many objects, which as you know, interact by invoking methods.
c List the methods of File Input Stream Class. 2M
Ans • void close() Any Two Each
• int read() for 1 Mark
• int read(byte[] b)
• read(byte[] b, int off, int len)
• int available()
d Define error. List types of error. 2M
Ans • Errors are mistakes that can make a program go wrong. Errors Definition: 1m
may be logical or may be typing mistakes. An error may List: 1m
produce an incorrect output or may terminate the execution of
the program abruptly or even may cause the system to crash.
Errors are broadly classified into two categories:
1. Compile time errors
2. Runtime errors
e List any four Java API packages. 2M
Ans 1.java.lang 1/2 Marks for
2.java.util one Package
3.java.io
4.java.awt
5.java.net
6.ava.applet
f Define array. List its types. 2M
Ans An array is a homogeneous data type where it can hold only Definition 1
objects of one data type. Mark, List 1
Mark
Types of Array:
2|24
, MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
1)One-Dimensional
2)Two-Dimensional
g List access specifiers in Java. 2M
Ans 1)public Any 2, 1M for
each
2)private
3)friendly
4)protected
5)Private Protected
2. Attempt any Three of the following: 12M
a Differentiate between String and String Buffer. 4M
Ans Any 4 Points
String String Buffer c 4 Marks
String is a major class String Buffer is a peer class
of String
Length is fixed (immutable) Length is flexible (mutable)
Contents of object cannot be Contents of object can be
modified modified
Object can be created by Objects can be created by
assigning String constants calling constructor of String
enclosed in double quotes. Buffer class using “new”
Ex:- String s=”abc”; Ex:- StringBuffer s=new
StringBuffer (“abc”);
b Define a class circle having data members pi and radius.
Initialize and display values of data members also calculate
area of circle and display it.
Ans class abc correct
Program with
{ correct logic 4
Mark
3|24