Bharathi
Friday, June 25, 2010
• A: The layers are physical, data link, network, transport, session, presentation, and application layers.
• Q: In the TCP client-servel model, how does the three-way handshake work in opening connection?
• A: The client first sends a packet with sequence "x" to the server. When the server receives this packet, the server will send back another packet with sequence "y", acknowledging the request of the client. When the client receives the acknowledgement from the server, the client will then send an acknowledge back to the server for acknowledging that sequence "y" has been received.
• Q: What is the purpose of exchanging beginning sequence numbers during the the connection in the TCP client-server model?
• A: To ensure that any data lost during data transfer can be retransmitted.
• Q: How does Asynchronous Transfer Mode (ATM) work?
• A: ATM works by transmitting all traffic in small, fixed-sized cells. These small, fixed-size cells reduces queuing delay and can be switched quickly. ATM fits into layer 2 of the OSI model and provides functions for framing and error correction. At the port interface, ATM switches convert cells into frames, and vice versa. ATM provides Quality of Service and traffic shaping.
• Q: Given a Class B Network with subnet mask of 255.255.248.0 and a packet addressed to 130.40.32.16, what is the subnet address?
• A: Take the 2 addresses, write them in binary form, then AND them. The answer is 130.40.32.0
Q1. Name of seven layers in Open System Interconnection model.
A. They are Application, Presentation, Session, Transport, Network, Data link, and Physical.
Q2. What is the time complexity of matrix multiplication ?
void Mult_Matrix(matrix A, matrix B, matrix C)
{
int i, j, k;
for ( i = 1; i < N; i++)
for ( j = 1; j < N; j++ )
{
C[i][j] = 0;
for ( k = 0; k < N; k++ )
C[i][j] = A[i][j]*B[k][j];
}
retrun;
}
A. The time comlexity of matrix mulitiplication is O(N^3)
Q3. What is the null pointer in C++ ?
A. The null pointer is a special C++ pointer value that can be used for any pointer that doesn’t pointer anywhere. It can be written as the constant NULL form stlib.h
Q4. What is the goal of the shortest distance algorithm ?
A. The goal is to completely fill the distance array so that for each vertex v, the value of distance[v] is the weight of the shortest path from start to v.
Q5. What is the difference between an abstract class and an interface?
A.
An abstract class may have fields and some implemented methods.
An interface has no implementation; only constants and method declarations.
Thursday, June 24, 2010
Table Comparing C, C++ and java
Feature | C | C++ | Java |
Paradigms | Procedural | Procedural, OOP, Generic Programming | OOP, Generic Programming (from Java 5) |
Form of Compiled Source Code | Executable Native Code | Executable Native Code | Java bytecode |
Memory management | Manual | Manual | Managed, using a garbage collector |
Pointers | Yes, very commonly used. | Yes, very commonly used, but some form of references available too. | No pointers; references are used instead. |
Preprocessor | Yes | Yes | No |
String Type | Character arrays | Character arrays, objects | Objects |
Complex Data Types | Structures, unions | Structures, unions, classes | Classes |
Inheritance | N/A | Multiple class inheritance | Single class inheritance, multiple interface implementation |
Operator Overloading | N/A | Yes | No |
Automatic coercions | Yes, with warnings if loss could occur | Yes, with warnings if loss could occur | Not at all if loss could occur; msut cast explicitly |
Variadic Parameters | Yes | Yes | No |
Goto Statement | Yes | Yes | No |