Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: MCS-024 2nd sem
Description: MCS-024 2nd sem,Course Code : MCS-024 Course Title : Object Oriented Technologies and Java Assignment Number : BCA(IV)/024/Assignment/, Solved Assignment

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


BCA & MCA (IGNOU)
http://www
...
com
Course Code
: MCS-024
Course Title

: Object Oriented Technologies and Java

Assignment Number

: BCA(IV)/024/Assignment/ 2016

April, 2016 (For January 2016 Session)
1
...

(5 Marks)
Ans:
Object oriented programming allows a decomposition of a problem into number entities
called objects and then builds data and functions around these objects
...
However, functions
of one object can access the functions of other objects
...

Inheritance: it is a process to create a new class from existing class or classes
...
Thus class „A‟ is a parent class and class „B‟ is a
child class
...


/ignouassignmentfree

IGNOU ASSIGNMENT GURU Page-

Class and object
A class is a blueprint that describes characteristics and functions of entity
...
A class is collection of the properties
and methods are called members
...

Data abstraction: - it is a process that provides only essential features by hiding its
background details
...


1

Features of Object Oriented Programming

BCA & MCA (IGNOU)
http://www
...
com
Polymorphism: - Generally, it is the ability to appear in different forms
...
It‟s the ability to
redefine methods for derived classes
...

(2 Marks)
Ans:
The Java programs use compiler and interpreter
...

Java interpreter is a part of java runtime environment that reads byte code and convert it
into executable code on any operating system
...

The JVM makes java portable so that java program can run on any platform
...


(c) Write a program to explain how array of objects may be created in java
...
out
...
disp(i);

/ignouassignmentfree

IGNOU ASSIGNMENT GURU Page-

2

}

BCA & MCA (IGNOU)
http://www
...
com
}
}
}
2
...

(4 Marks)
...
25f;
double sineVal = 12345
...
out
...
out
...
out
...
out
...
out
...
out
...
out
...
out
...
ignouassignmentguru
...
out
...
out
...
out
...

(i) Class and objects
(ii) Abstraction and encapsulation
(iii) Application program and applet program
(6 Marks)
Ans:

/ignouassignmentfree

IGNOU ASSIGNMENT GURU Page-

(iii)
Applet vs Application program
Java Application:
 A java application is a stand-alone program
...

 It cannot access from web browser
...

 It can access on local machine on which program is reside
...

 Applet program can run from within a web browser or similar java enabled application
such as an applet viewer
 Java applets are included in HTML pages using tag
...

 Applets are not allowed to read or write to files on the local system
...
For example, the
class Dog would consist of traits shared by all dogs
...
Object is an instance of class
...
A data abstraction is a simple view of an object that includes required
features and hides the unnecessary details
...
A data
abstraction is a simple view of an object that includes required features and hides the
unnecessary details
...


BCA & MCA (IGNOU)
http://www
...
com
3
...

(2 Marks)
Ans:
Static  It can be used with a variable, a method or block of code
...
There is no need to create an object of the class to access
the static features of the class
...
out
...
i)
}
}
(b) What is inheritance? Explain the advantage of inheritance with an example
program
...
Class „B‟ is
a sub class that is derived from class „A‟
...
It provides reusability of code
...
ignouassignmentguru
...



Create the remote interface



Provide the implementation of the remote interface



Compile the implementation class and create the stub and skeleton objects using the
rmic tool



Start the registry service by rmiregistry tool



Create and start the remote application



Create and start the client application

/ignouassignmentfree

IGNOU ASSIGNMENT GURU Page-

(c) Explain the steps involved in creating a distributed application using Remote
Method Invocation (RMI)
...
out
...
sum(4,5);
}
}

BCA & MCA (IGNOU)
http://www
...
com
4
...

(2 Marks)
Ans:


Polymorphism : - Polymorphism is the way of providing the different functionality by
the functions having the same name based on the signatures of the methods
...


}

6
(b) Explain the need of package in Java
...

(3 Marks)
Ans:
A Java package is a set of classes which are grouped together
...

 A package provides a unique namespace for the types it contains
...
out
...
out
...
ignouassignmentguru
...

Creating package
package world;
public class HelloWorld {
public static void main(String[] args) {
System
...
println("Hello World");
}
}
Calling package
import world
...
moon;
PATH: maintains a list of directories
...

CLASSPATH: maintain a list of directories (containing many Java class files) and JAR files
(a single-file archive of Java classes)
...

(c) What is rule of accessibility? Explain different level of accessibility in java
...

If a class has „no modifer‟, then it CAN ONLY be accessed from „same package‟
...



public and no modifier – the same way as used in class level
...
ignouassignmentguru
...

protected – CAN be accessed from „same package‟ and a subclass existing in any
package can access
...

(a) What is abstract class? Explain need of abstract class with the help of an
example
...
Explain
hierarchy of different exception classes in java
...
When an error occurs within a method, the method
creates an object and hands it off to the runtime system
...
Creating an exception object and handing it to the runtime system
is called throwing an exception
...
out
...
salary();

BCA & MCA (IGNOU)
http://www
...
com

IGNOU ASSIGNMENT GURU Page-

10

if( n == 0 ){
throw new Exception(“can‟t assign zero…”);
}
else if(n < 0)
{
throw new Exception(“can‟t assign -ve value…”);
}
Else
{
System
...
println(“\n\n\tValid value
...
accept(-8);
//ob
...
out
...
out
...
(2 Marks)
Ans:
class pixeles extends Thread
{
static String msg[]={"PIXELES", "Classes", "for", "BCA", "MCA"};
public synchronized void display(String th1)
{
try

/ignouassignmentfree

IGNOU ASSIGNMENT GURU Page-

In Java exceptions under Error and RuntimeException classes are unchecked exceptions
...
Checked and unchecked exceptions are functionally equivalent
...


11

http://www
...
com

BCA & MCA (IGNOU)
http://www
...
com
{
for(int i=0;i<=4;i++)
System
...
println(th1+msg[i]);
}catch(Exception e)
{
System
...
println("Exception handled");
}
}
public void run()
{
try
{
display(getName());
this
...

(a) What is I/O stream in java? Write a program in java to create a file and copy the
content of an already existing file into it
...
io
...
start();
pixeles t2=new pixeles("Thread Two: ");
t2
...
ignouassignmentguru
...
out
...
read(ibuf,0,x);
if(r!=1)
System
...
print(“File is empty”);
else
System
...
print(new String(ibuf));
System
...
print(“Size of File is=”+x);
String s= new String(ibuf);
FileOutputStream ot=new FileOutputStream(arg[1]);
for(int i=0;i ...
write(s
...
out
...
close();
in
...
Make
necessaryassumptions and use appropriate layout in your program
...
applet
...
awt
...
gif");
tr
...
drawImage(img, 0, 0, this);
g
...
drawString("DOB:12/jun/1985",120,200);
g
...
ignouassignmentguru
...
drawString("Qly: BCA 4th Sem",140,200);

}
}
(c) Differentiate between String and StringBuffer classes
...
(2 Marks)
Ans:
String is immutable:
String str = "Hello World";
StringBuffer is mutable:
StringBuffer sb = new StringBuffer("Hello");
sb
...
A StringBuffer class implements a
mutable sequence of characters
...
At
any point in time it contains some particular sequence of characters, but the length and
content of the sequence can be changed through certain method calls
...

(a) What is need of layout manager? Explain different layouts available in java for GUI
programming
...

North, South, East, and West are the rectangular edges of the applet
...
Then it
begins a row lower, and moves from left to right again
...

This is the default LayoutManager for applets and panels
...
ignouassignmentguru
...
A BorderLayout places objects in the
North, South, East, West, and Center of an applet
this
...
It is important to note that each is equally sized
and spaced as there is similarly named Layout known as GridBagLayout
...

Ans:
TCPServer
import java
...
*;
import java
...
*;

/ignouassignmentfree

(3 Marks)

IGNOU ASSIGNMENT GURU Page-

15

CardLayout
A CardLayout object is a layout manager for a container
...
Only one card is visible at a time, and the container acts as a stack of
cards
...

Grid bag layout:- it is similar to grid layout in which elements are arragned in row and
colums but it allows to insert a component in span of two cells
...
ignouassignmentguru
...
accept();
BufferedReader inFromClient =
new BufferedReader(new
InputStreamReader(connectionSocket
...
getOutputStream());
clientSentence = inFromClient
...
out
...
toUpperCase() + '\n';
outToClient
...

(3 Marks)

Steps:


Register the driver class

The forName() method of Class class is used to register the driver class
...

Class
...
jdbc
...
OracleDriver");


Create the connection object

The getConnection() method of DriverManager class is used to establish connection with the
database
...
getConnection( "jdbc:oracle:thin:@localhost:1521:xe","syste
m","password");

/ignouassignmentfree

IGNOU ASSIGNMENT GURU Page-

16

Ans:

BCA & MCA (IGNOU)


http://www
...
com
Create the Statement object

The createStatement() method of Connection interface is used to create statement
...

Statement stmt=con
...
This method returns the object of ResultSet that can be used to get all the records
of a table
...
executeQuery("select * from emp");
while(rs
...
out
...
getInt(1)+" "+rs
...
The
close() method of Connection interface is used to close the connection
...
close();
8
...
(2 Marks)
Ans:

Multi-threaded
A thread is like a separate program, executing concurrently
...
The main advantage of multithreading is that it shares the same memory
...


(b) What are principles of event delegation model? Explain different sources of
events and event listener
...

Ans:

/ignouassignmentfree

IGNOU ASSIGNMENT GURU Page-

We can create distributed applications in java
...
We may access files by calling the methods from any machine on the internet
...
ignouassignmentguru
...
The GUI may require users to click, resize, or drag and
drop components of the interface, and input data using the keyboard
...
Event handling
code deals with events generated by GUI user interaction
...

The event model is based on the Event Source and Event Listeners
...
The Event Source is any object which creates
the message / event
...

There are three participants in event delegation model in Java;
- Event Source – the class which broadcasts the events
- Event Listeners – the classes which receive notifications of events
- Event Object – the class object which describes the event
...

Ans:
A servlet is a Java programming language class used to extend the capabilities of a server
...

There are several ways through which we can provide unique identifier in request and
response
...
User Authentication – This is the very common way where we user can provide

is not very effective method because it won‟t work if the same user is logged in
from different browsers
...
HTML Hidden Field – We can create a unique hidden field in the HTML and when
user starts navigating, we can set its value unique to the user and keep track of the
session
...

Also it‟s not secure because we can get the hidden field value from the HTML
source and use it to hack the session
...
URL Rewriting – We can append a session identifier parameter with every request
and response to keep track of the session
...
This

18

authentication credentials from the login page and then we can pass the

BCA & MCA (IGNOU)
http://www
...
com
keep track of this parameter in every response and make sure it‟s not clashing with
other parameters
...
Cookies – Cookies are small piece of information that is sent by web server in
response header and gets stored in the browser cookies
...
We can maintain a session with cookies but if the client disables the

IGNOU ASSIGNMENT GURU Page-

19

cookies, then it won‟t work
Title: MCS-024 2nd sem
Description: MCS-024 2nd sem,Course Code : MCS-024 Course Title : Object Oriented Technologies and Java Assignment Number : BCA(IV)/024/Assignment/, Solved Assignment