Java
Java
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
Winter – 19 EXAMINATION
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)
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
3|24
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
a.area();
}
c Define exception. State built-in exceptions. 4M
Ans An exception is a problem that arises during the execution of a Definition 2
program. Marks, List: 2
Marks
Java exception handling is used to handle error conditions in a
program systematically by taking the necessary action
Built-in exceptions:
5|24
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
2. start( )
3. paint( )
4. stop( )
5. destroy( )
7|24
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
7)syntax 7)syntax
Class classname Inteface Innterfacename
{ {
Variable declaration, Final Variable declaration,
Method declaration abstract Method declaration
} }
d Define type casting. Explain its types with syntax and example. 4M
Ans 1. The process of converting one data type to another is called 1M for
casting or type casting. definition,3M for
types explanation
2. If the two types are compatible, then java will perform the
conversion automatically.
3. It is possible to assign an int value to long variable.
4. However, if the two types of variables are not compatible, the
type conversions are not implicitly allowed, hence the need for
type casting.
1.Implicit type-casting:
2.Explicit type-casting:
1. Implicit type-casting:
Example:
int i = 3;
double f;
f = i;
9|24
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
Ans 2M for
diagram,2M for
explanation
Thread Life Cycle Thread has five different states throughout its
life.
1. Newborn State
2. Runnable State
3. Running State
4. Blocked State
5. Dead State
11 | 2 4
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
Operator Meaning
&& Logical
AND
|| Logical
OR
! Logical
NOT
Program demonstrating logical Operators
13 | 2 4
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
Syntax: s1.toLowerCase()
System.out.println(s.toLowerCase());
Output: sachin
15 | 2 4
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
17 | 2 4
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
19 | 2 4
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
21 | 2 4
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
}
c Implement the following inheritance 6M
23 | 2 4