What is Angular?
Angular cli is an open-source JavaScript framework to build web applications in HTML and JavaScript. angular versions change over time to increase their functionality. latest version of angular is 13. This tutorial looks at the various aspects of the Angular 2 framework which includes the basics of the framework, the setup of Angular, and how to work with the various aspects of the framework.
Angular 2 Questions
1. The following are true about Services, except ________
(1)Services are designed to do a lot of things at a time
(2)Components must be as lean as possible and all non-trivial tasks should be delegated to Services
(3)Services are mostly injected to components using DI
(4)Service is typically a Class with functions
Answers- (1)Services are designed to do a lot of things at a time
2. The following are all Directives, except __________ Choose the correct option from below list
(1)Attribute
(2)Structural
(3)Component
(4)Module
Answer:-(4)Module
3. Which directive lets you change the rendered view by adding and removing elements from the Document Object Model?
Choose the correct option from below list
(1)Attribute
(2)Structural
(3)Component
Answer:-(2)Structural
4. Which of the following is an Attribute Directive?
Choose the correct option from below list
(1)NgFor
(2)NgModel
(3)NgIf
(4)NgHide
Answer:-(2)NgModel
5. Which of the following helps you define Metadata for a class?
Choose the correct option from below list
(1)Using Templates
(2)Using Components
(3)Using Services
(4)Using Decorator
Answer:-(4)Using Decorator
6. The following are all Angular metadata Decorators, except ________
Choose the correct option from below list
(1)@Bindable
(2)@Injectable()
(3)@Inject
(4)@Component
Answer:-(1)@Bindable
7. Which of the following are valid metadata properties?
Choose the correct option from below list
(1)templateUrl
(2)All the options
(3)providers
(4)pipes
Answer:-(2)All the options
8. Components can be used with ____________.
Choose the correct option from below list
(1)None of the options
(2)Both Attributes and Tags
(3)Attributes only
(4)Tags only
Answer:-(2)Both Attributes and Tags
9. What is it called when you “compile the application in the browser before launching the app”?
Choose the correct option from below list
(1)Ahead-of-Time (AOT) Compilation
(2)PreLaunch Compilation
(3)Just-In-Time (JIT) Compilation
(4)Static Compilation
Answer:-(3)Just-In-Time (JIT) Compilation
10. An app can have one or no modules present.
Choose the correct option from below list
(1)True
(2)False
Answer:-(2)False
11. The @Component decorator defines how an application should be compiled and launched.
Choose the correct option from below list
(1)False
(2)True
Answer:-(1)False
12. ______ are mandatory parameter in components.
Choose the correct option from below list
(1)Templates
(2)Selectors
(3)Providers
Answer:-(1)Templates
13. The decorator that is used to indicate a module is _______.
Choose the correct option from below list
(1)@ngModel
(2)@NgModel
(3)@NgModule
(4)@ngModule
Answer:-(3)@NgModule
14. What are the types of Angular View Classes that can be associated to a Module?
Choose the correct option from below list
(1)Decorators, Services and Components
(2)Services, Decorators and Templates
(3)Components, Directives and Pipes
(4)Directives, Templates and Pipes
Answer:-(3)Components, Directives and Pipes
15. Templates can also be added using URLs of the file containing code.
Choose the correct option from below list
(1)False
(2)True
Answer:-(2)True
16. In order to bind data from view to component class, you can use _____.
Choose the correct option from below list
(1)Property binding
(2)Interpolation binding
(3)Event binding
Answer:-(3)Event binding
17. Property binding is defined using _________.
Choose the correct option from below list
(1){{}}
(2)[]
(3)[()]
Answer:-(2)[]
18. The following are all metadata, except ________
Choose the correct option from below list
(1)@pipes
(2)@template
(3)@Component
(4)@Injectable()
Answer:-(2)@template
19. ______ element property is used to tell angular to insert the instance of component in the HTML file.
Choose the correct option from below list
(1)Templates
(2)Providers
(3)Selectors
Answer:-(3)Selectors
20. NgFor and NgIf are examples of _________
Choose the correct option from below list
(1)Attribute
(2)Component
(3)Structural
Answer:-(3)Structural
21. Which directive lets you modify the behavior of another Directive?
Choose the correct option from below list
(1)Component
(2)Attribute
(3)Structural
Answer:-(2)Attribute
22. Interpolation uses ________.
Choose the correct option from below list
(1)[]
(2){{}}
(3)[()]
Answer:-(2){{}}
23. What happens when the following code is encountered by Angular?
< tr>
< td id=”tableData4″ colspan={{2 * 2}}>
< /td>
< /tr>`
Choose the correct option from below list
(1)None of the options
(2)The < td> colspan is set to empty value
(3)A template parse error is thrown since colspan is a native HTML attribute
(4)The < td > colspan is set to ‘4’ since Angular evaluates the interpolated expression
Answer:-(3)A template parse error is thrown since colspan is a native HTML attribute
24. There can be only one component per DOM element.
Choose the correct option from below list
(1)True
(2)False
Answer:-(1)True
25. Which of the following is an advantage of lazy loading?
Choose the correct option from below list
(1)Loads the features only on demand
(2)All of the options
(3)Speeds up the application load time
(4)Extends lazy loaded features without expanding initial load size
Answer:-(2)All of the options
26. Which of the following is one of the blocks of Angular 2 architecture?
Choose the correct option from below list
(1)Router
(2)None of the options
(3)Both the options
(4)Pipes
Answer:-(2)None of the options
27. Root module class by convention is named as _______.
Choose the correct option from below list
(1)MainModule
(2)RootModule
(3)AppModule
Answer:-(3)AppModule
28. Angular 2 uses ______ Dependency Injection.
Choose the correct option from below list
(1)Component
(2)Horizontal
(3)Hierarchical
(4)Service
Answer:-(3)Hierarchical
Also read – Jipmer bsc nursing questions
29. How will you make sure that a single instance of any Service is available throughout the app?
Choose the correct option from below list
(1)Register the service using ‘imports’ and add it to the Root Component
(2)Register the service using ‘providers’ and add it to the Root Module————-
(3)Declare the service in the Root Component
(4)None of the options
Answer:-(2)Register the service using ‘providers’ and add it to the Root Module
30. Angular 2 is written on top of Angular 1.5.x.
Choose the correct option from below list
(1)False
(2)True
Answer:-(1)False
31. Services are included in components using ______.
Choose the correct option from below list
(1)Directives
(2)Template
(3)Provider
Answer:-(3)Provider
32. Services are identified using the decorator ______.
Choose the correct option from below list
(1)@ngServices
(2)@services
(3)@Injectable
Answer:-(3)@Injectable
33. There can be only one service in a component.
Choose the correct option from below list
(1)True
(2)False
Answer:-(2)False
34. How many lifecycle methods does Angular offer apart from a Component’s constructor()?
Choose the correct option from below list
(1)7
(2)8
(3)4
(4)6
Answer:-(2)8
What is Angular is used for?
– Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your applications.
What is AngularJS vs Angular?
– The most basic difference between the two open-source frameworks is that Angular is Typescript-based (superset of ES6) while AngularJs is based on Javascript
Which language is used in Angular?
– Angular is written in TypeScript. It’s the recommended language for creating apps with Angular. There are lots of reasons to use TypeScript instead of JavaScript, but at the top of the list are reduced bugs and an increased ability to confidently refactor your code.
Is Angular front or back end?
– Angularjs is a front-end framework powered by JavaScript.
Disclaimer – This blog is written to help the students and teacher community. There is no purpose to permote illigal activities. If you feel any problem, Please feel free to mail us.