Pages

Saturday, August 17, 2013

Viva Questions

What are the difference between Token-Ring & Token-Bus?

What is Proxy ARP?

What are the difference between node,host,terminal,system,hub?

WHAT IS MEAN BY DNS(DOMAIN NAME SYSTEM)AND WHAT IS THE PURPOSE OF IT?

What is the difference between TFTP and FTP application layer protocols?

What is the difference between hub,switch and router?

What is Bandwidth?

What is the Network Time Protocol?

What is passive topology?

What is Mail Gateway?

What is difference between ARP and RARP?

What is PING utility?

What is RAID?

What are the advantages and disadvantages of the three types of routing tables?

What are the different type of networking / internetworking devices?

What is a difference between switch and Hub?

What is a VLAN?

What does VLAN provide?

If you are given the IP address can u tell how many computers can be 
connected?What do you look at?

Difference between the communication and transmission?

What is the difference between physical address and logical address?

Describe a 3-way TCP/IP Handshake.                                                 

What is TCP

What is UDP

What is rawsocket

What is sliding window protocol

What is RPC & its advantages.

What is DNS

What is router.

What is routing protocol

What is shortest path.

What is BGP(border gateway protocol.

What is client server model.

What is port

What is ip address

What is localhost

What is ping, traceroute program

What is socket

What is the structure for socket programming

What is listen,bind,connect,accept, read,write

What is bzero()

What is sprintf()

Terms regarding Network Programming-Viva Questions

What is a Socket?
NAM means?
What is a Node?
What is the use of IP address?
What are the differences between IPV4 and IPV6?
What is physical address? Whether it is unique?

What is the abbreviation of MAC ?
MAC is in datalink layer.
TCP and UDP in transport layer of ISO/OSI layer.

What is the size of MAC-address? (MAC addresses are 12-digit hexadecimal numbers (48 bits in length))
What is the size of IPV4,IPV6?
What is client-server communication?
What is socket programming?
What are the socket functions we are using in TCP and UDP?
How to customize "a.out"?

How to know MAC-address ?
Win+R or open-RUN
cmd
ipconfig /all             OR     getmac

Want to know more about "socket" ??
Click here
Bind


A network socket is an endpoint of an inter-process communication flow across a computer network.

Datagram sockets, also known as connectionless sockets, which use User Datagram Protocol (UDP)

Stream sockets, also known as connection-oriented sockets, which use Transmission Control Protocol (TCP)

port is an application-specific or process-specific software construct serving as a communications endpoint in a computer's host operating system. A port is identified for each address and protocol by a 16-bit number, commonly known as the port number. The port number, added to a computer's IP address, completes the destination address for a communications session.  A port number is a 16-bit unsigned integer, thus ranging from 1 to 65535 (port number 0 is reserved and can't be used).


 An IP address serves two principal functions: host or network interface identification and location addressing. Its role has been characterized as follows: "A name indicates what we seek. An address indicates where it is. A route indicates how to get there"  IP addresses are binary numbers, but they are usually stored in text files and displayed in human-readable notations, such as 172.16.254.1 (for IPv4), and 2001:db8:0:1234:0:567:8:1 (for IPv6).
Need more about IP-address....clickhere

What is subnet-mask?

What is PING utility?

What is a loop-back address?
127.0.0.1

What is MAC-address?
Class D addresses(224.0.0.0 to 239.255.255.255)

Class E IP addresses for "reserved for future".












Network Programming-UDP

UDP provides a connectionless service as there need not be any long-term relationship 
between a UDP client and server.

The TCP/IP protocol suite provides two transport protocols, the User Datagram Protocol (UDP) and the Transmission Control Protocol (TCP).There are some fundamental differences between applications written using TCP versus those that use UDP.

These are because of the differences in the two transport layers: 

UDP is a connectionless, unreliable, datagram protocol, quite unlike the connectionoriented, reliable byte stream provided by TCP. 
UDP is less complex and easier to understand.


1)The client does not establish a connection with the server.
2)The client just sends a datagram to the server using the sendto function, which requires the address of the destination as a parameter. Similarly, the server does not accept a connection from a client.
3)Instead, the server just calls the recvfrom function, which waits until data arrives from some client.
4)recvfrom returns the protocol address of the client, along with the datagram, so the server can 
send a response to the correct client. 



The UDP client and server are created with the help of DatagramSocket and Datagram packet classes. If the UDP protocol is used at transport, then the unit of data at the transport layer is called a datagram and and not a segment. In UDP, no connection is established.

If TCP is used for sending data, then the data is written directly to the socket (client or server) and reaches there as a connection exists between them.


Network Programming -- TCP Program

Socket function:

#include <sys/socket.h>
int socket (int family, int type, int protocol);



The family specifies the protocol family

Family Description
AF_INET IPV4 protocol
AF_INET6 IPV6 protocol
AF_LOCAL unix domain protocol
AF_ROUTE routing sockets
AF_KEY key socket

Type Description
SOCK_STREAM Stream description
SOCK_DGRAM Datagram socket
SOCK_RAW Raw socket

Connect function:
The connect function is used by a TCP client to establish a connection
with a TCP server.
int connect(int sockfd, const struct sockaddr *servaddr, socklen_t addrlen);

Bind function: 
The bind function assigns a local protocol address to a socket.
int bind(int sockfd, const struct sockaddr *myaddr, s ocklen_t addrlen);

Close function:
The normal UNIX close function is also used to close a socket and terminate a TCP
connection.
#include<unistd.h>
int close(int sockfd);
Return 0 if ok, -1 on error.

Listen function: 
The second argument to this function specifies the maximum number of
connection that the kernel should queue for this socket.
int listen(int sockfd, int backlog);

Accept function: 
The cliaddr and addrlen argument are used to ret urn the protocol address of the
connected peer processes (client)
int accept(int sockfd, struct sockaddr *cliaaddr, socklen_t *addrlen);

IPv4 Socket Address Structure:
An IPv4 socket address structure, commonly called an “ Internet socket address
structure, “ is named sockaddr_in and defined by including the <netinet/in.h> header.








Friday, August 16, 2013

Viva Questions-LISP


LISP Inventor?  

                           John McCarthy 

Lisp Stands for?
            LISt processing.

LISP Application?
                 artificial intelligence (AI) research
Differences between 'compiler'  and '

interpreter'   ?

          Both are translators.

How to print a message in LISP?
          
          (print 'Enter the Limit')

How to read a variable in LISP?

          (setf   l(read))

How to create an array in LISP?

          (setf  a(make-array l))

How to create an array with size 50 in LISP?

          (setf  a(make-array 50))                       



How to read an array in LISP?
          (setf   (aref a i)(read))


What is the syntax for 'for-loop' in LISP?

          (dotimes (i n))

or 
          (loop for ............)



How to 'comment' a line in LISP?

          ;  (print  'hi')

If LISP language is a compiler or interpreter?

         Interpreter


How to define a function in LISP?


        (defun sum(arguments))


How to call a function in main() ?

        (partision a b)



Will continue...........


  •    



Friday, August 9, 2013

Quick Sort Using ListProcessing..Just try it..or modifies it

(defun quicksort(L)
(cond ((null L) nil)
((null (cdr L)) L )
(t (append (quicksort(car (partition (car L) (cdr L))))
(quicksort(cadr(partition (car L) (cdr L)))) )) ) )
(defun partition(el L)

(cond ((null (cdr L))
(cond ((< el (car L)) (list (list el) L))
( t (list L (list el))) ) )
(t (cond ((< el (car L))(list (car (partition el (cdr L)))
(cons(car L)(cadr(partition el (cdr L)))) ))
(t (list (cons(car L)(car (partition el (cdr L))))