Friday, August 31, 2007

Programming Questions-Set-II,Zephyrix'07

1. Assume your compiler doesn’t support modulo operation. Write a line of code to calculate the same?

2. Check whether the given no is a non zero integer without using the relational and arithmetic operators.

3. What is the output of the following code?
#define s(x) #s void main() { printf(s(The Boss)); }

4. Write a program to print all numbers i such that is in between 0 and n where i is divisible either by 4 or 5 but not both.

5. Write a C program to reverse a string without using the library functions.

6.Write a program to convert a decimal no into base 7.

7.Write a program that arranges an array of names in alphabetical order.

8. What is the difference between macro and inline functions?

9. Write a program to check if the sum of squares of the digits of a number is equal to the number itself.

10. Write a single line statement to initialize all elements on an array to 0 using a single assignment

11. Write a recursive function to find the nth term of the fibonacci series.

12. HAPPY NEW YEAR! You wake up to the screams that celebrate the entry of the new year. You turn around to look at your clock, but it seems to have stopped functioning properly. Instead of showing the time, it displays the seconds elapsed from midnight. You have to write a program to find the correct time for you.

13. The Illustrated Books Of African Animals has photos of various animals on the left side and the description of the animal on the right. Given a random page number, write a function to predict if the page has pictures or description. The first page contains the introduction describing the various geographics regions in the area.

14. You are the CEO of a company. You have under you ‘n’ employees directly under your supervision. The first among them has 1 person working under them, the second 2. . . and the nth one n people under him. You now have to write a program that calculates the total number of employees working in the company.

15. Vinu and Computer are playing a game. Both of them can choose any no. The no can be at least 1 and at most 8. To start with each player take turns alternatively until the total becomes exactly 25. The person who gives the last no loses the game. Both of them play intelligently to win the game. The computer gives the first no.
Write a C program so that the computer always wins the game.
Print an error message if the total goes beyond 25.

3 comments:

Mahesh said...

Nice questions da...all said that the prog was good..great work da..keep gng...overall we rocked da..

Santhosh kumar.S said...

Thank u machi.....

Unknown said...

the last question was really nice.....