Angular Test 1 â Questions and Answers
Question 1: How would you display a View using a router outlet?
- Nothing. The view will display in the tag (Correct answer)
- Declare the router outlet as a service
- Declare the router outlet in the root module
- Create an instance of the router outlet
Correct answer: Nothing. The view will display in the tag
The correct answer: <br> Nothing. The view will display in the tag
Question 2: Which applications must be installed before you can download Angular?
- Node.js (Correct answer)
- Both (Node.js) & (NPM)
- PowerShell
- NPM
Correct answer: Node.js
Explanation: <br> The Node.js® runtime is based on Chrome's V8 JavaScript engine. Node.js has a lightweight and efficient l/O mechanism that is event-driven and non-blocking. The npm package ecosystem for Node.js is the world's largest ecosystem of open source libraries.
Question 3: What methods would you use to test your NativeScript Angular app?
- Use a custom Eclipse plugin
- Run it in a web-browser (Correct answer)
- Run it in an Android emulator
- Call it from a JSP
Correct answer: Run it in a web-browser
The correct answer: <br> Run it in a web-browser
Question 4: How would you split a string into substrings if you had to read it?
- Use the Slice pipe
- Use the String pipe
- Both (Use the Slice pipe) & (Use the String pipe) (Correct answer)
- Use the StringSlice pipe
Correct answer: Both (Use the Slice pipe) & (Use the String pipe)
The correct answer: <br> Both (Use the Slice pipe) & (Use the String pipe)
Question 5: What's the ideal way to set child URL routes?
- Important them at runtime
- In the browser object
- In the routes array (Correct answer)
- In the component
Correct answer: In the routes array
Explanation: <br> To define child routes, just add an array of new route configuration objects to your parent configuration's children key.
Question 6: How do you get data flowing both ways between properties and events while developing a web page?
- Use property binding
- Use event and property binding (Correct answer)
- Use event binding
- Use modules
Correct answer: Use event and property binding
Explanation: <br> The difference between property binding and interpolation is that you can set the properties and attributes of numerous HTML elements. Event binding allows you to communicate with the component class and create events that occur in the template (user-initiated).
Question 7: In a web application, how would you create custom event handling?
- Through a combination of Outputs Decorators and EventEmitters (Correct answer)
- Through interpolation
- Through EventEmitters only
- Through Output Decorators only
Correct answer: Through a combination of Outputs Decorators and EventEmitters
The correct answer: <br> Through a combination of Outputs Decorators and EventEmitters
Question 8: On a website, how would you present a list of customers?
- Load to customers into the template
- Compile the customers into ngFor at runtime
- Call ngFor from the module passing in the customers
- Load the customers into an Observable and pass the Observable to a ngFor loop (Correct answer)
Correct answer: Load the customers into an Observable and pass the Observable to a ngFor loop
The correct answer: <br> Load the customers into an Observable and pass the Observable to a ngFor loop
Question 9: Which directive would you use to include a template conditionally dependent on the value of an expression?
- nglf (Correct answer)
- ngWhile
- ngFor
- ngWhen
Correct answer: nglf
Explanation: <br> It includes a template conditionally dependent on the value of an expression. When an expression is true or false, it evaluates the expression and then renders the then or else template in its place. The NgIf directive is mostly used to conditionally display the inline template. to show the inline template only if certain conditions are met.
How would you display a View using a router outlet?