Friday, 27 January 2012

Some FAQs on C & Data Structure

  • 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.
  • Ques 2: Given only a pointer to a node to be deleted in a singly linked list, how do you delete it.
  • Ques 3: How do you sort a linked list? Write a C program to sort a linked list.
  • Ques 4: How to declare a structure of a linked list?
  • Ques 5: Write a C program to implement a Generic Linked List.
  • Ques 6: How do you reverse a linked list without using any C pointers?
  • Ques 7:How would you detect a loop in a linked list? Write a C program to detect a loop in a linked list.
  • Ques 8:How do you find the middle of a linked list? Write a C program to return the middle of a linked list.
  • Ques 9:If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
  • Ques 10: How to compare two linked lists? Write a C program to compare two linked lists
  • Ques 11: How to create a copy of a linked list? Write a C program to create a copy of a linked list.
  • Ques 12: Write a C program to free the nodes of a linked list.
  • Ques 13: Can we do a Binary search on a linked list?
  • Ques 14: Write a C program to return the nth node from the end of a linked list.
  • Ques 15: How would you find out if one of the pointers in a linked list is corrupted or not?
  • Ques 16: Write a C program to insert nodes into a linked list in a sorted fashion.
  • Ques 17:Write a C program to remove duplicates from a sorted linked list.
  • Ques 18: How to read a singly linked list backwards?
  • Ques 19: How can I search for data in a linked list?
  • 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.
  • Ques 2: Implement the memmove() function. What is the difference between the memmove() and memcpy() function?
  • Ques 3: Write C code to implement the strstr() (search for a substring) function.
  • Ques 4: Write your own printf() function in C.
  • Ques 5: Implement the strcpy() function.
  • Ques 6: Implement the strcmp(str1, str2) function.
  • Ques 7: Implement the substr() function in C.
  • Ques 8: Write your own File copy() function.
  • Ques 9: Write C programs to implement the toupper() and the isupper() functions.
  • Ques 10: Write a C program to implement your own strdup() function.
  • Ques 11: Write a C program to implement the strlen() function.
  • Ques 12: Write your own strcat() function
  • Ques 10: Write a C program to implement your own strdup() function.
  • Ques 11: Write a C program to implement the strlen() function.
  • Ques 12: Write your own strcat() function
  
C Programming Questions
 
  • Ques 1: Right a program to implement malloc.
  • Ques 2: Write a C program to swap two variables without using a temporary variable .
  • Ques 3: What is the 8 queens problem? Write a C program to solve it.
  • Ques 4: Write a C program to print a square matrix helically.
  • Ques 5: Write a C program to reverse a string.
  • Ques 6: Write a C program to reverse the words in a sentence in place.
  • Ques 7: Write a C program generate permutations.
  • Ques 8: Write a C program to calculate pow(x,n).
  • Ques 9: Write a C program which does wildcard pattern matching algorithm.
  • Ques 10: How do you calculate the maximum subarray of a list of numbers?
  • 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.
  • Ques 12: Solve the Rat In A Maze problem using backtracking.
  • 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?
  • Ques 14: Write C code to solve the Tower of Hanoi problem.
  • Ques 15: Write C code to return a string from a function.
  • Ques 16: Write a C program which produces its own source code as its output.
  • Ques 17: Write a C progam to convert from decimal to any base (binary, hex, oct etc...).
  • Ques 18: Write C code to check if an integer is a power of 2 or not in a single line?
  • Ques 19: Write a C program to find the GCD of two numbers.
  • Ques 20: Finding a duplicated integer problem.
  • Ques 21: Write code to remove duplicates in a sorted array.
  • Ques 22: How do you initialize a pointer inside a function?
  • Ques 23: Write C code to dynamically allocate one, two and three dimensional arrays (using malloc()).
  • Ques 24: How would you find the size of structure without using sizeof().
  • Ques 25: Write a C program to multiply two matrices.
  • Ques 26: Write a C program to check for palindromes.
  • Ques 27: Write C code to implement the Binary Search algorithm.
  • Ques 28: Write code to add two polynomials.
  • Ques 29: Write a program to add two long positive numbers (each represented by linked lists).
  • Ques 30: How do you compare floating point numbers?
  • Ques 31: Is there something we can do in C but not in C++?
  • Ques 32: How to swap the two nibbles in a byte ?
  • Ques 33: How to scan a string till we hit a new line using scanf()?
  • Ques 34: How do you get the line numbers in C?

1 comment: