Safe ads

Showing posts with label Part 1. Show all posts
Showing posts with label Part 1. Show all posts

Sunday, 19 March 2017

AngularJS Interview Questions Part - 1

AngularJS Interview Questions Part - 1




Q 1.     What is AngularJS?
Ans 1. AngularJS is a powerful Javascript framework. It is used to create Single Page Application projects. It extends HTML DOM with additional attributes and makes it more responsive to user actions. It is licenced under the Apache license version 2.0. AngularJS is open source and completely free.

Q 2.     What are the advantages of using AngularJS?
Ans 2. Following are the advantages of using AngularJS –

·       Application written in AngularJS is cross-browser compliant and it automatically handles JavaScript code suitable for each browser.
·       AngularJS is a framework to build large scale and high performance web application while keeping them as easy-to-maintain.
·       Angular's data binding and dependency injection eliminate much of the code you currently have to write

Q 3.    What is the latest version of AngularJS framework?
Ans 3. The latest version of AngularJS framework is 1.6.3

Q 4.     What architectural pattern is followed by AngularJS?
Ans 4. AngularJS follows MVW architectural pattern i.e. Model View Whatever. It can act as MVC, MVVM and MVP. For several years AngularJS was closer to MVC, but over time and thanks to many refactoring and api improvements, it is now closer to MVVM – the $scope object could be considered the ViewModel that is being decorated by a function that we call a Controller. It is up to us to use AngularJS through any pattern that best suits our requirements.

Q 5.     What are the various features of AngularJS?
Ans 5. Following are the various Core features of AngularJS –

·       Data-binding 
·       Scope
·       Controller 
·       Services
·       Filters
·       Directives
·       Templates
·       Routing
·       Deep Linking
·       Dependency Injection

Q 6.     How to setup AngularJS environment?
Ans 6. You can setup the environment for AngularJS through various options-
1. You can download the AngularJS library directly from - https://angularjs.org/
2. You can use the AngularJS library directly from a google CDN
3. You can get it from GitHub.
Include the AngularJS framework in your code as follows –
<head>
   <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>


Q 7.     What are the disadvantages of AngularJS?
Ans 7. Though AngularJS has many advantages which make it an obvious choice for web development, but it still has some disadvantages -
·        Not Secure − Being JavaScript only framework, application written in AngularJS are not safe. Server side authentication and authorization is must to keep an application secure.
·        Not degradable − If your application user disables JavaScript then user will just see the basic page and nothing more.
Q 8.     What is data binding in AngularJS?
Ans 8. It is the automatic synchronization of data between model and view components. It is achieved through ng-model directive.

Q 9.     What is Scope in AngularJS?
Ans 9. It is an object that refers to the model. It acts as a glue between controller and view.

Q 10.     What is Controller in AngularJS?
Ans 10. Controller is a JavaScript function that is bound to a particular scope.

Click here to watch more informative AngularJS Tutorial videos!

Q 11.     What is Controller in AngularJS?
Ans 11. Controller is a JavaScript function that is bound to a particular scope.

Q 12.     What are services in AngularJS?
Ans 12. AngularJS comes with several built-in services for example $https: to make a XMLHttpRequests. These are singleton objects which are instantiated only once in app and can be used by different components.

Q 13.     What are filters in AngularJS?
Ans 13. These select a subset of items from an array and return a new array. These also format the data to be displayed.

Q 14.     What are directives in AngularJS?
Ans 14. Directives are markers on DOM elements (such as elements, attributes, css, and more). These can be used to create custom HTML tags that serve as new, custom widgets. AngularJS has built-in directives (ng-bind, ng-model and many more).

Q 15.     What are templates in AngularJS?
Ans 15. These are the rendered views with information from the controller and model. These can be a single file (like index.html) or multiple views in one page using "partials".

Q 16.     What is routing in AngularJS?
Ans 16. It is the concept of switching views.

Q 17.     What is deep linking in AngularJS?
Ans 17. Deep linking allows you to encode the state of application in the URL so that it can be bookmarked. The application can then be restored from the URL to the same state.

Q 18.     What is dependency injection in AngularJS?
Ans 18. AngularJS has a built-in dependency injection subsystem that helps the developer by making the application easier to develop, understand, and test.

Q 19.     Explain AngularJS boot process?
Ans 19. When the page is loaded in the browser, following things happen:

·        HTML document is loaded into the browser, and evaluated by the browser. AngularJS JavaScript file is loaded; the angular global object is created. Next, JavaScript which registers controller functions is executed.
·        Next AngularJS scans through the HTML to look for AngularJS apps and views. Once view is located, it connects that view to the corresponding controller function.
·        Next, AngularJS executes the controller functions. It then renders the views with data from the model populated by the controller. The page gets ready.



Saturday, 28 January 2017

JQuery Interview Questions Part - 1

JQuery Interview Questions

JQuery Interview Questions Part - 1


JQuery Interview Questions


Q 1.     What is JQuery?
Ans 1. JQuery is a Javascript library. The main aim of using JQuery is to write less code and do more. JQuery is a concise Javascript library. It helps in HTML document traversing, event handling, animating and ajax interactions for rapid web development.It is easy to use and cross-platform.


Q 2.     How to access JQuery library?

Ans 2. There are two ways you can access JQuery Library - 

             1. Download from jquery.com

             2. Include JQuery from a CDN (Content Delivery Network)

If you want to download, you can either download  an uncompressed or minimized version of JQuery library. The uncompressed version is often used in development environment and minimized(compressed) version is used in production environments as it is light.



Q 3.     How to include JQuery library on your HTML page after downloading it?

Ans 3. After downloading the JQuery library, place it in the same directory as your HTML file. Then, specify the name of the JQuery library in the "src" attribute of the script tag.

       

            For example - 

                                   <script src="jquery-3.1.1.min.js">

                                   </script>

Q 4.     What is CDN?
Ans 4. CDN is an acronym for Content Delivery Network. It is a system of computers that exist all over the world and cache files for users to access. 

Q 5.    Why including JQuery library from CDN is preferred over downloading it?
Ans 5. Using CDN boosts performance. CDN servers are setup all over the world. So, when a user visits your site, the JQuery library is downloaded from the nearest CDN server. The  main advantage of CDN is that if a user has already visited a site that uses CDN, it will be cached. So, next time when the same user visits your site, JQuery library will be used from cach rather than downloading it from CDN.

Q 6.     How to include JQuery library on your HTML page from CDN?
Ans 6. CDN service is provided by many companies, but some popular ones are - Google and Microsoft. 

To include JQuery library from Google CDN, specify the URL to it in the "src" attribute of the "script" tag as shown below -
           <script                                                                                                                                                                     src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">
            </script>

To include JQuery library from Microsoft CDN, specify the URL to it in the "src" attribute of the "script" tag as shown below -
           <script                                                                                                                                                                    src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-3.1.1.min.js">
           </script>


Q 7.    What is the latest version of JQuery available?
Ans 7. The latest version of JQuery is - 3.1.1 


Q 8.    Which provides better performance JQuery or Javascript?
Ans 8. Javascript is faster than JQuery as JQuery is a library of Javascript only. So, using javascript directly rather than using it through JQuery provides better peformance. We use JQuery just for ease of use and to get the same task done with lesser code.

Q 9.     Is JQuery an open source library?
Ans 9. Yes, JQuery is a free and open source licensed under the MIT license. Open-source software (OSS) is computer software with its source code made available with a license in which the copyright holder provides the rights to study, change, and distribute the software to anyone and for any purpose.

Q 10.     What is the basic syntax of  JQuery?
Ans 10.  Below is the basic syntax of JQuery - 

         Basic Syntax - $(selector).action()
        $ - It represents JQuery library
         Selector - used to select an HTML element
         action - used to perform an action on a selected HTML element