Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

cpp_roadmap

1. Static_cast, dynamic_cast, reinterpret_cast

  • Project: Create a custom Linux ls command implementation that lists files in a directory. Use different cast types when processing file attributes, like determining if an entry is a file or directory.

2. Difference between C cast and static_cast

  • Project: Implement a simple version of the df utility in C++, which reports disk space usage. Use C-style casts and static_cast for type conversions when working with system calls and compare the safety and clarity.

3. How to remove constness?

  • Project: Write a configuration file editor for a Linux service (like /etc/fstab). Use a const structure to load the file and temporarily remove constness to allow modifications under certain conditions.

4. Difference between pointers and reference

  • Project: Create a C++ utility that mimics the behavior of the ln command (creating symbolic and hard links). Explore how pointers and references can be used to manage the linked files and directories.

5. What type to use to represent a size

  • Project: Develop a custom version of the du command, which computes the size of directories. Choose the appropriate type to represent the file sizes and handle edge cases like large files.

6. Lifetime of a static variable

  • Project: Implement a logging daemon that writes logs to a file. Use static variables to maintain the state of the log file and explore how the lifetime of these variables affects the program.

7. How to pass an object/variable to a function?

  • Project: Create a C++ version of the ps command that lists running processes. Experiment with different ways of passing process information (by value, reference, pointer) to various functions for filtering and formatting.

8. Rvalue reference vs universal reference

  • Project: Implement a command-line utility that processes large text files (similar to grep). Use rvalue references and universal references to efficiently handle file data and manage resources.

9. When/how does C++ allocate on the heap/stack?

  • Project: Develop a Linux utility that monitors system memory usage, similar to top. Track how your program allocates memory on the heap and stack, and optimize for different use cases.

10. What is RAII, why use it?

  • Project: Create a C++ wrapper for file handling (like opening, reading, and writing to files) that ensures files are properly closed using RAII. Integrate this into a simple utility like cat or head.

11. What is polymorphism? How to achieve static polymorphism?

  • Project: Design a pluggable C++ command-line utility framework where different modules (like grep, sed, awk) can be added or removed. Implement both dynamic and static polymorphism for managing these modules.

12. How is dynamic polymorphism implemented in C++?

  • Project: Write a C++ version of the ls command with plugins for different file formats (like zip, tar). Use dynamic polymorphism to handle the different formats and explore the underlying implementation.

13. Multiple inheritance, why bad?

  • Project: Implement a file manager utility that combines functionality from different Linux commands (like cp, mv, rm) using multiple inheritance. Identify and resolve issues like the diamond problem.

14. When should a virtual class have a virtual destructor?

  • Project: Create a command-line utility that processes different file types (like images, text, binaries). Ensure that derived classes for different file types have proper destructors, and test what happens when a base class lacks a virtual destructor.

15. What is a static method?

  • Project: Implement a utility similar to find that searches for files in a directory tree. Use static methods to provide common file handling functions, and compare their use with instance methods.

16. How to make an object non-copyable?

  • Project: Write a C++ utility that handles system-wide resources, like locking a file or managing a network socket. Make the resource manager class non-copyable to prevent resource conflicts.

17. Shallow copy? What is move operator?

  • Project: Create a utility that copies large files (like cp). Implement both shallow and deep copy mechanisms, and introduce move semantics to optimize performance for large data transfers.

18. Difference between a map and an unordered_map

  • Project: Implement a custom version of the env command, which prints environment variables. Use both std::map and std::unordered_map to manage the environment variables and compare their performance.

19. How to printf a std::string

  • Project: Write a C++ utility that formats and prints system logs (similar to dmesg). Implement a function to format std::string using printf style and integrate it into the log processing.

20. What is using? Why use it over #define

  • Project: Recreate the alias command in C++, allowing users to define and use shortcuts for other commands. Use using declarations to manage command aliases instead of #define.

21. What are smart pointers?

  • Project: Build a C++ utility that manages temporary files in a directory, like /tmp. Use shared_ptr, unique_ptr, and weak_ptr to manage file handles and ensure proper cleanup.

22. Difference between static and dynamic libraries

  • Project: Develop a C++ command-line tool that can load plugins dynamically at runtime (like dlopen in Linux). Compare the use of static and dynamic libraries for extending the tool's functionality.

23. Why a virtual function should not be a template?

  • Project: Attempt to design a C++ library for processing different file formats (e.g., txt, csv, json) using virtual functions and templates. Document the challenges and explore alternative designs that work around the limitations.

24. Can we call main recursively?

  • Project: Create a recursive file search utility (similar to find). Experiment with calling main recursively to process nested directories, and investigate the behavior and limitations.

25. How exceptions work internally?

  • Project: Implement a custom grep command that throws exceptions for different error conditions (like file not found). Explore how exceptions are propagated and handled, and analyze the stack unwinding process.

26. Recode malloc, multi-threading producer-consumer, lock-free/wait-free

  • Project: Re-implement the Linux malloc using custom memory pools. Then create a multi-threaded producer-consumer model that simulates a simple task manager. Finally, explore lock-free or wait-free algorithms for optimizing task management.

27. Questions on GPU

  • Project: Develop a C++ utility that processes large datasets (like an image processing tool). Offload parts of the computation to the GPU using CUDA or OpenCL and compare the performance with CPU-based processing.

28. Write an efficient parallel_for

  • Project: Implement a parallel version of the sort command in C++. Use a parallel_for loop to sort large files or datasets, and optimize the code for performance across multiple cores.

About

my cpp roadmap

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors