[ C/C++ ] Programming questions list for C/C++: Set - 1

♠ Posted by GeekyFry in ,,,, at 7:17 AM


Instead of having separate post for each question, somehow it made sense to put all the basic questions here in one question section.
  1. Write a program to implement malloc.
  2. Write a C/C++ program to swap two variables without using a temporary variable.
  3. What is the 8 queens problem? Write a C/C++ program to solve it.
  4. Write a C/C++ program to print a square matrix helically.
  5. Write a C/C++ program to reverse a string.
  6. Write a C/C++ program to reverse the words in a sentence in place.
  7. Write a C/C++ program generate permutations.
  8. Write a C/C++ program to calculate pow(x,n).
  9. Write a C/C++ program which does wildcard pattern matching algorithm.
  10. How do you calculate the maximum subarray of a list of numbers?
  11. How to generate fibonacci numbers? How to find out if a given number is a fibonacci number or not? Write C/C++ programs to do both.
  12. Solve the Rat In A Maze problem using backtracking.
  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?
  14. Write C/C++ code to solve the Tower of Hanoi problem.
  15. Write C/C++ code to return a string from a function.
  16. Write a C/C++ program which produces its own source code as its output.
  17. Write a C/C++ progam to convert from decimal to any base (binary, hex, oct etc…).
  18. Write C/C++ code to check if an integer is a power of 2 or not in a single line?
  19. Write a C/C++ program to find the GCD of two numbers.
  20. Finding a duplicated integer problem.
  21. Write code to remove duplicates in a sorted array.
  22. How do you initialize a pointer inside a function?
  23. Write C/C++ code to dynamically allocate one, two and three dimensional arrays (using malloc()).
  24. How would you find the size of structure without using sizeof().
  25. Write a C/C++ program to multiply two matrices.
  26. Write a C/C++ program to check for palindromes.
  27. Write C/C++ code to implement the Binary Search algorithm.
  28. Write code to add two polynomials.
  29. Write a program to add two long positive numbers (each represented by linked lists).
  30. How do you compare floating point numbers?
  31. Is there something we can do in C but not in C++?
  32. How to swap the two nibbles in a byte ?
  33. How to scan a string till we hit a new line using scanf()?
  34. How do you get the line numbers in C/C++?
  35. How to fast multiply a number by 7?
  36. Write a simple piece of code to split a string at equal intervals.
  37. Is there a way to multiply matrices in lesser than o(n^3) time complexity?
  38. How can we sum the digits of a given number in single statement?
  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?
  40. Write a program to check if the stack grows up or down.
  41. Write a program to print numbers from 1 to 100 without using loops!
  42. How to generate prime numbers? How to generate the next prime after a given prime?
  43. How to add two numbers without using the plus operator?
  44. Write your own trim() or squeeze() function to remove the spaces from a string.
  45. Write your own random number generator function in C/C++.
This should act as a checklist. I will add individual post for each of the questions and link them here.
(For responding with answers, please do mention the question no for reference here.)

0 comments:

Post a Comment