Nix Application Programming
Quick Revision Summary
Explain the difference between a static library and a dynamic library? - Static library is linked into the executable, while a dynamic library (or shared object) is loaded while...
Interactive Practice Mode
Formulate your thoughts or take notes before revealing the model solution.
Saved automatically
Model Answer & Deep-Dive Explanation
- Explain the difference between a static library and a dynamic library? - Static library is linked into the executable, while a dynamic library (or shared object) is loaded while the executable has started.
- How do you create a static library? - If you have a collection of object (.o) files, you can do it by running ar command. Generally a static library has a .a extension, and you can link it into an executable by providing -l libraryname to gcc.
- Where should the developed libraries be installed on the system? - GNU recommends /usr/local/bin for binaries and /usr/local/lib for libraries.
- What’s LD_LIBRARY_PATH? - It’s an environment variable that lists all the directories which should be searches for libraries before the standard directories are searched.
- How do you create a shared library? - Create the object file with -fPIC for position-independent code, then run gcc with -shared option.
- How do you install a shared library? - Run ldconfig in the standard directory that it’s installed in.
- What does ldd do? - It shows a list of installed shared libraries.
- How do you dynamically load a library in your app? - Use dlopen()
- What does nm command do? - It reports the list of symbols in a given library.
Interviewer Evaluation Points & Scoring Rubric
- 1 Analyze Time Complexity (Big O) and Space Complexity explicitly.
- 2 Address boundary cases: empty input, null pointers, single elements.
- 3 Write idiomatic, readable code with descriptive variable naming.
Related Questions in Unix / Linux
Unix/Linux administration interview questions
Advanced level • 828 views
Linux admin interview questions
Intermediate level • 744 views
Unix/Linux programming interview questions
Intermediate level • 569 views
Php and MySQL Important Questions
Advanced level • 508 views
C Interview Questions
Intermediate level • 387 views