Monday, February 25, 2019

Data Structure: Introduction


Data item refers to a single unit of values.

An entity is something that has certain attributes or properties which may be assigned values. Entities with similar attributes from an entity set.

Information is meaningful or processed data.

A field is a single elementary unit of information representing an attribute of an entity.

A record is the collection of field values of a given entity.

A file is the collection of records of the entities in a given entity set. A file can have fixed-length records or variable-length records. In fixed-length records, all the records contain the same data items with the same amount of space assigned to each data item. In variable-length records, file records may contain different length.

The logical or mathematical model of a particular organization of data is called a data structure.

The simplest type of data structure is a linear array. By a linear array, we mean a list of a finite number of similar data elements.

In the linked lists, each record has a value and a pointer which points to the next item in the list and so.

Data frequently contain a hierarchical relationship between various elements. The data structure which reflects this relationship is called a tree.

A stack is also called a last-in-first-out (LIFO) system. It is a linear list in which insertions and deletions can take place only at one end called top.

A queue is also called a first-in-first-out (FIFO) system. It is a linear list in which deletions can take place at one end of the list called front and the insertions can take place at the other end called rear of the list.

Data sometimes contain a relationship between pairs of elements which is not necessarily hierarchical in nature. The data structure which reflects this type of relationship is called a graph.

Thursday, February 21, 2019


Computer Networks

Q1. What is a Network?
A1. A network is a set of devices connected to each other using a physical transmission medium. In a network, nodes are used to connect two or more networks.

Q2. What is a node?
A2. Two or more computers directly by an optical fiber or any other cable. A node is a point where a connection established. It is a network component which is used to send, receive and forward the electronic information. A device connected to a network is also termed as node.

Q3. What is Network Topology?
A3. Network topology is a physical layout of the computer network and it defines how the computers, devices, cables, etc. are connected to each other.

Q4. What are routers?
A4. The router is a network device which connects two or more network segments. The router is used to transfer information from the source to destination. Routers send the information in terms of data packets and when these data packets are forwarded from one router to another router then the router reads the network address in the packets and identifies the destination network.

Q5. What is OSI reference model?
A5. Open System Interconnection, the name itself suggest that it is a reference model which defines how applications can communicate with each other over a networking system. It also helps to understand the relationship between networks and defines the process of communication in a network.

Q6. What are the layers in OSI reference Models? Describe each layer briefly?
A6. 1. Physical Layer: Physical Layer converts data bits into electrical impulse or radio signals. Ex: Ethernet.

2. Data Link Layer: At data link layer, data packets are encoded and decoded into bits and it provides a node to node data transfer. Data link layer also detects the errors occurred at layer1.

3. Network Layer: Network Layer transfers variable length data sequence from one node to another node in the same network. This variable length data sequence is also known as “Datagrams”.

4. Transport Layer: It transfers data between nodes and also provides acknowledgement of successful data transmission. It keeps track of transmission and sends the segments again if the transmission fails.

5. Session Layer: Session Layer manages and controls the connections between computers. It establishes, coordinates, exchange and terminates the connections between local and the remote applications.

6. Presentation Layer: It is also called as “Syntax Layer”. It transforms the data into the form in which the application layer accepts.

7. Application Layer: This is the last layer of OSI reference Model and is the one which is close to the end user. Both end user and application layer interacts with the software application. This layer provides services for email, file transfer, etc.

Q7. What is the difference between Hub, Switch and Router?
A7.  1. Hub is least expensive, least intelligent and least complicated of the three. Switches work similarly like Hubs but in a more efficient manner. The router is smartest and most complicated out of these three.
2. It broadcast all data to every port which may cause serious security and reliability concern. Switches create connections dynamically and provide information only to the requesting port. Routers are similar like little computers dedicated for routing network traffic.
3. In a network, Hub is a common connection point for devices connected to the network. Hub contains multiple ports and is used to connect segments of LAN. Switch is a device in a network which forwards packets in a network. Routers are located at gateway and forwards data packets.

Q8. Explain TCP/IP Model?
A8. The most widely used and available protocol is TCP/IP i.e. Transmission Control Protocol and Internet Protocol. TCP/IP specifies how data should be packaged, transmitted and routed in their end to end data communication. There are 4 layers in TCP/IP model.
1.       Application Layer: This is the top most layer in TCP/IP model. It includes processes which use transport layer protocol to transmit the data to their destination. There are different Application layer protocols such as HTTP, FTP, SMTP, SNMP etc.
2.       Transport Layer: It receives the data from the application layer which is above transport layer. It acts as a backbone between the host’s system connected with each other and it mainly concerns about the transmission of data. TCP and UDP are mainly used as a transport layer protocols.
3.       Network or Internet Layer: This layer sends the packets across the network. Packets mainly contain source and destination IP addresses and actual data to be transmitted.
4.       Network Interface Layer: It is the lowest layer of TCP/IP model. It transfers the packets between different hosts. It includes encapsulation of IP packets into frames, mapping IP addresses to physical hardware devices, etc.

Q9. What is HTTP and what port does it use?
A9. HTTP is Hyper Text Transfer Protocol and it is responsible for web content. Many web pages are using HTTP to transmit the web content and allow the display and navigation of Hyper Text. The primary protocol and port used here is TCP port 80.

Q10. What is HTTPS and what port does it use?
A10. HTTPS is a Secure HTTP. HTTPS is used for secure communication over a computer network. HTTPS provides authentication of websites which prevents unwanted attacks. In a bi-directional communication, HTTPS protocol encrypts the communication so that tampering of the data gets avoided. With the help of a SSL certificate, it verifies if the requested server connection is s valid connection or not. HTTPS uses TCP with port 443.


Q11. What are TCP and UDP?
A11. TCP and UDP are the most widely used protocols that are built on the top of IP protocol. Both protocols are used to send bits of data over the Internet, which is also known as ‘packets’. When packets are transferred using either TCP or UDP, it is sent to an IP address. These packets are traversed through router to the destination.
1.       TCP stands for Transmission Control Protocol. UDP stands for User Datagram Protocol.
2.       Once the connection is setup, data can be sent bi-directional i.e. TCP is a connection oriented protocol. UDP is connectionless, simple protocol. Using UDP, messages are sent as packets.
3.       The speed of TCP is slower than UDP.
4.       TCP is used for the application where time is not critical part of data transmission. UDP is suitable for the applications which require fast transmission of data and time is crucial in this case.
5.       TCP transmission occurs in a sequential manner. UDP transmission does not occur in a sequential manner but it does not maintain the same sequence when it reaches the destination.
6.       TCP is a heavy weight connection. UDP is a light weight connection.
7.       TCP tracks the data sent to ensure no data loss during data transmission. UDP does not ensure whether receiver receives packets or not. If packets are misses then they are just lost.

Q12. What is Stop-and-Wait protocol?
A12. In Stop-and-Wait protocol, a sender after sending a frame waits for acknowledgement of the frame and sends the next frame only when acknowledgement of the frame has received.

Q13. What is piggybacking?
A13. Piggybacking is used in bi-directional data transmission in the network layer (OSI model). The idea is to improve efficiency piggy back acknowledgement of the received data on the data frame to be sent instead of sending a separate frame.

Q14. What happens when you type a URL in a web browser?
A14. A URL may contain request to HTML, image file or any other type. If content of the typed URL is in cache and fresh, then display the content. Else find IP address for the domain so that a TCP connection can be setup. Browser does a DNS lookup. Browser needs to know IP address for a URL, so that it can setup a TCP connection. This is why browser needs DNS service. Browser first look for URL-IP mapping browser cache, then in OS cache. If all caches are empty, then it makes a recursive query to the local DNS server. The local DNS server provides the IP address. Browser sets up a TCP connection using three way handshake. Browser sends a HTTP request. Server has a web server like Apache, IIS running that handles incoming HTTP request and sends a HTTP response. Browser receives the HTTP response and renders the content.

Q15. What is DHCP, how does it work?
    1. The idea of DHCP (Dynamic Host Configuration Protocol) is to enable devices to get IP address without any manual configuration.
    2. The device sends a broadcast message saying “I am new here”
    3. The DHCP server sees the message and responds back to the device and typically allocates an IP address. All other devices on network ignore the message of new device as they are not DHCP server.
In Wi Fi networks, Access Points generally work as a DHCP server.

Q16. What is subnet mask?
A subnet mask is combined with an IP address in order to identify two parts: the extended network address and the host address. Like an IP address, a subnet mask is made up of 32 bits.


OSI Model Learn OSI Model of Computer Networks in a very easy way.