Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

Interview Questions and Answers :: Cisco

Home > Experience Archives > Cisco > Interview Question Set 2
Telephonic Round First Round (F-2-F) Second Round (F-2-F)
  • 1. Reverse a string in C using as little additional memory as possible.
  • Answer:
    // C program using recursion to reverse a string.

    # include
    void reverseString(char *str)
    {
    if (*str)
    {
    reverseString(str+1);
    printf("%c", *str);
    }
    }

    int main()
    {
    char a[] = "India is a great country";
    reverseString(a);
    return 0;
    }
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 2. Setting, Clearing and Toggling a single bit in a value..?
  • Answer:
    To Set Bit use bitwise OR operator (|)
    number |= 1 << x;

    To clear Bit use bitwise AND operator (&)
    number &= ~(1 <
    To toggle bit use bitwise XOR operator (^)
    number ^= (1 << x)
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 3. Difference between macro and inline functions ?
  • Answer:
    1. Inline follows strict parameter type checking, macros do not.
    2. Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.
    3. Compiler has no idea about macros, compiler knows about inline functions.
    4. Inline follows strict parameter type checking, macros do not.
    5. Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 4. Find nth node from last in single linked list
  • Answer:
    LinkedListNode nthToLast(LinkedListNode head, int n) {
    if (head == null || n < 1) {
    return null;
    }
    LinkedListNode p1 = head;
    LinkedListNode p2 = head;
    for (int j = 0; j < n - 1; ++j) { // skip n-1 steps ahead
    if (p2 == null) {
    return null; // not found since list size < n
    }
    p2 = p2.next;
    }
    while (p2.next != null) {
    p1 = p1.next;
    p2 = p2.next;
    }
    return p1;
    }
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 5. How will you implement macro sizeof
  • Answer:
    #define SIZE(type) (size_t)((type *)100 + 1) - (size_t)((type *)100)
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 6. How will you organize 1 lakh numbers??
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 7. Difference between little endian and big endian,write a code that tells you machine is little or big endian ??
  • Answer:
    void IsLitttleOrBigEndian()
    {
    char word = 1;
    if((*(char *)& word) == 1 )
    printf(“\n Machine is little Indian”);
    else
    printf(“\n Machine is big Indian”);
    }
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 8. What is NAT ??
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 9. What things will you keep in mind while writing a high level design ??
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 10. How will you allocate a memory to 2d integer array ??
  • Answer:
    #include
    Void main() {
    int **array;
    array = (int **)malloc(nrows * sizeof(int *));
    if(array == NULL)
    {
    fprintf(stderr, "out of memory\n");
    return;
    }
    for(i = 0; i < nrows; i++)
    {
    array[i] = (int *)malloc(ncolumns * sizeof(int));
    if(array[i] == NULL)
    {
    fprintf(stderr, "out of memory\n");
    return;
    }
    }
    for(i = 0; i < nrows; i++)
    free(array[i]);
    free(array);
    }
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 11. What is alignment ??
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 12. How will you align an allocated pointer ??
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

Telephonic Round First Round (F-2-F) Second Round (F-2-F)
  • 1. Introduce YourSelf.
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 2. Write a code for reversing a linked list, recursive and non-recursive.
  • Answer:
    Non-Recursive
    ========

    void reverse(struct node ** head)
    {
    struct node* prev = NULL;
    struct node* current = *head;
    struct node* next;
    while (current != NULL)
    {
    next = current->next;
    current->next = prev;
    prev = current;
    current = next;
    }
    *head = prev;
    }
    This trick might help you
    there are three pointer ( prev, current, next)
    next = current*
    current* = prev
    prev = current
    current = next

    if we see from above logic then before = is like top to bottom then bottom to top .
    * marked pointer will have next.

    Recursive
    =======


    struct node * recLinkedList(struct node *head, struct node *prev)
    {
    struct node *tmp = head->next;
    head->next = prev;
    if ( tmp != NULL)
    recLinkedList(tmp, head);

    return head
    }

    int main()
    {
    struct node *head = recLinkedList (head, NULL);
    }
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 3. How to find whether a machine is 32bit or 64 bit? Write code for this..??
  • Answer:
    void Is32BitsOr46Bits()
    {
    char word = 1;
    if((*(char *)& word) == 1 )
    printf(“\n Machine is 32 bits”);
    else
    printf(“\n Machine is 64 bits”);
    }
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 4. What is Y shape linked list.. ??
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 5. How will you implement a linked list library using void pointers? Write the complete code
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 6. Sorted array is given, find 2 nos whose sum equals X ??
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 7. Complement the odd bits in a byte
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 8. How does traceroute works
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 9. What are the different means of IPC in linux kernel
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 10. What is difference between process and threads
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 11. What is difference between const char *, char const * etc...
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 12. Write a code to merge two sorted linked lists
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 13. If ttl is set to 15 and we have 10 machines, and each machine takes 2 seconds to process the packet, will the packet reach the end point?
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 14. Single linked list questions
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 15. Given a pointer to node in linked list, no start pointer is given,
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 16. how would you delete the node ??
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

  • 17. To detect a loop in linked list? How many ways can you do that
  • Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

Telephonic Round First Round (F-2-F) Second Round (F-2-F)