What is semaphore?
Semaphore is a special variable, it has two methods: up and down.
Semaphore performs atomic operations, which means ones a semaphore is
called it can not be interrupted.
The internal counter (= #ups - #downs) can never be negative. If you
execute the “down” method when the internal counter is zero, it will
block until some other thread calls the “up” method. Semaphores are use
for thread synchronization.
Is C an object-oriented language?
C is not an object-oriented language, but limited object-oriented
programming can be done in C.
Name some major differences between C++ and Java.
C++ has pointers; Java does not. Java is platform-independent; C++ is
not. Java has garbage collection; C++ does not. Java does have pointers.
In fact all variables in Java are pointers. The difference is that Java
does not allow you to manipulate the addresses of the pointer
C++ Networking Interview Questions and Answers
What is the difference between Stack and Queue?
Stack is a Last In First Out (LIFO) data structure.
Queue is a First In First Out (FIFO) data structure
Write a fucntion that will reverse a string.
char *strrev(char *s)
int i = 0, len = strlen(s);
if ((str = (char *)malloc(len+1)) == NULL)
/*cannot allocate memory */
err_num = 2;
str[i] = NULL;
What is the software Life-Cycle?
The software Life-Cycle are
1) Analysis and specification of the task
2) Design of the algorithms and data structures
3) Implementation (coding)
5) Maintenance and evolution of the system
What is the difference between a Java application and a Java applet?
The difference between a Java application and a Java applet is that a
Java application is a program that can be executed using the Java
interpeter, and a JAVA applet can be transfered to different networks
and executed by using a web browser (transferable to the WWW).
Name 7 layers of the OSI Reference Model?
-Data Link layer
C++ Algorithm Interview Questions and
What are the advantages and disadvantages of B-star trees over
B-star trees have better data structure and are faster in search than
Binary trees, but it’s harder to write codes for B-start trees.
The major difference between B-tree and binary tres is that B-tree is a
external data structure and binary tree is a main memory data structure.
The computational complexity of binary tree is counted by the number of
comparison operations at each node, while the computational complexity
of B-tree is determined by the disk I/O, that is, the number of node
that will be loaded from disk to main memory. The comparision of the
different values in one node is not counted.
Write the psuedo code for the Depth first Search.
dfs(G, v) //OUTLINE
Mark v as "discovered"
For each vertex w such that edge vw is in G:
If w is undiscovered:
dfs(G, w); that is, explore vw, visit w, explore from there as much as
possible, and backtrack from w to v. Otherwise:
"Check" vw without visiting w. Mark v as "finished".
Describe one simple rehashing policy.
The simplest rehashing policy is linear probing. Suppose a key K hashes
to location i. Suppose other key occupies H[i]. The following function
is used to generate alternative locations:
rehash(j) = (j + 1) mod h
where j is the location most recently probed. Initially j = i, the hash
code for K. Notice that this version of rehash does not depend on K.
Describe Stacks and name a couple of places where stacks are useful.
A Stack is a linear structure in which insertions and deletions are
always made at one end, called the top. This updating policy is called
last in, first out (LIFO). It is useful when we need to check some
syntex errors, such as missing parentheses.
Suppose a 3-bit sequence number is used in the selective-reject ARQ,
what is the maximum number of frames that could be transmitted at a
If a 3-bit sequence number is used, then it could distinguish 8
different frames. Since the number of frames that could be transmitted
at a time is no greater half the numner of frames that could be
distinguished by the sequence number, so at most 4 frames can be
transmitted at a time.
Page Numbers :