Interview Questions

C/C++ Questions only (Library Functions)

C++ programming on UNIX, C++ Networking,C++ Algorithm Questions and Answers


(Continued from previous question...)

C/C++ Questions only (Library Functions)

1. How can I convert numbers to strings?

2. Why does strncpy not always write a '\0'?

3. Why do some versions of toupper act strangely if given an

upper-case letter?

4. How can I split up a string into whitespace-separated fields?

5. I need some code to do regular expression and wildcard matching.

6. I'm trying to sort an array of strings with qsort, using strcmp

as the comparison function, but it's not working.

7. Now I'm trying to sort an array of structures, but the compiler

is complaining that the function is of the wrong type for qsort.

8. How can I sort a linked list?

9. How can I sort more data than will fit in memory?

10. How can I get the time of day in a C program?

11. How can I convert a struct tm or a string into a time_t?

12. How can I perform calendar manipulations?

13. I need a random number generator.

14. How can I get random integers in a certain range?

15. Each time I run my program, I get the same sequence of numbers

back from rand().

16. I need a random true/false value, so I'm just taking rand() % 2,

but it's alternating 0, 1, 0, 1, 0...

17. How can I generate random numbers with a normal or Gaussian

distribution?

18. I'm trying to port this old program. Why do I get ``undefined

external'' errors for some library functions?

19. I get errors due to library functions being undefined even

though I #include the right header files.

20. I'm still getting errors due to library functions being

undefined, even though I'm requesting the right libraries.

21. What does it mean when the linker says that _end is undefined?

(Continued on next question...)

Other Interview Questions