Wednesday, June 16, 2010

Interview c question

Interview Questions
Your Ad Here

Home

Interview Questions

Interview Tips

Puzzles

HR Interview FAQs

Mass Communication

Indian Comics

Contact us

Below is the list of latest technical interview questions:

Link List Questions

  • Ques 1: How do you reverse a singly linked list? How do you reverse a doubly linked list? Write a C program to do the same. [Answer]
  • Ques 2: Given only a pointer to a node to be deleted in a singly linked list, how do you delete it. [Answer]
  • Ques 3: How do you sort a linked list? Write a C program to sort a linked list. [Answer]
  • Ques 4: How to declare a structure of a linked list? [Answer]
  • Ques 5: Write a C program to implement a Generic Linked List. [Answer]
  • Ques 6: How do you reverse a linked list without using any C pointers? [Answer]
  • Ques 7:How would you detect a loop in a linked list? Write a C program to detect a loop in a linked list. [Answer]
  • Ques 8:How do you find the middle of a linked list? Write a C program to return the middle of a linked list. [Answer]
  • Ques 9:If you are using C language to implement the heterogeneous linked list, what pointer type will you use? [Answer]
  • Ques 10: How to compare two linked lists? Write a C program to compare two linked lists. [Answer]
Ques 11: How to create a copy of a linked list? Write a C program to create a copy of a linked list. [Answer]
  • Ques 12: Write a C program to free the nodes of a linked list. [Answer]
  • Ques 13: Can we do a Binary search on a linked list? [Answer]
  • Ques 14: Write a C program to return the nth node from the end of a linked list. [Answer]
  • Ques 15: How would you find out if one of the pointers in a linked list is corrupted or not? [Answer]
  • Ques 16: Write a C program to insert nodes into a linked list in a sorted fashion. [Answer]
  • Ques 17:Write a C program to remove duplicates from a sorted linked list. [Answer]
  • Ques 18: How to read a singly linked list backwards? [Answer]
  • Ques 19: How can I search for data in a linked list? [Answer]
  • Ques 20: What is the difference between a linked list and Array?
  • Ques 21: Implement a linked list. Why did you pick the method you did?
  • Ques 22: Implement an algorithm to sort a linked list. Why did you pick the method you did? Now do it in O(n) time.
  • Ques 23: Given two sorted linked lists, write a function to merge them into one.
  • Ques 24: Delete an element from a doubly linked list.
  • Ques 25: Find the nth node from the end of a singly link list in a single pass.
  • C Functions Implementation Questions

    • Ques 1: Write your own C program to implement the atoi() function. [Answer]
    • Ques 2: Implement the memmove() function. What is the difference between the memmove() and memcpy() function? [Answer]
    • Ques 3: Write C code to implement the strstr() (search for a substring) function. [Answer]
    • Ques 4: Write your own printf() function in C. [Answer]
    • Ques 5: Implement the strcpy() function. [Answer]
    • Ques 6: Implement the strcmp(str1, str2) function. [Answer]
    • Ques 7: Implement the substr() function in C. [Answer]
    • Ques 8: Write your own File copy() function. [Answer]
    • Ques 9: Write C programs to implement the toupper() and the isupper() functions. [Answer]
    • Ques 10: Write a C program to implement your own strdup() function. [Answer]
    • Ques 11: Write a C program to implement the strlen() function. [Answer]
    • Ques 12: Write your own strcat() function. [Answer]

    C Programming Questions

    • Ques 1: Right a program to implement malloc.
    • Ques 2: Write a C program to swap two variables without using a temporaryvariable . [Answer]

    • Ques 3: What is the 8 queens problem? Write a C program to solve it. [Answer]
    • Ques 4: Write a C program to print a square matrixhelically. [Answer]
    • Ques 5: Write a C program to reverse a string. [Answer]
    • Ques 6: Write a C program to reverse the words in a sentence in place. [Answer]
    • Ques 7: Write a C program generate permutations. [Answer]
    • Ques 8: Write a C program to calculate pow(x,n). [Answer]
    • Ques 9: Write a C program which does wildcard pattern matching algorithm. [Answer]
    • Ques 10: How do you calculate the maximum subarray of a list of numbers? [Answer]
    • Ques 11: How to generate fibonacci numbers? How to find out if a given number is a fibonacci number or not? Write C programs to do both. [Answer]
    • Ques 12: Solve the Rat In A Maze problem usingbacktracking. [Answer]
    • Ques 13: What Little-Endian and Big-Endian? How can I determine whether a machine's byte order is big-endian or little endian? How can we convert from one to another? [Answer]
    • Ques 14: Write C code to solve the Tower of Hanoi problem. [Answer]
    • Ques 15: Write C code to return a string from a function. [Answer]
    • Ques 16: Write a C program which produces its own source code as its output. [Answer]
    • Ques 17: Write a C progam to convert from decimal to any base (binary, hex, oct etc...). [Answer]
    • Ques 18: Write C code to check if an integer is a power of 2 or not in a single line? [Answer]
    • Ques 19: Write a C program to find the GCD of two numbers. [Answer]
    • Ques 20: Finding a duplicated integer problem. [Answer]
    • Ques 21: Write code to remove duplicates in a sorted array. [Answer]
    • Ques 22: How do you initialize a pointer inside a function? [Answer]
    • Ques 23: Write C code to dynamically allocate one, two and three dimensional arrays (using malloc()). [Answer]
    • Ques 24: How would you find the size of structure without using sizeof(). [Answer]
    • Ques 25: Write a C program to multiply two matrices. [Answer]
    • Ques 26: Write a C program to check for palindromes. [Answer]
    • Ques 27: Write C code to implement the Binary Search algorithm. [Answer]
    • Ques 28: Write code to add two polynomials. [Answer]
    • Ques 29: Write a program to add two long positive numbers (each represented by linked lists). [Answer]
    • Ques 30: How do you compare floating point numbers? [Answer]
    • Ques 31: Is there something we can do in C but not in C++? [Answer]
    • Ques 32: How to swap the two nibbles in a byte ?
      [
      Answer]
    • Ques 33: How to scan a string till we hit a new line using scanf()? [Answer]
    • Ques 34: How do you get the line numbers in C?
      [
      Answer]
    • Ques 35: How to fast multiply a number by 7?
      [
      Answer]
    • Ques 36: Write a simple piece of code to split a string at equal intervals. [Answer]
    • Ques 37: Is there a way to multiply matrices in lesser than o(n^3) time complexity?
      [
      Answer]
    • Ques 38: How can we sum the digits of a given number in single statement? [Answer]
    • Ques 39: Given two strings A and B, how would you find out if the characters in B were a subset of the characters in A? [Answer]
    • Ques 40: Write a program to check if the stack grows up or down. [Answer]
    • Ques 41: Write a program to print numbers from 1 to 100 without using loops! [Answer]
    • Ques 41: How to generate prime numbers? How to generate the next prime after a given prime? [Answer]
    • Ques 42: How to add two numbers without using the plus operator? [Answer]
    • Ques 43: Write your own trim() or squeeze() function to remove the spaces from a string. [Answer]
    • Ques 44: Write your own random number generator function in C.

    Tree : (Answers will come soon)

    Ques 1: Write a C program to find the depth or height of a tree.
  • Ques 2: Write a C program to determine the number of elements (or size) in a tree.
  • Ques 3: Write a C program to delete a tree (i.e, free up its nodes)
  • Ques 4: Write C code to determine if two trees are identical .
  • Ques 5: Write a C program to find the mininum value in a binary search tree.
  • Ques 6: Write a C program to compute the maximum depth in a tree?
  • Ques 7: Write a C program to create a mirror copy of a tree (left nodes become right and right nodes become left)!
  • Ques 8: Write C code to return a pointer to the nth node of an inorder traversal of a BST.
  • Ques 9: Write C code to implement the preorder(), inorder() and postorder() traversals. Whats their time complexities?
  • Ques 10: Write a C program to create a copy of a tree.
  • Ques 11: Write C code to check if a given binary tree is a binary search tree or not?
  • Ques 12: Write C code to implement level order traversal of a tree.
  • Ques 13: Write a C program to delete a node from a Binary Search Tree?
  • Ques 14: Write C code to search for a value in a binary search tree (BST).
  • Ques 15: Write C code to count the number of leaves in a tree.
  • Ques 16: Write C code for iterative preorder, inorder and postorder tree traversals
  • Ques 17: Can you construct a tree using postorder and preorder traversal?
  • Ques 18: Construct a tree given its inorder and preorder traversal strings. Similarly construct a tree given its inorder and post order traversal strings.
  • Ques 19: Find the closest ancestor of two nodes in a tree.
  • Ques 20: Given an expression tree, evaluate the expression and obtain a paranthesized form of the expression.
  • Ques 21: How do you convert a tree into an array?
    What is an AVL tree?
  • Ques 22: How many different trees can be constructed using n nodes?
  • Ques 23: A full N-ary tree has M non-leaf nodes, how many leaf nodes does it have?
  • Ques 24: Implement Breadth First Search (BFS) and Depth First Search (DFS) Updated!
  • Ques 25: Write pseudocode to add a new node to a Binary Search Tree (BST) Updated!
  • Ques 26: What is a threaded binary tree?

  • Sorting Questions: (Answers will be posted soon)

    • Ques 1:What is heap sort?
    • Ques 2:What is the difference between Merge Sort and Quick sort?
    • Ques 3:Give pseudocode for the mergesort algorithm.
    • Ques 4:Implement the bubble sort algorithm. How can it be improved?
    • Ques 5:Write the code for selection sort.
    • Ques 6:Write the code for quick sort.
    • Ques 7:Write the code for insertion sort.
    • Ques 8:How can I sort things that are too large to bring into memory?
    • Ques 9:For very small input which sorting algorithm will work best?

    No comments:

    Post a Comment