Sie sind auf Seite 1von 6

32 Keywords in C

/*32 KEYWORDS IN C. Have a look at it! */ 1. 2. 3. 4. auto - Defines a local variable as having a local lifetime. break - Passes control out of the compound statement. case- possible branch points in switch case construct char- Variables of type char are 1 byte in length. They can be signed or unsigned which means they have a range of -128 to 127 and 0 to 255 5. const- Makes variable value or pointer parameter unmodifiable. 6. continue - Passes control to the begining of the loop. 7. default - execution continues at this point. Otherwise, statement is skipped entirely 8. do - Keyword do is usually used together with while to make another form of repeating statement 9. double - represents a double precision floating point data type 10. else - used with if statement and it is executed only if statement is false 11. enum - Defines a set of constants of type int. 12. extern - indicates that the actual storage and initial value of a variable, or body of a function, is defined elsewhere, usually in a separate source code module 13. float - represents a single precision floating point data type 14. for- For loop-statement is executed repeatedly until the condition becomes false 15. goto - Unconditionally transfer control. 16. if - control statement. execute its statement only if it is true 17. int - integer datatype carrying 2 bytes in length. 18. long - Type modifier and can be applied to the base type int and double 19. register- Tells the compiler to store the variable being declared in a CPU register. 20. return - Exits the function. 21. short -Type modifier and can be applied to the base type int 22. signed -Type modifier and can be applied to the base type int and char 23. sizeof - Returns the size of the expression or type. 24. static - Preserves variable value to survive after its scope ends. 25. struct -Groups variables into a single record. 26. switch- causes control to branch to one of a list of possible statements in the block of statements 27. typedef- Creates a new data type. 28. union - Groups variables which share the same storage space. 29. unsigned- Type modifier and can be applied to the base type int and char 30. void - returns nothing i.e., Empty data type. 31. volatile-Indicates that a variable can be changed by a background routine i.e., extreme opposite of CONST 32. while -Repeats execution while the condition is true.

http://placementsindia.blogspot.com/2007/09/programming-puzzles-1_29.html

http://www.sorting-algorithms.com/ http://www.careercup.com/page?pid=c-plus-plus-interview-questions
Some of the important Data Structures (for interview) -----------------------------------------------------------------1. Array. 2. Linked List. 3. Tries. 4. Stacks. 5. Queues. 6. Trees. 7. Binary Search Trees. 8. Hash Tables. 9. Heap. 10. Binary Trees. 11. Graphs.

Code Pairing... (Though I'm not really sure if the round means this. But this is my guess about the round) You'll be given a problem on algorithms,etc. You'll have to sit one on one with an interviewer and try figuring out a solution for the problem. In this, the interviewer will also be solving the problem with you. It'll give you a feel of solving problems with your friend or a close peer :) Things you should know! 1. Don't blabber wrong answers! In other words, don't fool the guy around. 2. Think aloud. Cause the main motto is to understand your thought process. 3. When in doubt, ask interviewer to help you in the next step. 4. Verify your answer before you tell it to your interviewer. (Atleast act like doing so). This will make him feel that you give priority to quality!

Instructions ------------1. Answer all the questions. 2. Type all your answers in a Word/PDF Document (.DOC or .PDF) and send it. 3. Where there are diagrams necessary for explanation, use paint or draw tools in Word. 4. Give complete answer to the question and justify it! 5. You are just given 3 days of time to complete this!

6. This test is for your learning! Try to answer on your own. Don't use Internet Search/Refer Books during the test! 7. Your algorithms have to be self explanatory to me. So, please add a lot of comments! 8. In interview, you won't be provided with compiler. So try not compiling your code! Compile code in your brain. 9. In answering algorithmic questions, make sure you test your code for border cases. 10. Your codes should be error free and should compile without errors. (Don't use any compilers) 11. Your entries will be tested on three factors. a. Number of questions answered. b. Quality of the answers. c. Time taken to solve. d. Original thinking.

All The Best!

Send your answers to sanjeevgopinath@live.com (Only if you have answers to all questions. I can't evaluate 400 answer papers.). Feel free to discuss about the questions and solving techniques in our Group! But don't post the answer! If you can't answer any question, make sure that you know the answer before you go for your ThoughtWorks Interview! -------------------------------------------------------------------------------------------

1. int* function(int a) { int b = 2 * a;

return &b; } int main() { int a,*b; a = 20; b = function(a); printf("%d",*b); }

A. What's the problem in the above code? B. How to rectify it?

2. Write a program to find the height of a binary tree!

3. Write a program to remove duplicates in a sorted linked list!

4. Given a node from the linked list. Delete that node! The function signature is delete(node *p).

5. Given an array containing numbers from 0 to N, where each number occurs only once! How will you find a missing number when given the array!?

6. Now, give the logic of finding two missing numbers!

7. Given a BST, write a program to print the elements in sorted order!

8. Given the same BST, write a program to convert it into a Ordered Singly Linked List! For this problem, the structure of the BST node has an extra pointer called *LLnode, other than the leftchild and rightchild. Initially this pointer is assigned to NULL. Make use of this LLnode pointer for making the BST into LL.

9. Given the number of nodes in a Heap, what's my heap height!

10. I've 10 files with 1 million numbers in each. How will you efficiently sort them?

11. In the above question, give an efficient logic of retrieving the top N elements out of all the 10 files!

12. I've a C++ class! Give me a program to find the number of alive objects.

13. Continuing to the previous question, Can you find the exact number of objects in stack and heap.

14. Will Destructor be invoked if a an exception occurs in a Constructor? Why or Why Not!

15. Explain Hashing. When is the hash table said to have a search complexity of O(1).

16. Inorder sequence: D B E A F C ; Preorder sequence: A B D E C F ; Construct the Binary Tree!

17. Describe how you could use a single array to implement three stacks!

18. My Bank wants to impletement ATM machines. Give me a system design for the same!

19. Write a program to find if a machine is big endian or little endian.

20. I have a sorted list of N numbers! And the list is rotated by X numbers and the value of rotation can range from 0 - (N-1). X is unknown. How would you efficiently search for a number in this list? Give a solution that works in less than O(N) complexity!

Das könnte Ihnen auch gefallen