How do you write a function that can reverse a linked-list? (Cisco System)
head->next = 0;
tail->next = head;
node* pre = head;
node* cur = head->next;
node* curnext = cur->next;
head->next = 0;
cur->next = head;
for(; curnext!=0; )
cur->next = pre;
pre = cur;
cur = curnext;
curnext = curnext->next;
curnext->next = cur;
How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.
How can you tell what shell you are running on UNIX system?
You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID.
What is Boyce Codd Normal form?
A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F+ of the form a->b, where a and b is a subset of R, at least one of the following holds:
• a->b is a trivial functional dependency (b is a subset of a)
• a is a superkey for schema R
Could you tell something about the Unix System Kernel?
The kernel is the heart of the UNIX openrating system, it’s reponsible for controlling the computer’s resouces and scheduling user jobs so that each one gets its fair share of resources.
What is a Make file?
Make file is a utility in Unix to help compile large programs. It helps by only compiling the portion of the program that has been changed
How do you link a C++ program to C functions?
By using the extern “C” linkage specification around the C function declarations.
Explain the scope resolution operator.
Design and implement a String class that satisfies the following:
Supports embedded nulls
Provide the following methods (at least)
Addition operator (concatenation)
Return character at location
Return substring at location
Provide versions of methods for String and for char* arguments
Suppose that data is an array of 1000 integers. Write a single function call that will sort the 100 elements data  through data .
Answer: quicksort ((data + 222), 100);