1. Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.
  2. Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.
  3. Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
  4. Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution).
  5. What are the different ways to say, the value of x can be either a 0 or a 1.
  6. I was given two lines of assembly code which found the absolute value of a number stored in two's complement form. I had to recognize what the code was doing.
  7. Give a fast way to multiply a number by 7.
  8. Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
  9. A real life problem - A square picture is cut into 16 sqaures and they are shuffled. Write a program to rearrange the 16 squares to get the original big square.
  10. Consider the base -2 representation of numbers. (-2 instead of usual +2). Give the condition for a number represented in this form to be positive? Also, if P(A, B) is a function that takes two 0-1 strings A,B in this representation, when can we say that P(A,B) returns the sum of these two numbers?
  11. Given an expression tree with no parentheses in it, write the program to give equivalent infix expression with parentheses inserted where necessary.
  12. Given a maze with cheese at one place and a mouse at some entrance, write a program to direct the mouse to cheese correctly. (Assume there is a path). Following primitives are given: moveforward, turnright, turnleft, iswall?, ischeese?, eatcheese.
  13. Give me an algorithm and C code to find the subarray with the largest sum given an array containing both positive and negative integers.
  14. Write a function that returns the factorial of a number.
  15. Write a function that computes the nth number in the Fibonacci sequence.
  16. Write an implementation of strlen().
  17. Switch the integer values stored in two registers without using any additional memory.
  18. Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
  19. Write a small lexical analyzer - interviewer gave tokens. expressions like "a*b" etc.
  20. Write a routine that prints out a 2-D array in spiral order!
  21. How is the readers-writers problem solved? - using semaphores/ada .. etc.
  22. Write code for reversing a linked list.
  23. Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).