Featured

download ignou assignment

DOWNLOAD IGNOU UNSOLVED ASSIGNMENT(2014-15)
BCA 1st sem
BCA 2nd sem
BcA 3rd sem
BCA 4th sem
download
BCA 5th sem
download
BCA 6th sem
download


MCA
project guidelines july 2014
MCA ist sem
download
MCA 2nd sem
download
MCA 3rd sem
download
MCA 4th sem
download
MCA 5th sem
download



for another assignments go to this link
download

Ignou result

download ignou bca books

download ignou bca study  material of all courses                                                      

BCA First Semester Books/Study Materials                                                         download
FEG-02 Foundation course in English -2 Download
ECO-01 Business Organization Download
BCS-011 Computer Basics and PC Software Download
BCS-012 Mathematics Download
BCSL-013 Computer Basics and PC Software Lab Download
BCA Second Semester Books/Study Materials
ECO-02 Accountancy-1 Download
MCS-011 Problem Solving and Programming Download
MCS-012 Computer Organization and Assembly Language Programming Download
MCS-015 Communication Skills Download
MCS-013 Discrete Mathematics Download
BCSL-021 C Language Programming Lab Download
BCSL-022 Assembly Language Programming Lab Download
BCA Third Semester Books/Study Materials
MCS-021 Data and File Structures Download
MCS-023 Introduction to Database Management Systems Download
MCS-014 Systems Analysis and Design Download
BCS-031 Programming in C++ Download
BCSL-032 C++ Programming Lab Download
BCSL-033 Data and File Structures Lab Download
BCSL-034 DBMS Lab Download
BCA Fourth Semester Books/Study Materials
BCS-040 Statistical Techniques Download
MCS-024 Object Oriented Technologies and Java Programming Download
BCS-041 Fundamentals of Computer Networks Download
BCS-042 Introduction to Algorithm Design Download
MCSL-016 Internet Concepts and Web Design Download
BCSL-043 Java Programming Lab Download
BCSL-044 Statistical Techniques Lab Download
BCSL-045 Algorithm Design Lab Download
BCA Fifth Semester Books/Study Materials
BCS-051 Introduction to Software Engineering Download
BCS-052 Network Programming and Administration Download
BCS-053 Web Programming Download
BCS-054 Computer Oriented Numerical Techniques Download
BCS-055 Business Communication Download
BCSL-056 Network Programming and Administration Lab Download
BCSL-057 Web Programming Lab Download
BCSL-058 Computer Oriented Numerical Techniques Lab Download
BCA Sixth Semester Books/Study Materials
BCS-062 E-Commerce Download
MCS-022 Operating System Concepts and Networking Management Download
BCSL-063 Lab(MCS-022) Download

bcs-041 solved assignment

Q-1 Calculate Cyclic Redundancy Check (CRC), where Message bits M=1010101110 and Generator bits G=10001.
ans)
 b )Write an algorithm to compute the shortest path using Dijkstra’s algorithm.
c)Describe the configuration of BUS, STAR, and RING network topologies, with their
one advantage and one disadvantage.
ans)Bus Topology: --In a bus topology, all stations are attached to the same cable. In the Bus Network, messages are sent in both directions from a single point and are read by the node (computer or peripheral on the network) identified by the code with the message. Most Local Area Networks (LANs) are Bus Networks because the network will continue to function even if one computer is down. The purpose of the
terminators (resistors) at either end of the network is to stop the signal being reflected
back. If a bus network is not terminated, or if the terminator has the wrong level of
resistance, each signal may travel across the bus several times instead of just once.
This problem increases the number of signal collisions, degrading network
performance.
advantage-:
i) Bus topologies are relatively easy to install and don't require much cabling
compared to other topologies.
disadvantage
i) Entire network shuts down if there is a break in the main cable.
STAR TOPOLOGY-:
In a Star Network, all the nodes (PCs, printers and other shared
peripherals) are connected to the central server. It has a central connection point - like a switch. A star topology is designed with each node (file server, workstations, and
peripherals) connected directly to a central network hub or concentrator.All traffic emanates from the switch of the star. Data on a star network passes through
the switch or concentrator before continuing to its destination. The switch or
concentrator manages and controls all functions of the network. It also acts as a repeater for the data flow. This configuration is common with twisted pair cable; however, it can also be used with coaxial cable or fiber optic cable. The switch offers a common connection for all stations on the network. Each station has its own direct cable connection to the switch.
ADVANTAGE-:
i) Easy to add new stations as each station has its own direct cable connection to
the switch. If a cable is cut, it only affects the computer that was attached to it.
DISADVANTAGE-:
i) Depending on where the switches are located, star networks can require more
cable length than a linear topology
RING TOPOLOGY-:
All the nodes in a ring network are connected in a closed circle of
cable as shown in figure 3. Messages that are transmitted travel around the ring until
they reach the computer that they are addressed to. The signal being transmitted is
refreshed by each node in the ring between the sender and receiver. In a ring network,
every device has exactly two neighbors for communication purposes All messages travel through a ring in the same direction. There are no terminated ends to
the cable; the signal travels around the circle and terminated by the source.
ADVANTAGE-:
i) Growth of system has minimal impact on performance. The ring networks can
be larger than bus or star because each node regenerates the signal.
DISADVANTAGE-:
i) Expensive topology.

(d) Describe the different techniques used to multiplex signals?
There are four basic multiplexing techniques:
• Frequency division multiplexing (FDM)
• Time division Multiplexing (TDM)
• Code division Multiplexing (CDM)
• Space-division Multiplexing (SDM
FREQUENCY DIVISION MULTIPLEXING-:
Frequency division multiplexing (FDM) is the technique used to divide the available
bandwidth into a number of smaller independent logical channels with each channel
having a small bandwidth. The method of using a number of carrier frequencies each
of which is modulated by an independent speech signal is in fact frequency division
multiplexing.
TIME DIVISION MULTIPLEXING-:
Time Division Multiplexing (TDM) is another popular method of utilizing the
capacity of a physical channel effectively. Each user of the channel is allotted a small
time interval during which it may transmit a message. Thus the total time available in
the channel is divided and each user is allocated a time slot. Data from each user is
multiplexed into a frame which is transmitted over the channel. In TDM, user’s
messages are buffered as they received and read from the buffer during its time slot to
make a frame. Therefore each user can use the full channel bandwidth. The channel
capacity is fully utilized in TDM by interleaving a number of messages belonging to
different users into one long message. This message sent through the physical channel must be separated at the receiving end. Individual chunks of message sent by each user should be reassembled into a full message.

CODE DIVISION MULTIPLEXING-:
CDMA uses spread-spectrum technology and a special coding scheme (where each
transmitter is assigned a code generally pseudorandom code) to allow multiple users
to be multiplexed over the same physical channel. By contrast, time division multiple
access (TDMA) divides access by time, while frequency-division multiple access
(FDMA) divides it by frequency. CDMA is a form of spread-spectrum signalling,
since the modulated coded signal has a much higher data bandwidth than the data
being communicated. This allows more users to communicate on the same network at
one time than if each user was allotted a specific frequency range. Remember that
CDMA is a digital technology, so analog signals must be digitized before being
transmitted on the network.

SPACE DIVISION MULTIPLEXING-:

When we want to transmit multiple messages through any of the communication
media, the ultimate goal is to maximize the use of the given resources (e.g. time and
frequency in general). It involves grouping many separate wires into a common cable
enclosure. A cable that has, for example, 50 twisted pairs inside it can support 50
channels. SDM has the unique advantage of not requiring any multiplexing
equipment. It is usually combined with other multiplexing techniques to better utilize
the individual physical channels. For example, if there are six persons in the office
and all of them want to talk at the same time, this will give rise to interference
between the conversations. To reduce the interference they may divide themselves
into three groups of two, such that the conversation is between each pair of people. If
the pairs continue talking whilst sitting next to each other, the interference would still
be present. The best way for each pair to converse with minimal interference would
be to sit a few feet away from the other pairs (within the same room) and converse.
They would still be sharing the same medium for their conversations but the physical
space in the room would be divided for each conversation. This is the simplest
example of Space Division Multiplexing.

2 (a) What is Pulse Code Modulation (PCM)? Assume the maximum signal bandwidth of speech data is 4,000Hz. What is the sampling rate for converting speech into digital data using Pulse Code Modulation (PCM)? If each sample is encoded by 8 bits, what is the data rate of the encoded signal
ans)
Pulse code modulation (PCM) is a digital  scheme for transmitting analog data. The signals in PCM are binary; that is, there are only two possible states, represented by logic 1 (high) and logic0 (low). This is true no matter how complex the analog waveform happens to be. Using PCM, it is possible to digitize all forms of analog data, including full-motion video, voices, music, telemetry, and virtual reality (VR). 

b)Write RSA algorithm and explain it using an example
the algorithm involves multiplying two large prime numbers (a prime number  is a number divisible only by that number and 1) and through additional operations deriving a set of two numbers that constitutes the public key and another set that is the private key. Once the keys have been developed, the original prime numbers are no longer important and can be discarded. Both the public and the private keys are needed for encryption /decryption but only the owner of a private key ever needs to know it. Using the RSA system, the private key never needs to be sent across the Internet.The private key is used to decrypt text that has been encrypted with the public key. Thus, if I send you a message, I can find out your public key (but not your private key) from a central administrator and encrypt a message to you using your public key. When you receive it, you decrypt it with your private key. In addition to encrypting messages (which ensures privacy), you can authenticate yourself to me (so I know that it is really you who sent the message) by using your private key to encrypt a digital  certificate. When I receive it, I can use your public key to decrypt it. A table might help us remember this.
(c) Show the signals that will be generated when the sequence 01010001 is encoded using NRZI and Differential Manchester encoding schemes.
SOL)



(d) Why are the wires twisted in a twisted-pair copper wire?
Twisted pair is most widely used media for local data distribution. Twisted-pair cable
is a type of cabling that is used for telephone communications and most modern
Ethernet networks. A pair of wires forms a circuit that can transmit data. The pairs are
twisted to provide protection against crosstalk, and noise generated by adjacent pairs.When electrical current flows through a wire, it creates a small, circular magnetic
field around the wire. When two wires in an electrical circuit are placed close
together, their magnetic fields are the exact opposite of each other. Thus, the two
magnetic fields cancel each other out. They also cancel out any outside magnetic
fields. Twisting the wires can enhance this cancellation effect. Using cancellation
together with twisting the wires, cable designers can effectively provide self shielding
for wire pairs within the network media.


3 (a) What are the major differences between wired LANs and wireless LANs? What are the two main problems with wireless LANs. Briefly, describe the physical layer standards of IEEE 802.11.
ans)LAN stands for Local Area Network, which is a collection of computers and other network devices in a certain location that are connected together by switches and the routers that facilitate the communication of the network elements. Each computer or network element is connected to the switches/routers via a UTP cable. The added letter in WLAN stands for wireless. This is a type of network where the data is not transmitted via cables but over the air through the use of wireless transmitters and receivers.
WLANs are deployed in areas where a wide number of computers may connect to the network but not at the same time. Places like cofee shops often add WLAN to their shops to entice more customers who do not stay for extended periods. Even at home where you have a somewhat fixed number of computers that connect to the network, WLAN is also preferred as it gives users the freedom to move around the house and carry their laptops with them without needing to fuss with cables. For areas where the computers are pretty much fixed, a wired LAN is very desirable due to the advantages that it offers.
  • the main problem in wlan is security issues  the radio waves used in wireless networking typically penetrate outside the building, creating a real risk that the network can be hacked from the parking lot or the street..
  • wlan is slower than lan network.Lan network is much faster than WLAN

The Institute of Electronic and Electrical Engineers (IEEE) has released IEEE 802.11 in June 1997. The standard defined physical and MAC layers of wireless local area networks (WLANs).
The physical layer of the original 802.11 standardized three wireless data exchange techniques:
  • Infrared (IR);
  • Frequency hopping spread spectrum (FHSS);
  • Direct sequence spread spectrum (DSSS).
The 802.11 radio WLANs operate in the 2.4GHz (2.4 to 2.483 GHz) unlicensed Radio Frequency (RF) band. The maximum isotropic transmission power in this band allowed by FCC in US is 1Wt, but 802.11 devices are usually limited to the 100m Wt value.
The physical layer in 802.11 is split into Physical Layer Convergence Protocol (PLCP) and the Physical Medium Dependent (PMD) sub layers. The PLCP prepares/parses data units transmitted/received using various 802.11 media access techniques. The PMD performs the data transmission/reception and modulation/demodulation directly accessing air under the guidance of the PLCP. The 802.11 MAC layer to the great extend is affected by the nature of the media. For example, it implements a relatively complex for the second layer fragmentation of PDUs.
(b) Make a comparative analysis between IPV4 and IPV6.
ans)The number of IPv4 unique addresses is not that large in relation to the current rate of expansion of the Internet. Consequently, a new addressing system has been devised which is a part of Internet Protocol version 6 (IPv6), which uses 128-bit addresses, means total addresses will be 2128 .. IPv4 uses 32-bit addresses, means total addresseswill be 232 around 4,294,967,296 unique addresses. IPv6 has almost 7.9x1028 times moreaddresses than IPv4. It is possible that IPv6 would not be used or implemented completely in the coming couple of years. This IPv6 (Internet Protocol version 6) is a revision of the earlier Internet Protocol (IP) version 4. As you know IPv4 address is 32 bit and divided intofour octets separated by dot for example 192.186.12.10, on the other hand IPv6 addresses are consist of eight groups of four hexadecimal digits separated by colons, for example 2001:0db8:85a3:0042:0000:8a2e:0370:7334. IPv6 is designed to swap the existing IPv4, which is the main communications protocol for most Internet traffic as of today. IPv6 was developed to deal with the long-anticipated problem of IPv4 running out of addresses, some of the reasons and need for implementing IPv6 are following:
• The short term solutions like sub-netting, classless addressing cannot fulfill the
massive future demand of address space.
• The internet must accommodate the real-time audio and video transmission with
best quality of services.
• Internet protocol must provide the necessary security implementation for some
applications.
• There is a need of multicasting in current IPv4, where the transmission of a packet
to multiple destinations can be sent in a single send operation.
• IPv4 need a major revision in various issues like privacy, mobility, routing, QoS

(quality of services), extendibility and addressing
(c) What is congestion? What are the main reasons for occurring congestion in the network? Explain the techniques to solve the problem of congestion.
ans)Congestion: When too many packets are in a subnet or a part of subnet, performance
degrades as depicted in figure 9. This situation is called congestion.
Factors Causing the Congestion
1. Many input lines demanding the same output lines.
2. Slow receiver fast sender.
3. Low bandwidth lines can also cause congestion.
4. Congestion itself (duplicacy).
5. Traffic is bursty

a) Open loop: In open loop solution the good designs are being developed to solve
the problem so that congestion does not occur at first place once the system is
setup and running, no mid pores connection is made. In open loop control, tools
are included to decide when to accept new traffic, when to discard packets and
which ones. And making scheduling decisions at various points in the network.
The decisions are offline decision is not based on current state of network close
loop solution.
The concept of feedback loop is used in closed loop solution. This approach has
three parts, when apply to the congestion control.
i) Monitor the system to detect when and where congestion occurs.
ii) Pass the information to places where the action can be taken.
iii) Adjust system operation to correct the problem

Traffic Shaping (Congestion Control Policy in ATM)
One of the main causes of congestion is that traffic is often bursty. If hosts could be
made to transmit a uniform rate, congestion would be less common. Another open
loop method to help manage congestion is forcing the packet to be transmitted at a
more predictable rate. This approach to congestion management is widely used in
ATM networks and is called traffic shaping.
Traffic shaping is about regulating the average rate (and burstiness) of data
transmission.

LEAKY BUCKET ALGORITHM-:Leaky bucket algorithm can be understood as “The leaky bucket consists of finite
queue when a packet arrives, if there is room on the queue it is appended to the queue,
otherwise it is discarded. At every clock tick, one packet is transmitted

TOKEN BUCKET ALGORITHM-:In many applications, it is better to allow the output to speed up somewhat when large
bursts arrive so a more flexible algorithm is needed, preferably one that never losses
data one such algorithm is token bus algorithm.
In token bucket algorithm, the leaky bucket holds ‘tokens’ generated by a clock at the
rate of one token every DT sec.
The token bucket algorithm provides a different kind of traffic shaping than the leaky
bucket algorithm. Bust of up to n. packets can be sent at once, allowing some
burstiness in the output stream and giving faster response to sodden bursts of input.
A token bucket algorithm throws away tokens when the bucket fills up but never
discards packets.
4(a) Explain the features of HDLC and describe in detail the Frame Format
ans)The High Level Data Link Control protocol was developed by the International Organization for Standardization (ISO).  It is used for switched and non-switched networks and is a bit oriented architecture. The High Level Data Link Control has been accepted and used widely because it supports almost all kinds of functionalities like half duplex, full duplex, point to point and multi-point networks. The bit patterns are standard in HDLC and therefore the information exchanged follows the same pattern. This minimizes the chances of any errors.
The main features of HDLC are divided into various aspects
• The modes for operation
• Stations
• Configuration
• Frames and Structures
• The subsets of HDLC
HDLC frames can be transmitted over synchronous or asynchronous links. Those links have no mechanism to mark the beginning or end of a frame, so the beginning and end of each frame has to be identified. This is done by using a frame delimiter, or flag, which is a unique sequence of bits that is guaranteed not to be seen inside a frame. This sequence is '01111110', or, in hexadecimal notation, 0x7E. Each frame begins and ends with a frame delimiter. A frame delimiter at the end of a frame may also mark the start of the next frame. A sequence of 7 or more consecutive 1-bits within a frame will cause the frame to be aborted.
When no frames are being transmitted on a simplex or full-duplex synchronous link, a frame delimiter is continuously transmitted on the link. Using the standard NRZI encoding from bits to line levels (0 bit = transition, 1 bit = no transition), this generates one of two continuous waveforms, depending on the initial state
This is used by modems to train and synchronize their clocks via phase-locked loops. Some protocols allow the 0-bit at the end of a frame delimiter to be shared with the start of the next frame delimiter, i.e. '011111101111110'.
For half-duplex or multi-drop communication, where several transmitters share a line, a receiver on the line will see continuous idling 1-bits in the inter-frame period when no transmitter is active.
Since the flag sequence could appear in user data, such sequences must be modified during transmission to keep the receiver from detecting a false frame delimiter. The receiver must also detect when this has occurred so that the original data stream can be restored before it is passed to higher layer protocols. This can be done using bit stuffing, in which a "0" is added after the occurrence of every "11111" in the data. When the receiver detects these "11111" in the data, it removes the "0" added by the transmitter.
Make a comparison of channel utilization versus load for various random access
protocols.
(ans)
(c) Discuss why repeaters are needed in a communication channel. What is a key difference between an analog repeater and a digital repeater?
A repeater is an electronic device that receives a signal and retransmits it at a higher
level or higher power, or onto the other side of an obstruction, so that the signal can
cover longer distances without degradation.Because repeaters work with the actual physical signal, and do not attempt to interpret
the data being transmitted, they operate on the Physical layer, the first layer of the
OSI model.In telecommunication, the term repeater has the following standardized meanings:
An analog device that amplifies an input signal regardless of its nature (analog or
digital).
A digital device that amplifies, reshapes, retimes, or performs a combination of any of
these functions on a digital input signal for retransmission.

mcs-024 solved assignment

BCA 4 solved assignment(2014-2015)

mcs-024

Q-1 what is object oriented programming?explain features of object oriented programming  write a program in java to data hiding.
ansobject oriented programming is aprogramming methodoilogy where the main emphasis is given on the object or the data and not onthe onfunction or operations that operate on data data is undervaluedin procedural programming. here the design puts data upfront and organisation of data is significant area . access rights are reserved as well to protect data from accidental changes by an intruder.
features of oop-:
object-object is a collection of a number of entities.object take up space in the memory .object are instances of classes when a program is executed  the object interacted by sending messages to one another.each object contain data or code to manipulate the data object can interect without knowing the details of each other or code.
class-class is a collection of object of similar type.object are variable of the type class once a class has been defined we can create any number of objects belonging to that class. grapes banana andf orange are the member of the class.
Dynamic binding-refers to linking of the fiunction call with function defination is called binding and when it take palce at run time called dynamic binding.
Message passing-The process by which one object can interact with other object is called message pa.ssing
Inheritance-inheritance is the oops feature which allow derivation of the new object from the existing ones. it allows the creation of new class,called the derived class from the existing class called base class.inheritance allow the base class to be accessed by the derive class which in turn their new features in addition to the old base class feature.
Data abstraction and encapsulation-encapsulation is the principle by which related content of a system are kept together . it minimize trffic between different parts of the work and it seperates certain specific requirements  from other parts  of specification which use  those requirementsabstraction refers to the act of represting essential feature without including the background detail to distinguish object/functions from other object.  functional abstraction was provided by telling which task is performed by function and hiding how the task is performed.
Polymorphism- greek term means ability to take more than one form. An operation may exhibite different behaviours in different instances. The behaviour depends upon the types of data used in the operation.
Example
  • Operator Overloading 
  • Function Overloading
package DataHiding;
/**
 * This class illustrates basic data hiding concepts
 * @author nicomp
 */
public class Person {
//  public - a violation of data hiding 'rules'
    public int height;
//  private - not visible outside the class
    private float weight;
     
//  Here are 'get' and 'set' methods for the
//    private variable declared above.   
    public float GetWeight() { return weight;}
    public float SetWeight(float weight){
        if (weight >= 0)
            this.weight = weight;
        return this.weight;
    }
}
b)explain why java is platform independent.also explain how memory manage in java.
ans java is platform independent the meaning of platform here some combination of hardware and system software but here you can understand it as your operating system. java is compiled to an interdimiate form called java byte-code or simply byte code. a java program never really executes immediately after compilation on the host machine. rather this special program called java or java virtual machine reads the byte code ,translate it into the corresponding host machine instruction and then execute the machine instruction a java programing only run if the java virtual machine and some routines have been installed in the computer system.the second important part which make the java is portable is the elimination of hardware architecture dependent constructs
for ex integers  are always 4 bytes long and floating point variables follow the iEEE 754. you dont need to worry  that the interpretation of your integer is going to change if you move from one hardware to another hardware like pentinum to power pc.you devlope java program in any computer system and the execution  of that program is possible an any other computer system loaded with JVM.for ex you can write and compile the java program on windows 98 execute the compiled program on JVm machine of the macintosh  operating system .
  • In Java, memory is allocated only to objects. There is no explicit allocation of memory, there is only the creation of new objects. (Java even treats array types as objects.)

    • In Java, it's easy to let go of an entire "tree" of objects by setting the reference to the tree's root to null; the garbage collector will then reclaim all the objects (unless some of the objects are needed elsewhere). This is a lot easier than coding each of the objects' destructors to let go of its own dependencies (which is a coding-level problem with C++).
    • The Java runtime employs a garbage collector that reclaims the memory occupied by an object once it determines that object is no longer accessible. This automatic process makes it safe to throw away unneeded object references because the garbage collector does not collect the object if it is still needed elsewhere. Therefore, in Java the act of letting go of unneeded references never runs the risk of deallocating memory prematurely.
    Q-2 (a) what is static method ?explain the application of static method with example.
    (ans)A static method is a characteristic of the class not of the object it has created. static variable and methods are also known as class variable since each class method occurs once per class instance of a class or you can say every object is having its own copy of instance variable. a program can execute a static method without creating an object of the class.All other method must be invoked through an object must exit before they can be used.You have seen that every java application program has one main() method this method is always static because java starts execution from this main() method and the time no object is created
    ex
    import java.util.date;
    class Date app
    {public static void main(string args[])
    {
    Date today= new Date();
    system.out.printin(today);
    }
    }
    the point which should be noticed here is that the application never instanitiated the syustem class and that out is referred to directly from the class. this is because out is declared as a static variable:a variable associated with the clasds rather than with an instanceof the class.you can also associate methods with a class-static methods-using static keyword.
    (b)what are different arithmetic and logical operator in java?write a java program and show uses of all arithmetic operator.
    ans)Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra. The following table lists the arithmetic operators:operators are divided into 2 categories unary operator and binary operator addition subtraction multiplication is abinary operator and applied  only on two operant.increment and decrement are unary operators and applied on single operand.let a=10  and b=5

    OperatorDescriptionExample
    +Addition - Adds values on either side of the operatora+b  will give 15
    -Subtraction - Subtracts right hand operand from left hand operanda b- will give 5
    *Multiplication - Multiplies values on either side of the operatora* b will give 50
    /Division - Divides left hand operand by right hand operanda / b will give 2
    %Modulus - Divides left hand operand by right hand operand and returns remaindera%b A will give 0
    ++Increment - Increases the value of operand by 1b++ gives 6
    --Decrement - Decreases the value of operand by 1
    Logical operator-allow you to combine the resuylt of multiple expression to return a single value trhat evaluate to either true or false
    OperatorDescriptionExample
    &&Called Logical AND operator. If both the operands are non-zero, then the condition becomes true.(A && B) is false.
    ||Called Logical OR Operator. If any of the two operands are non-zero, then the condition becomes true.(A || B) is true.
    !Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.!(A && B) is true
    (c) what is final keyword in java?explain different uses of final keyword.
    ans)final keyword-final keyword can be applied with the variable .once you make a reference you final you are not allowed to change that reference and compiler will verify this and raise compilation error if you try to reinitialize final variable in java
    final keyword is used in
    1. variable 
    2. method
    3. class
    final variable- any final variable which modified as final keyword is known as final variable ex of final variable
    class bike
    final int speed limit=90;//final variable
    void run(){
    speed limit=400;
    }
    public static void main(sring args[ ]){
    bike obj=new bike();
    obj.run();
    }
    }//end of class-Java class with final modifier is called final class in java. Final class is complete in nature and can not be sub-classed or inherited. Several classes in Java are final e.g. String, Integer and other wrapper classes. Here is an example of final class in java
    final class in java-
    final class Bike{} 
    class Honda extends Bike{ 
    void run(){System.out.println("running safely with 100kmph");} 
     public static void main(String args[]){  
    Honda honda= new Honda();
    honda.run();
    }
    }
    final method in java-Final keyword in java can also be applied to methods. A java method with final keyword is called final method and it can not be overridden in sub-class. You should make a method final in java if you think it’s complete and its behavior should remain constant in sub-classes. Final methods are faster than non-final methods because they are not required to be resolved during run-time and they are bonded on compile time. Here is an example of final method in Java:
    1. class Bike{  
    2. final void run(){System.out.println("running...");} 
    3. class Honda extends Bike{ 
    4. public static void main(String args[]){  
    5.  new Honda().run();
    6. }
    7. }
    Q-3 what is  method overloading? how it is different from method overriding?write a java program to explain overloading and overriding of methods.
    ans)two or more methodswhich are very similar in nature are required.forexample you can take methods area _s and area _ r in a class test in program of section 1.3 of this units. both the methods are finding area but the argument passed to them and theirf implementation is different. all the methods of similar kinds in a class can have the same name but remember all the methods will have different prototypes this conceptis known as method overloading
    1.  class overload demo

               void triangleArea(float base, float height) 
               { 
                     float area; 
                     area = base * height / 2.0f; 
                     System.out.println(“Area = “ + Area);
               }

               void triangleArea(float side1, float side2, float side3) 
               { 
                        float area,s; 
                        s = (side1 + side2 + side3) / 2.0; 
                        area = Math.sqrt(s*(s-side1) * (s-side2) * (s-side3) ); 
                        System.out.println(“Area = “ + area);
               }
      }

      class MainOverloadDemo

                  public static void main(String args[]) 
                  { 
                          OverloadDemo ovrldDemo = new OverloadDemo(); 
                          ovrldDemo.triangleArea(20.12,58.36); 
                          ovrldDemo triangleArea(63.12,54.26,95.24);
                  } 
      }
    overriding-subclass extending the parent class has access to all the non-private data members and methods its parent class and adding new methods is to extend the behaviour of the parent class.however sometimes it is required to modify the behaviour of parent class . to modify the behaviour of the parent class overriding is use
    SOME IMPORTANT POINTS THAT MUST BE TAKEN CARE WHILE OVERRIDING A METHOD:
    • AN OVERRIDING METHOD(LARGELY) REPLACES THE METHOD IT OVERRIDES.
    • Each methods must have exactly the same arguments lists, both in type and in order.
    • overriding method must have exactly the same return type as the method it overrides
    • each method in parent class can be overridden at most once in any one of the subclass.
    • overriding is associated with inheritance.
    class Super 
    {
         int sum;
         A(int num1, int num2) 
         {
                 sum = a+b;
         }
         void add() 
         {
                System.out.println("Sum : " + sum);
         }
    }
    class Sub extends Sub 
    {
           int subSum;
           Sub(int num1, int num2, int num3) 
           {
                   super(num1, num2);
                   subSum = num1+num2+num3;
           }
           void add() 
           {
                   super.add();
                   System.out.println("Sum of 3 nos : " +subSum);
           }
    }


    b)what is abstract class ? why abstract class use in java with the help of example program.
    ans)when we extending an existing class we have a choice whether to redefine the methods of the super class.basically a superclass has common features that are shared by subclasses. in some cases you will find that superclass can not have any instance(object) and such classes are abstract class .abstract classes usually contain abstracts method.Abstract method is a method signature(declaration) without any implementation .basically this abstract methods provide a common interface derived classes.you know a super class is more general than its subclasses.the super class contains elements and propertiescommon to all of the subclasss.often, the superclass will be setup as an abstract class, which does not allow object of its prototype to be created.in thius case only objects of the subclass are created. to do this the reserved word abstract is included(prefixed) in the class defination.
    1. public abstract class player //class is abstract
    2. {
    3. name=vname;
    4. }
    5. public string getname() //regular method
    6. {return (name);
    7. }
    8. public abstract void play();
    9. //abstract method: no implementation
    }
    Q-4 what is inheritance?explain different type of inheritance supported by  java.
    ans)inheritance is a language property specific to the object-oriented paradigm.inheritance is used for a unique form of code -sharing by allowing you take the implementation of any given class and build a new class  based on that implementation.let us say class b, starts by inheriting all of the data and operations defined in the class a. this new subclass can extend the behaviour by adding additional data and new methods to operate on it. basically during programming inheritance is usedfor extending the existing property of as class. in other words it can be said that inheritance is"from generalization -to -specialization".in this by using general class,class with specific properties can be defined.
    different type of inheritance supported by java

    1. single inheritance-when a class extend another one class only then we  call it a single inheritance.
    ex single inheritance
    Class C
    {
       public void methodC()
       {
         System.out.println("Base class method");
       }
    }
    
    Class E extends C
    {
       public void methodE()
       {
         System.out.println("Child class method");
       }
       public static void main(String args[])
       {
         B obj = new B();
         obj.methodC(); //calling super class method
         obj.methodE(); //calling local method
      }
    }
    2 Multilevel inheritance-:refers to a mechanism in OOp technology where one can inherit from a derived class, thereby making this derived class the base class for the new class. 


    ex of multilevel inheritance

    Class A
    {
       public void methodA()
       {
         System.out.println("Class A method");
       }
    }
    Class B extends A
    {
    public void methodB()
    {
    System.out.println("class B method");
    }
    }
    Class C extends B
    {
       public void methodC()
       {
         System.out.println("class C method");
       }
       public static void main(String args[])
       {
         C obj = new C();
         obj.methodA(); //calling grand parent class method
         obj.methodB(); //calling parent class method
         obj.methodC(); //calling local method
      }
    }
    3 Hierarchical inheritance-:one class is inherited by many sub classes. In below example class B,C and D inherits the same class A. A is parent class (or base class) of B,C & D. 

    Class w
    {
      public void methodA()
      {
         System.out.println("method of Class w");
      }
    }
    Class x extends w
    {
      public void methodx()
      {
         System.out.println("method of Class x");
      }
    }
    Class y extends w
    {
     public void methodC()
     {
     System.out.println("method of Class y");
     }
    }
    Class z extends w
    {
      public void methodD()
      {
        System. out.println("method of Class z");
      }
    }
    Class MyClass
    {
      public void methodx()
      {
         System.out.println("method of Class x");
      }
      public static void main(String args[])
      {
         x obj1 = new x();
         y obj2 = new y();
         z obj3 = new z();
         obj1.methodw();
         obj2.methodw();
         obj3.methodw();
      }
    }


    b)what is an exception?explain how is exception is handled in java.create your own exception class to handle undesirable operation in your program.
    ans)An exception condition is considered as a problem, which stops program execution from continuation from point of occurence of it . Exception stops  you from continuing because of lack of information to deal with the exception condition.in other words it is known what to do in specific conditions.
    Exception in java are handled by the use of these five keywords:try,catch,throw,throws and finally.you have to put these statement s of program on which you want to monitor for exception, in try to block.
    Using try catch-:to catch an exception in java you write a try block with one or more catch clauses.Each catch clause specifies one exception type that it is prepared to handle.The try block places a fence around the code that is under thye watchful eye of the associated catcher.if the bit of code delimited by the try block throws an exception, the associated catch clause that is prepared to handle the thrown exception,the program continues execution starting with first statement of the catch
    clause and the catch block is used to execuring code to handle exception and graceful termination of the program.
    public class Excep_test
    {
    public static void main(string[] args)
    {try{int data[]={2,3,4,5};
    system.out.printin("value at:"+data[4]);
    }catch(arrayindexoutofboundsexception e)
    {
    system.out.printin("sorry you are trying to print beyond the size of data[]");
    }}}
    output
    sorry you are trying to print beyond the size of data[]
    catch of multiple exception-:some time there may be a chance to have multiple exceptions in a program. you can use multiple catch clauses to catch the different kinds of exception in a program . you can use multiple catch clauses to catch the different kinds of exception us raised by a block of code, then to handle these exception more than one catch clauses are used. when an exception is throw in different  catch blocks associated with try block inspect in order and the first one whose type matches with the exception type is executed this code snippet will give you an idea how to catch multiple exceptions.
    public class multicatch
    {
    public static void main(string[] args)
    {
    int repeat;
    try
    {
    repeat=integer.parseint(args[0]);
    }
    catch(arrayindexoutofboundsexception e)
    {
    //pick a default value for repeat
    repeat=1;
    }
    catch(numberformatexception e)
    {
    //print an error message
    system.err.printin("usage:repeat as count");
    system.err.printin("where repeat is the number of times to say hello java");
    system.err.printin("and given as an integer like 2 or 5");
    return;
    }
    for(int i=0;i<repeat;i++0
    {
    system.out.printin("hello");
    }
    }
    }
    output
    hello
    Using finally clause-: there are several ways of exiting from a block of code(the statement between two matching curly braces).once a jvm has begun to execute a block, it can exit that block in any of several waysit could for example simply exit after reaching the closing curly brace.it could encounter to break,continue,or return statements that causes it to jump out of the block from somewhere in the middle.let us take an example of opening a file in a method. you open the file perform needed operation on the file and most importantly you want  to ensure that the file gets closed no matter how the method completes.in java,this kind of desires are fullfilled with the help of finallly clause.
    public class Finally_test
    {
    public static void main(string[]args)
    {
    try
    {
    system.out.printin("hello"+args[0]);
    }
    catch(arrayindexoutofboundsexception e)
    {
    system.out.printin("Hello,you are here after arrayindexoutof boundsexception")P;

    finally
    {
    system.out.printin("finally you have to reach here");
    }
    }
    }
    output
    hello,you are here arrayindexoutofboundsexception
    finally you have to reach here
    Q-5b)what is string class in java?explain different constructor and method of string class also write a java program to find length of the given string.
    ans)java provided two calssesfor handling string values ,which are string.the string class is provided for string whose value will not change.for ex in program you write a method that requires string data and it is not going to modify the string. the string buffer class is used for string that will be modified.string buffers are generally used for constructing character  data dynamically,for ex when you need to store information which may change.
    the string class constructor:

    1. public string():used to create a string object that represent an emptyy character sequence.
    2. public string(string value):used to create a string object that represent the same sequence of characters as the argument;in other words,newly created string is a copy of the string passed an argument
    3. public string(char value[]):new object of string is created using the sequence of characters from a sub-array of the character array argument.
    4. public string(char value[],int offset,int count):a new string object created contains character from a sub array of the character array argument.
    5. public string(byte bytes[],string enc)throws unsupported encoding exception:used to construct a new string by converting the specified array of bytes using the specified character encoding
    6. public string(byte bytes[],int offset,int length):used to create an object of string by converting the specified sub array of bytes using the platform default character encoding.
    7. public string(byte bytes[]):used to create an object of string by converting the specified array of bytes using the platform default character encoding.
    8. public string(string Buffer buffer): used to create an object of string by using existing string buffer object which is passed as arguments.

     
    public class StringLengthExample {
     
      public static void main(String[] args) {
        //declare the String object
        String str = "Hello World";
       
        //length() method of String returns the length of a String.
        int length = str.length();
        System.out.println("Length of a String is : " + length);
      }
    }
     
    /*
    Output of a program would be:
    Length of a String is : 11


    Q-6 what is multithreading ? write a java program to explain how concurrency control  is done .
    ans)multithreaded programs support more than one concurrent thread of execution.this means they are able to simultaneously execute multiple sequences of instructions.Each instruction sequence has its own unique flow of control that is independent of all others .these independently executed instruction sequence are known as threads.in single processor system only a single thread of execution occurs at a given instant . but multiple threads in a program  increase the utilization of cpu.The cpu quickly switches back and the forth between several threads to create an illusion that the threads are executing at the same time.you that single system processor support logical concurrency only.physical concurrency is not supported by it logical concurrency is the characteristics exhibited when multiple threads execute with separate ,independent flow of control.on the other hand on a multiprocessor system, several threads can execute at the same time and physical concurrency is achieved.
    the advantage of multithreaded programs is that they support logical concurrency. many programming languages support multiprogramming, as it is the logically concurrent execution of multiple prrograms.for ex a program can request the operating system to execute the program A,B and C  by having it spawn a aeperate process for each program.these program can run in concurrent manner,depending upon the multi programming features supported by the underlying operating system.
    b)what is i/o stream in java?explain what is byte stream? how byte stream is different from character stream.
    ans)java input and output  is based on the use of streams .or sequences of bytes that travel from a source to a destination over a communication path. if the program is writing to a stream you can consider it as a stream source.if it is reading from a stream it is the stream destination.
    an input stream represent a stream of data from which data can be read . again, this stream will be either directly connected to a device or else another stream.
    an output stream represent a stream to which dadta can be written . Typically this stream will either be directly connected to device such as a file a network connection or to another output stream.
    byte streams carry integers with values that range from 0 to 255. a diversified data can be expressed in byte format including numerical data executable programs and byte codes-the class file that runs a java program.
    character stream are specialized type of byte stream that can handle only textual data. most of the functionallity available for byte streams is also provided for character streams.the methods for character streams generally accept parameters of datatype  char,while byte stream work with byte data types. the names of the methods in both sets of classes are almost identical except for the suffix,that is character-stream classes end with the suffix reader or writer and byte stream classes end with the suffix input stream and  output stream.
    Q-7 a)What is Java Applet? Create an Applet program to display
    your details including your academic and personal information. Use appropriate GUI components and images to make your applet more attractive and informative.
    ans) The Applet class is packed in the Java. Applet package which has several interfaces.These interfaces enable the creation of Applets, interaction of Applets with the browser, and playing audio clips in Applets. In Java 2, class Javax.swing. J Applet is used to define an Applet that uses the Swing GUI components.As you know, in Java class hierarchy Object is the base class of Java.lang package.
    The Applet is placed into the hierarchy as follows:


    Java Applets are essentially Java programs that run within a web page. Applet
    programs are Java classes that extend the Java.Applet.Applet class and are embedded
    by reference within a HTML page. You can observe that when Applets are combined
    with HTML, they can make an interface more dynamic and powerful than with
    HTML alone. While some Applets do nothing more than scroll text or play
    animations, but by incorporating these basic features in web pages you can make
    them dynamic. These dynamic web pages can be used in an enterprise application to
    view or manipulate data coming from some source on the server.
    b)What are principles of event delegation model?Explain different sources of events and event listener.
    ans) This model allows special classes, known as “adapter classes” to be built and be registered with a component in order to handle certain events. Three simple steps are required to use this model:
    1. Implement the desired listener interface in your adapter class. Depending on
    what event you’re handling, a number of listener interfaces are available. These
    include: ActionListener, WindowListener, MouseListener,
    MouseMotionListener, ComponentListener, FocusListener, and
    ListSelectionListener.
    2. Register the adapter listener with the desired component(s). This can be in theform of an add XXX Listener () method supported by the component for example include add ActionListener (), add Mouse Listener (), and add FocusListener ().
    3. Implement the listener interface’s methods in your adapter class. It is in this
    code that you will actually handle the event. The event delegation model allows the  developer to separate the component’s display (user interface) from the event handling (application data) which results in a cleaner and more object-oriented design
    AWT provides two conceptual types of events: Semantic and Low-level events.
    Semantic event : These are defined at a higher-level to encapsulate the semantics of
    user interface component’s model.
    Now let us see what the various semantic event classes are and when they are
    generated:
    An ActionEvent object is generated when a component is activated.
    An Adjustment Event Object is generated when scrollbars and other adjustment
    elements are used.Low-Level Events: These events are those that represent a low-level input or
    windows-system occurrence on a visual component on the screen.
    The various low-level event classes and what they generate are as follows:
    • A Container Event Object is generated when components are added or
    removed from container.
    • A Component Event object is generated when a component is resized moved
    etc.
    • A Focus Event object is generated when component receives focus for input.
    • A Key Event object is generated when key on keyboard is pressed, released
    etc.
    • A Window Event object is generated when a window activity, like maximizing
    or close occurs.
    • A Mouse Event object is generated when a mouse is used.
    • A Paint Event object is generated when component is painted
    Event Listeners: An object delegates the task of handling an event to an event
    listener. When an event occurs, an event object of the appropriate type (as explained
    below) is created. This object is passed to a Listener. The listener must implement
    the interface that has the method for event handling. A component can have multiple
    listeners, and a listener can be removed using remove Action Listener () method.
    You can understand a listener as a person who has listened to your command and is
    doing the work which you commanded him to do so.The semantic listener
    interfaces defined by AWT for the above-mentioned semantic events are:
    • ActionListener
    • Ajdjustment  Listener
    • ItemListener
    • TextListener
    The low-level event listeners are as follows:
    • ComponentListener
    • ContainerListener
    • FocusListener
    • KeyListener
    • MouseListener
    • MouseMotionListener
    • Windows Listener

    Q8 a)What is InetAddress class in Java ? Explain its methods and their uses.
    ans)This class is used for encapsulating numerical IP address and domain name for that address.Because InetAddress is not having any constructor, its objects are created by using any of the following three methods static InetAddress getLocalHost() throws UnknownHostException: returns the InetAddress object representing local host static InetAddress getByName() throws UnknownHostException:
    returns the InetAddress object for the host name passed to it. static InetAddress getAllByName() throws UnknownHostException: returns an arrayof InetAddresses representing all the addresses that a particular name is resolves to.

    b)What is RMI? Explain architecture of RMI.
    ans)Java provides RMI (Remote Method Invocation), which is “a mechanism that allows Advance Java
    one to invoke a method on an object that exists in another address space. The other
    address space could be on the same machine or a different one. The RMI mechanism
    is basically an object-oriented RPC mechanism.”
    RPC (Remote Procedure Call) organizes the types of messages which an application
    can receive in the form of functions. Basically it is a management of streams of data
    transmission.
    RMI applications often comprised two separate programs: a server and a client.
    A typical server application creates some remote objects, makes references to them
    accessible, and waits for clients to invoke methods on these remote objects.
    A typical client application gets a remote reference to one or more remote objects in
    the server and then invokes methods on them.
    RMI provides the mechanism by which the server and the client communicate and
    pass information back and forth. Such an application is sometimes referred to as a
    distributed object application.
    RMI ARCHITECTURE-:
    1. Stub/Skeleton layer – client-side stubs and server-side skeletons.
    2. Remote reference layer-invocation to single or replicated object
    3. Transport layer-connection set up and management, also remote object tracking
























































































































































































































































































































































































    Entri Populer

    www.CodeNirvana.in

    infolink adds

    Powered by Blogger.

    Translate

    Total Pageviews

    Copyright © ignou solved assignments | Distributed By My Blogger Themes | Designed By Code Nirvana