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]
  • 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 temporary variable . [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 matrix helically. [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 using backtracking. [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]