Angular Interview Question Set 14
Categories: Angular
What are Core and Shared modules for?
A Shared module serves as a generic module for all modules, components, directives, pipes, etc., which are not required to be in a single copy for the application but need to be imported into many different modules.
A Core module is a place to store services that you need to have in the form of singleton for the entire application (for example, a user authorization service with data storage about it).
What are some points to consider when optimizing an Angular 6 application for performance?
There are many ways, some ideas include:
AOT compilation, bundling and uglifying the application, tree shaking, lazy loading, separating dependencies and devDependencies, Using OnPush and TrackBy, removing unnecessary 3rd party libraries and import statements, avoid computing values within the template.
What are some important practices to secure an Angular application?
Some basic guidelines include:
- Check that all requests come from within your own web app and not external websites
- Sanitize all input data
- Use Angular template instead of DOM APIs
- Content Security Policies
- Validate all data with server-side code
What‘s the difference between unit testing and end-to-end testing? What are some testing tools you would use for an Angular application?
Unit testing is a technique to test that isolated segments of code are functioning properly. End-to-end testing involves checking that entire sets of components to make sure they are working together properly and that the application is working as you would expect. End-to-end tests often simulate user interactions to test that an app is functioning as it should. Jasmine and Karma are all great testing tools.
Describe a time you fixed a bug/error in an application. How did you approach the problem? What debugging tools did you use? What did you learn from this experience?
Debugging is one of the key skills for any software developer. However, the real skill is in breaking the problem down in a practical way rather than finding small errors in code snippets. Given that debugging often takes hours or even days, you don‘t have time in an interview setting. Asking these questions will give you an idea of how your candidate approaches errors and bugs.
What’s the most important thing to look for or check when reviewing another team member’s code?
Here you‘re checking for analysis skills, knowledge of mistakes that less experienced developers make, keeping in mind the larger project and attention to detail.
A good answer might mention code functionality, readability and style conventions, security flaws that could lead to system vulnerabilities, simplicity, regulatory requirements, or resource optimization.