CS-74 Introduction to Internet Programming June-2004
Question Paper of CS-74 Introduction to Internet Programming June-2004
Ql(a). What is a byte code in Java?
(b) What is the default access method in Java? Explain this with the help of a suitable example.
© Can an abstract method be declared as final? Justify your answer.
(d) Write a program in Java to print the following pattern for a given input n = 5:
1
22.2
33333
4444444
555555555
(e) Find the error(s), if any, in the following blocks. Also correct the error(s),
(i) Class Demo {
Static void f( )
{system.out.println ("Inside f( )");
throw new Illegal Access Exception ("demo");
}
public static void main (string args[ ])
{
f();
}
}
(ii) Abstract Class A {
Abstract void f( );
Abstract void g( );
Void display ( ){
System.out.println ("Inside A");
}
}
Class B extends A
{
voidf( ){
system.out.println ("Version of B");
} :
Void display( ){system.out.printlii ("Inside B");
}
}
Class Demo {
Public static void main (string args [])
{
B b = newB( );
b.display( );
}
}
(f) What is ‘this’ keyword? How is it different from a super Keyword?
(g) Write a Java program to calculate the sum of the digits of a number. The sum should be calculated recursively to get 2 sing* a'’-A* son, (For example, if input is 189, then the result will be 9).
The input should be accepted from the COHMBU*:I? Ymz.