MST 2017 PDF
MST 2017 PDF
MST 2017 PDF
Question I
class overload {
int x, y;
void add(int a){ x = a + 1; } •
void add(int a , int b){ x = a + 2; }
} .
class Overload_methods {
public static void main(String args[ ])
{ overload obj = new overload();
int a = 0; '
• obj.add(6);
obj.add(6, 7);
System.out.println(obj.x); }
}
C Define a class Student having two integer instance variables: m1 and m2. Write a method 3
meth(int a, int b) to display the sum of the marks ml and m2. Extend this class to define
another class StudentE having meth(int a, int b) to find the product of the ml and m2.
Initialize the marks ml and m2 using the constructor of StudentE. Show the execution of
the rilethods of both classes using dynamic method dispatch.
Question II
1
A Explain the following Java keywords 2.5
(i) throw (ii) this (iii) final (iv) break (v) continue
A Explain signed and unsigned right shift operators with suitable example.
,
P.7.0.
B In a Java program, we have a statement byte x = -15; give the sequence of bits used by the 1.5
system to store x.