Вы находитесь на странице: 1из 4

C Language

FAQ

PurpleLeap Confidential Page 1 of 4


Table of Contents
1
C Language.........................................................................................................................1
FAQ 1
1
Variables, Constants, Operators, Looping constructs....................................................3
Functions, Recursion, Pre-processor...............................................................................3
Pointers, Arrays, Strings....................................................................................................3
Structure, Union.................................................................................................................4

PurpleLeap Confidential Page 2 of 4


Variables, Constants, Operators, Looping constructs

1. What is the difference between a static, global and extern variable?


2. When should the register modifier be used? Does it really help?
3. When should the volatile modifier be used?
4. Can a variable be both const and volatile?
5. When should the const modifier be used?
6. When should a type cast be used?
7. What is the difference between declaring a variable and defining a variable?
8. What is the benefit of using const for declaring constants?
9. When is a switch statement better than multiple if statements?
10. Is a default case necessary in a switch statement?
11. What are lvalue and rvalue?
12. Can an array be an lvalue?
13. What is the difference between var++ and ++var?
14. What does the modulus operator do?
15. Where in memory are my variables stored?
16. What is the difference between break and continue?
17. Is it a good practice to have goto statements in the program? Justify your answer.
18. What does the bitwise AND operator do?
19. What is the most efficient way to store flag values?
20. What is meant by “bit masking”?

Functions, Recursion, Pre-processor

1. When should I declare a function?


2. Why should I prototype the function?
3. How many parameters should a function have?
4. What is a static function?
5. Should a function contain a return statement if it does not return a value?
6. Is using exit() same as using return?
7. What is a macro, and how do you use it?
8. What will the preprocessor do for a program?
9. How can you avoid including a header more than once?
10. Can a file other than a .h file be included with #include? If so, what would be a good practice?
11. What is the benefit of using #define to declare a constant?
12. What is the benefit of using an enum rather than #define constant?
13. When should you use a macro rather than a function?
14. Is it better to use a macro or a function?
15. What is a pragma?

Pointers, Arrays, Strings

1. What is a const pointer?


2. What is a void pointer? When is a void pointer used?
3. When would you use a pointer to a function?
4. Can the size of an array be declared at runtime? How?
5. What is the heap?

PurpleLeap Confidential Page 3 of 4


6. What is free? When is it used?
7. How can you pass an array to a function by value?
8. How can you pass an array to a function by reference?
9. What is the difference between strcpy and memcpy?
10. How do you convert a string to a numeric value?
11. How can you trim trailing spaces in a string?
12. What is a dangling pointer?
13. Do array subscripts always start with zero?

14. Is it valid to address one element beyond the end of an array?


15. Can the sizeof operator be used to tell the size of an array passed to a function?
16. Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted
array name?
17. What is the difference between array_name and &array_name?
18. What is the difference between a string and an array?

Structure, Union

1. What is the difference between Structure and Union?


2. When would you use a Union?
3. What are bit fields?

PurpleLeap Confidential Page 4 of 4

Вам также может понравиться