World's most popular travel blog for travel bloggers.
Showing posts with label Solved. Show all posts
Showing posts with label Solved. Show all posts
MCSL054

MCSL054-2

MCSE003

MCSE011

MCS053

MCS051

MCS053-2

MCSE004

Ignou Assignment Cover Page

053 Scanline algo

#!/bin/bash
# isuserloggedin.sh
# Usage: isuserloggedin.sh username
# Shell script which checks after every one minute whether a user has logged in
# or not
# You can also run script in background using & then foreground it to view result

if [ $# -ne 1 ]
then
   echo "You supplied wrong arguments"
   echo "usage : `basename $0` username"
exit 1
fi

isuserexist()
{
grep -w "$1" /etc/passwd > /dev/null

if [ $? -eq 1 ]
then
   echo "$1 is not a valid user"
exit 1
fi
}

isuserexist $1
time=0
while true
do
#  you can replace following two statements with
#   if `who|grep $1 > /dev/null`
who|grep $1 > /dev/null
if [ $? -eq 0 ]
then
  echo "User $1 is logged in "
  if [ $time -gt 60 ]
  then
     hours=$((time/60))
     minutes=$((time%60))
     echo "He is logged in $hours hour(s) $minutes minute(s) late"
  else
     echo "He is logged in $time minute(s) late"
  fi
exit 0

else
let time++

# You can use following formats also
#   time=`expr $time + 1 `
#  time=$((time+1))

sleep 60
fi
done

Output:
[root@localhost shell]# sh isuserloggedin.sh
you have suplied wrong arguments
usage : isuserloggedin.sh username
[root@localhost shell]# sh isuserloggedin.sh root
User root is logged in
He is logged in 0 minute(s) late
[root@localhost shell]# sh isuserloggedin.sh roott
roott is not a valid user
Run script in background
[root@localhost shell]# sh isuserloggedin.sh venu &
[1] 15917
[root@localhost shell]# User venu is logged in
He is logged in 3 minute(s) late

[1]+ Done sh isuserloggedin.sh venu
Run script in background then foreground it
[root@localhost shell]# sh isuserloggedin.sh venu &
[1] 16223
[root@localhost shell]# fg
sh isuserloggedin.sh venu
User venu is logged in
He is logged in 1 minute(s) late
[root@localhost shell]#

Key Differences Between Strong Entity and Weak Entity

  1. The basic difference between strong entity and a weak entity is that the strong entity has a primary key whereas, a weak entity has the partial key which acts as a discriminator between the entities of a weak entity set.
  2. A weak entity always depends on the strong entity for its existence whereas, a strong entity is independent of any other entity’s existence.
  3. A strong entity is denoted with a single rectangle and a weak entity is denoted with a double rectangle.
  4. The relationship between two strong entities is denoted with single diamond whereas, a relationship between a weak and a strong entity is denoted with double diamond called Identifying Relationship.
  5. The strong entity may or may not show the total participation in its relations, but the weak entity always shows total participation in the identifying relationship which is denoted by the double line.
Design ER n Table accordingly

Given the following semi-structure data in XML, create the DTD 
(Document Type Declaration) for it 

<document>
    <student>
      <NAME>
      <Address>
    </student>
   <student>
      <NAME>
      <Address>
   </student>
</document>

What are the different options available for storing XML data?


The Dinning-philosopher Problem


Five philosophers sit around a circular table. Each philosopher spends his life alternatively thinking and eating. In the center of the table is a large bowl of rice. A philosopher needs two chopsticks to eat. Only 5 chop sticks are available and a chopstick is placed between each pair of philosophers. They agree that each will only use the chopstick to his immediate right and left.

From time to time, a philosopher gets hungry and tries to grab the two chopsticks that are immediate left and right to him.When a hungry philosopher has both his chopsticks at the same time, he eats without releasing his chopsticks. When he finishes eating, he puts down both his chopsticks and starts thinking again.

Here’sa solution for the problemwhich does not require a process towrite another process’s state, and gets equivalent parallelism.

#define N 5  /* Number of philosphers */
#define RIGHT(i) (((i)+1) %N)

#define LEFT(i) (((i)==N) ? 0 : (i)+1)
typedef enum { THINKING, HUNGRY, EATING } phil_state;
phil_state state[N];
semaphore mutex =1;
semaphore s[N]; 

/* one per philosopher, all 0 */
void get_forks(int i) {
         state[i]= HUNGRY;
         while ( state[i] == HUNGRY ) {
            P(mutex);
               if ( state[i]== HUNGRY &&
                    state[LEFT] != EATING &&
                    state[RIGHT(i)] != EATING) {
                   state[i]= EATING;
                   V(s[i]);
               }
      V(mutex);
     P(s[i]);
 }
}
void put_forks(int i) {
       P(mutex);
      state[i]=THINKING;
      if ( state[LEFT(i)]== HUNGRY ) V(s[LEFT(i)]);
      if ( state[RIGHT(i)]== HUNGRY) V(s[RIGHT(i)]);
       V(mutex);
      } 

void philosopher(int process) {
       while(1) {
             think();
            get_forks(process);
            eat();
            put_forks();
   }
} 
Keep visiting I am uploading them. Many of the solutions on internet is not correct, so please don't copy them

Download complete assignments from IgnouGroup.com

(1) repeater

 Repeaters: repeters also called regenerator, are physical hardware device. They connet two network segments and broadcast packets between them they have the primary function to regenerate the electrical signal:
·         Reshaping the wavefrom
·         Amplifying the waveform
·         Retiming the singnal, to avoid collision on the network
As signal travels along a cable, its strength or amplitude decreases. This is called attenuation. In other words, the signal attenuates as it travels along  a cable. This limits the length of a cable used to connect the computers together. Since singnal is a factor in the maximum length of a segment, repeater can cable length. A repeater has intelligence so that it takes a weak signal from one cable segment, regenerates it and passes it on to the next segment. The repeater does not amplift the original signal, it regenrates the original bit pattern.

(2) Hub

Hubs can also be called either MUlti port Tepeaters or concentrators. They are physical hardware devices. A hub is similar to a repeater, except that it broadcasts data received by any port to all other ports on the hub. Intelligent Hubs can perform basic diagnostics, and test the nodes to see if they are operating correctly. If they are not, the samrt hubs(or Intelligents Hubs) will remove the node form the network. Hubs are used to provide a physical star Topology the logical Topology is dependent on the medium Access control Protocol.

(3) Bridge

A bridge sends the data frames only to the concerned segment, thus preventing excess traffic. A bridge can split an overloaded network into two separate network, reducing the amount to traffic on each segment and thus making each network more efficient. Bridges can also be used to connect dissimilar networks like Ethernet system to a Token Ring system. Bridges are both hardware and software devices.

(4) Router

A router can connect network that use different technologies, addressing methods, media type, frame formats and speeds. A router keeps track of the address of all the segment of a network and can even determine the best path for sending data. Routers do not pass broadcast traffic.

(5) Gateway


A gateway is the Hardware software that is used to interconnect LANs and WANs. Gateway are much more complex and powerful than a router. They are slower than a router and are expensive. A grateway incorporates the functions of routers and bridges, but it can translate instruction set on sending network into corresponding instruction set of the receiving network.
(1)cAT[OPTIONS] FILE  -  concatenate (list) a file

(2) diff [option] file1 file2  - compare the two files and display the differnces (text files only)

(3) sort [option] file  -  read commands form the file and execute them in the current shell. source: C shell, :Bpurne charc


(4)cmp[option] file1 file2  -  compress file and save it as file.Z