Monday, April 7, 2014

ACID properties of transaction

Transaction :-
                      A transaction is collection of operations that performs a single logical function in a database application that may lead to success or failure in operation maintaining integrity.

ACID properties of transaction :-

Atomicity :-
Transaction must be either performed full or not at all.
It will run to completion as as individual unit ,at the end of which either no change have
occurred to database or database has been changed in consistent manner .
At the end of transaction update it will be accessible to all.

Consistency :-
A correct execution of transaction must take DB from one consistent state to another,
programmer is responsible for this.
This property implies that if database was in consistent state before start of transaction ,then
at any time of termination too it must be consistent.

Independence:-
Transaction must not make its update visible to other transactions.
All actions performed by it must be independent.
This property gives transaction a measure of relative independence.

Durability:-
Once changes are committed must never be lost .
And any updating in database may not loss updates made by transaction.

Sunday, April 6, 2014

SOLVE QUESTION ANSWERS ON OPERATING SYSTEM .


1.One can interface with operating system by means of -------
A) Operating system call in a program
B) Operating system commands
C) Operating system process
D) Both by operating system call and operating system commands

Answer :-  D) Both by operating system call and operating system commands


2. Which of the following is not type of processing ?
A) Serial
B) Network
C) Batch
D) Multiprogramming

Answer :- B) Network


3. Kernel is _____
A) A part of operating system
B) An operating system
C) A hardware
D) A register

Answer :-  A) A part of operating system



4. UNIX operating system is based on ______
A) Language structure
B) Kernel approach
C) Virtual machine
D) Time sharing

Answer :-   B) Kernel approach


5. A transition between two memory resident process in a memory resident process in amultiprograming system is called ______
A) Process switch
B) Mode switch
C) Transition switch
D) None of these

Answer :-    A) Process switch


6. Round robin scheduling algorithm falls under category of _____
A) Preemptive scheduling
B) Non- preemptive scheduling
C) Sometime preemptive sometime non-preemptive
D) None of tehse
Answer :-  A) Preemptive scheduling


7. Paging is  a _______
A) Virtual memory
B) Memory management scheme
C) Allocation of memory
D) Deadlock prevention scheme

Answer  :-    B) Memory management scheme


8. The first version of UNIX was written by _____
A) Dennis Ritchie
B) Andrew S
C) Ken Thompson
D) None of these


Answer :- C) Ken Thompson


9. Chaining and Indexing are the strategies of ______
A) Contiguous allocation
B) Non-contiguous allocation
C) Partition allocation
D) Static allocation

Answer :-  B) Non-contiguous allocation



10. Wasting of memory within a partition ,due to a difference in size of a partition and of the object resident within it is called _____
A) External fragmentation
B) Internal fragmentation
C) Compaction
D) Coalescing

Answer :-   B) Internal fragmentation


11.Which of the following is an operating system call ?
A) CREATE
B) LINK
C) SYSTEM
D) All of these

Answer :-    D) All of these


12.The primary job as the operating  system of a computer is to
A) command resources
B) manage resources
C) provide utilities
D) be use friendly

Answer : -  B) manage resources



13.Dirty bit for a page in a page table
A) helps avoid unnecessary writes on a paging device
B) helps maintain LRU information
C) allows only read on a page
D) none of these

Answer : -   A) helps avoid unnecessary writes on a paging device

14. The term "operating system " means
A) a set of programme which controls computer working
B) the way a computer operator works
C) conversion of high language into machine code
D)  the way a floppy disk drive operates

Answer :-  A) a set of programme which controls computer working


15. Windows is a/an
A) operating system
B) user interface
C) operating environment
D) programming platform

Answer :-  C) operating environment


16. When did IBM released teh first version of its Disk Operating System (DOS) version 1.0?
A) 1981
B) 1982
C) 1983
D) 1984


Answer :- A) 1981



Click here to read more .......

Network Topology

  • Compute network:-
Goals:-
1.Resource sharing .
2.Provide High Reliability
3.Distribution of workload
4.Saving Money
5.Expandability
6.Powerful communication Medium.
7.Protecting Information.
8.Preserving Information.

Applications:-
1) Business Applications
2) Home Applications

Network architecture describes how a computer network is configured and what strategies are employed .
Configurations include star, bus, ring, mesh and hierarchical. Strategies include terminal, peer-to-peer and  client-sever.

  • Network Hardware :-
Broadcasting :-
1.Addressing a packet to all destinations.
2.Received by every machine on network.
3.Multicasting

Point to point:-
1.Network connections between  individual pairs.
2.Packet may visit one more intermediate machines
3.Uni-casting.

A network can be arranged or configured in several different ways.This arrangement is called the network's topology.

Network topologies:-  Physical topologies -

MESH topology:-
1.Interconnected topology.
2.Point to point link.
3.n(n-1)/2 links for n devices.
4.Direct communication
5.Highest degree of fault tolerance


Advantages:
1.Traffic problems eliminated .
2.Robust
3.Fault identification and fault isolation easy.
4.Privacy.
5.Highest  reliability and security.

Disadvantages:
1Amount of cabling
2.Number of I/O ports.
3.Reconnection is difficult.
4.Installation of new devices is difficult.
5.Expensive.



STAR topology:-
1.Point to point link.
2.Hub central controller.
3.Communication through controller.
4.Controller exchange data.



Advantages :
1.Requires only one link and one I/O port
2.Less expensive.
3.Easy to install.
4.Robust.
5.Fault identification and isolation easy.

Disadvantages:
Performance depends on hub.
Therefore if hub fails.
So,Network stops
Since speed depends on hub connections.

In a star network,a number of small computers or peripheral devices are linked to a central unit.This central unit may be a host computer or a file server.
All communications pass through this central unit 
Control is maintained by polling. That is ,each connecting device is asked (polled) whether it has a message to send .Each device is then in turn allowed to send its message.
One particular advantage of the star form of network is that it can be used to provide a time-sharing system. That is , several users can share resources (time) on a central computer.
The star is a common arrangement for linking several microcomputers to a mainframe that allows access to an organization's database.

BUS Topology:-

1.Linked by single cable i.e. multi point topology.
2.Devices have Drop lines and taps.
3.Used in LAN.


Advantages:-
1.Easy t install.
2.Cabling requires less compare to mesh and star.

Disadvantages:
1.Limited number of devices support .
2.Difficult to identify and isolate fault.
3.Degradation in quality of signal.
4.Bus cable fault ,stops all transmission.

In bus network each device in the network handles its own communications control.There is no host computer.
All communications travel along a common connecting cable called a bus.
As the information passes along the bus,it is examined by each device to see if the information is intended for it.
The bus network is typically used when only a few microcomputers are to be linked together.This arrangement is common for sharing data stored on different microcomputers.
The bus network is not as efficient as the star network for sharing common resources.
However , a bus network is less expensive and is in very common use.

RING topology:-

1.Connected to two devices .
2.Point to point link dedicated .
3.Signal travels in one direction.
4.Device relay ,if not intended.



Advantages:
1.Easy to install or reconfigure.
2.Fault isolation is easy.
3.Token

Disadvantages:-
1.Ring break ,network disable.
2.Number of devices connected and ring length.
3.Unidirectional ,data transfer is slow.

In ring network, each device is connected to two other devices , forming a ring .
There is no central file or computer.Messages are passed around the ring until they reach the correct destination.
With microcomputers, the ring arrangement is the least frequently used of the other networks .
However ,it often is used to link mainframes ,especially over wide geographical areas. These mainframes tend to operate fairly autonomously.
They perform most or all of their  own processing and only occasionally share data and programs with other mainframes.



HYBRID topology:-

1.Combination of topologies,not basic topology.
2.Two different basic topologies connection.
3.WAN have it.


Computer network - OSI and TCP/IP

Comparison between OSI and TCP/IP :-

OSI TCP/IP
1. Open Systems Interconnection 1. Transfer Control Protocol / Internet protocaol
2.Number of layers are seven (7). 2.Number of layers are four (4).
3.Connection oriented and connectionless
in network and only connection oriented in transport.
3.Only connectionless in Internet and both in Transport.
4. Distinction
1.Services
2.Interfaces
3.Protocols
4.Does not distinction between them.
5.Model first developed.
Therefore, Not biased toward one protocol general model.
5.Protocol first developed
Therefore, does not fit any other protocol stack.
6.No thought was given to inter-networking 6.Main goal to handle inter-networking.
7.Model useful,Protocols not popular. 7.Model not widely accepted ,Protocols universally used.
8.S and P layers empty.
D and N layers overfull.
Many function addressing ,flow control and error control reappear.
8.No distinguish nor mention P and D layer even have functionalities.

Computer network - Service

 Service :-
Service
_______________________|___________________
|                                                                                 |
                   Connection Oriented                                                       Connectionless
                   _______|_________                            ___________________|__________
                   |                              |                         |                              |                        |
Reliable connection       Unreliable connection      Unreliable        Acknowledgement      Request-
oriented service                                                    data-gram            data-gram                   reply
      ______|__________
      |                               |
Message stream         Byte stream


Difference between Connection oriented and Connectionless

          Connection-oriented                                                    Connectionless
1. It is similar to telephone system.                     1. This is modeled after the postal system.

2. Packets received are in same order as sent.    2. Messages arrive out of order.

3.Each service can be characterized by quality    3.Not all applications require reliable service
   of service-reliable or unreliable.                           and not all require connection oriented
                                                                              communication.
4.It has services:                                                 4.It has services: -
   i) Reliable message stream.                                  i) Unreliable data-gram
   ii) Reliable byte stream                                         ii)  Acknowledged data-gram
   iii) Unreliable connection.                                     iii) Request -reply

5. It has example:-                                               5.It has example
   i) Sequence of pages                                            i) Electronic junk mail.
   ii) Remote login.                                                   ii) Registered mail.
   iii) Digitized voice                                                 iii) Database query.



Services primitive :-
1) Set of primitives (operations)
2)Available to user process to access service.
3)depend on service.


Service primitive for implementing a simple connection oriented service:
     Primitive                                                           Meaning
1) LISTEN                -      Block waiting for an incoming connection.
2) CONNECT          -      Establish a connection with a waiting peer
3) RECEIVE             -      Block waiting for an incoming message
4) SEND                   -      Send a message to the peer.
5) DISCONNECT    -      Terminate a connection.

Saturday, April 5, 2014

Program in C++ for play-game TIC TAC TOE

#include <iostream.h>
#include <conio.h>

char square[10] = {'0','1','2','3','4','5','6','7','8','9'};
int testwinner();
void playchart();

int main()
{
    int player = 1,i,choice;
    char mark;
    clrscr();
    do
    {
        playchart();
        player=(player%2)?1:2;
        cout << "Player " << player << ", enter a number ==>  \a ";
        cin >> choice;
        mark=(player == 1) ? 'X' : 'O';
        if (choice == 1 && square[1] == '1')
            square[1] = mark;
        else if (choice == 2 && square[2] == '2')
            square[2] = mark;
        else if (choice == 3 && square[3] == '3')
            square[3] = mark;
        else if (choice == 4 && square[4] == '4')
            square[4] = mark;
        else if (choice == 5 && square[5] == '5')
            square[5] = mark;
        else if (choice == 6 && square[6] == '6')
            square[6] = mark;
        else if (choice == 7 && square[7] == '7')
            square[7] = mark;
        else if (choice == 8 && square[8] == '8')
            square[8] = mark;
        else if (choice == 9 && square[9] == '9')
            square[9] = mark;
        else
        {
            cout<<"Invalid move ";
            player--;
            getch();
        }
        i=testwinner();
        player++;
    }while(i==-1);
    playchart();
    if(i==1)
        cout<<"==>\aPlayer "<<--player<<" win ";
    else
        cout<<"==>\aGame draw";
    getch();
    return 0;
}

int testwinner()
{
    if (square[1] == square[2] && square[2] == square[3])
        return 1;
    else if (square[4] == square[5] && square[5] == square[6])
        return 1;
    else if (square[7] == square[8] && square[8] == square[9])
        return 1;
    else if (square[1] == square[4] && square[4] == square[7])
        return 1;
    else if (square[2] == square[5] && square[5] == square[8])
        return 1;
    else if (square[3] == square[6] && square[6] == square[9])
        return 1;
    else if (square[1] == square[5] && square[5] == square[9])
        return 1;
    else if (square[3] == square[5] && square[5] == square[7])
        return 1;
    else if (square[1] != '1' && square[2] != '2' && square[3] != '3' &&
             square[4] != '4' && square[5] != '5' && square[6] != '6' &&
            square[7] != '7' && square[8] != '8' && square[9] != '9')
        return 0;
    else
        return -1;
}

void playchart()
{
    clrscr();
    cout << "\n\n\tTic Tac Toe\n\n";
    cout << "Player 1 (X)  -  Player 2 (O)" << endl << endl;
    cout << endl;
    cout << "     |     |     " << endl;
    cout << "  " << square[1] << "  |  " << square[2] << "  |  " << square[3] << endl;
    cout << "_____|_____|_____" << endl;
    cout << "     |     |     " << endl;
    cout << "  " << square[4] << "  |  " << square[5] << "  |  " << square[6] << endl;
    cout << "_____|_____|_____" << endl;
    cout << "     |     |     " << endl;
    cout << "  " << square[7] << "  |  " << square[8] << "  |  " << square[9] << endl;
    cout << "     |     |     " << endl << endl;
}


Click here for more programs on C++

Program in C to sort all words of text in alphabatical order.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<conio.h>
void sort_string(char*);
 int main()
{
   char string[100];
   clrscr();
   printf("Enter some text\n");
   gets(string);

   sort_string(string);
   printf("%s\n", string);
   getch();
   return 0;

}

void sort_string(char *s)
{
   int c, d = 0, length;
   char *pointer, *result, ch;

   length = strlen(s);

   result = (char*)malloc(length+1);

   pointer = s;

   for(ch='a';ch<='z';ch++ )
   {
      for(c=0;c<length;c++ )
      {
         if(*pointer == ch )
         {
            *(result+d) = *pointer;
            d++;
         }
         pointer++;
      }
      pointer = s;
   }
   *(result+d) = '\0';
   strcpy(s, result);
   free(result);
}
Click here for more programs on C++

From Side Hustle to Main Income: 7 Proven Ways to Make Money Online in 2025

  From Side Hustle to Main Income: 7 Proven Ways to Make Money Online in 2025 Introduction: The New Era of Earning – Why 2025 is Your Year t...