MCS-024 DEC 2008
-
Upload
nitin-nilesh -
Category
Documents
-
view
217 -
download
0
description
Transcript of MCS-024 DEC 2008
-
MCA (Revised)Term-End Examination
December, 2OO8
MCS-024 : OBJEGT ORIENTEDTECHNOLOGIES AND JAVA
PROGRAMMING
Time : 3 hours Maximum Marks : 1.04
Nofe : Question number 7 is compulsory. Attemptany three questions from the rest.
1. (a)
(b)
(c)
What is the difference between Polymorphismand Encapsulation ? 4
Write a program that displays a diamond usingasterisks (*) as follows : 6
***
** **
:N. *
YName three threads that are createdautomatically by the Java virtual machine anddiscuss the purpose of each thread. 4
MCS-024 P.T .O .
-
Explain the following and their usage usingsuitable examples :(i) Extends(ii) Implements(iiO Final
Find the errors in the following Java programsand correct them :
(i) int go{
system.out.println ("lnside method g");int ho
{system.out.println ("lnside method h");
l(iil int sum (int x,. int y)
tint result;result = x*V;
l
What is a package in Java and what are theaccess criteria ? Fxplain with suitable examples.
MCS-O24
-
What is explicit casting ? Explain with suitableexample.
What is the difference between declaring avariable and defining a variable ? Explain withthe help of example.
2. (a) What is the dillerence between the booleanoperator & and the && operator ? Explainwith suitable example.
(b) Find the errors in the following Java program,and correct them :
Class Examination;
{public void main (argsl]){system.out.println ("java is an OOL")
int i = 10;f o r ( i > 0 ; i - - )system.out.println ("i =
II
)(c) Write a program to implement Quick Sort
technique.
MCS-024 3 P.
k)
-
(d) Find and correct the error in each of thefollowing segments : 4
(i) final int A-size = 5;A_size = 10;
(ii) Assumeint a[ ] [ ] : {{1, 2}, {3, 4}},a[1', 1] = $t
3. (a) Write a Java applet to show a sine wave with.
variable frequency on a web page. 6
(b) What do you mean by "this" keyword ?Explain with example.,
(c) What is an event ? Explain differentcomponents of an event.
(d) What gives Java it's "write once and runanywhere" nature ?
4. (a) What is multithreading ? Explain twoadvantages of multithreaded programs. Write aprogram in Java to explain how differentpriorities can be assigned to different threads.
What is a servlet ? Explain the use of GET andPOST methods.
What is the use of 'synchronize' keyword ?
1 0
4
3
(b)
(c)
MCS-O24
-
(d) What is a datagram socket ? Explain the use ofdatagram socket through an example of aprogram written in Java. 3
Compare and contrast break .and continue
staternent. 3
What happens when a return lype, even,void isspecified fgr a constructor ? What do youunderstand by parameterized constructors ?
5. (a)
(b)
Explain with one example.(c) Find the errors in the following Java program
and correct them :( i ) ! = 1 ;
while ( i .= 10);i++; l
( i i ) for (k : 0.1; k! = 1.0; k += 0.1)System.out.println (k);
(d) Write a program that calculates the product ofthe odd integers from 1 to 15.
(e) Compare and contrast Java Beans and JavaServlets.
MCS-024 1 1 ,000