Angular 2 Interview Questions

Angular 2 Interview Questions || 25+ TOP MNC’s FAQ

Angular 2 Interview Questions: Angular 5 is the latest framework released in 2018 which is also popularly known as Angular 2 version. Below are the FAQs asked in every interview.

  • What is Angular 2?
  • What are the fundamentals concepts of Angular 2?
  • What Are The New Features Of Angular 2? Why You Used Angular 2?
  • What are advantages of Angular 2?
  • How Can We Set Up Our Development Environment For Angular 2?
  • What are TypeScript Types? In Detail?
  • What is AOT Compilation? – Pros and Cons of Ahead-of-Time!
  • What is Lazy Loading and How to enable Lazy Loading?
  • How would you Optimize the Angular 2 Application for Better Performance?
  • What are the Securities Threats should we be Aware of in Angular 2 Applications?
  • What are significant changes in Angular 2?
  • What are the core components of Angular 2?
  • What is the set of modern browsers supported in Angular 2?
  • What are differences between Angular 2 and Angular 1?
  • Can you write both Angular 1 and Angular 2 codes in a single project?
  • What are differences between Constructors and OnInit?
  • What did you like about working with Angular 2?
  • When will ngInit be called?
  • How would you make use of NgOnInit()?
  • What is the difference between NgOnInit() and constructor() of a component?
  • What is the possible order of life-cycle hooks?
  • What is the Best way to Declare and Access a Global Variable in Angular 2?
  • What is Angular 4? What’s New in Angular 4?
  • What is Angular 5? What’s New in Angular 5?
  • What’s New in Angular 6?
  • What is Components in Angular 2?
  • What are differences between Components and Directives?
  • What are Components Life-Cycles?
  • What is @Inputs in Angular 2?
  • What are Outputs in Angular 2?
  • What is hidden property in Angular 2?
  • How do components communicate with each other?
  • How would you create a component to display error messages throughout your application?
  • What are the difference between Renderer and ElementRef in angular 2?
  • What is an Angular 2 Service?
  • What are the features of Angular 2 Service?
  • What are the differences between Observables & Promises?
  • How To Create & Call Angular 2 Services in Components?
  • How do we create a singleton service in Angular 2?
  • How is HTTP Client Interact with Angular 2 Servers?
  • What the best way to inject one service into another in angular 2?
  • What is Pipes? Why use Pipes?
  • What is a pure and impure pipe?
  • What is Async Pipe?
  • How to create and use a custom Pipes?
  • Pipes Examples
  • What are Directives in Angular 2?
  • What is router-outlet directive in Angular 2?
  • What is a structural directive?
  • How do you identify a structural directive in HTML?
  • What is Template Angular 2? Why Use?
  • What are differences between template and templateUrl?
  • What are differences between templateUrl and styleUrls?
  • What is a template variable? How would you use it?
  • How to use {}, [], [] and [()] in Angular2 Template?
  • How can you add an active class to a selected element in a list component?
  • How to use style-URLs and styles in Angular 2?
  • How to import CSS using system import?
  • How to Load external CSS style into Angular 2?
  • What is Routing Concepts in Angular 2?
  • What is Routes?
  • What is Router Imports?
  • What is RouterOutlet?
  • Is it possible to have a multiple router-outlet in the same template?
  • What is RouterLink?
  • What are cookies in Angular 2?
  • How would you pass data from a parent component to a child component?
  • How would you pass data from a child component to a parent component?

Angular 2 Interview Questions Search Terms:

  • Angular 2 Interview Questions.
  • Angular 2 Interview Questions Latest.
  • Angular 2 Interview Questions Updated.
  • Angular 2 Interview Questions 2018.
  • Angular 4 Interview Questions.
  • Angular 5 Interview Questions.
  • Angular 6 Interview Questions.
ASP.NET Interview Questions, ASP.NET Interview Questions & Answers, ASP.NET Interview Questions and Answers

ASP.NET Interview Questions and Answers || TOP MNC’s FAQ

Before going to ASP.NET Interview Questions and Answers, the very first thing one must remember who is attending for .NET Interview is don’t go by book definition. Secondly, I suggest everyone, understand the concept with a practical example. The third and most important thing to remember, keep a good knowledge of your projects mentioned on the resume.

ASP.NET Interview Questions

In this article interview questions, we concentrate on the FAQs asked in top MNCs. Let’s try to understand the concept of each topic and if required with an example for better understanding.

Q1: What is ASP.NET?

ASP.NET is a framework developed by Microsoft, the successor of ASP(Active server pages). Using ASP.NET framework, we can develop the new generation of websites or web applications. In other words, the ASP.NET framework allows you to create, execute and deploy the web application and web services.

Advantages of using ASP.NET

  • Separation of code from HTML page conviction helps the developers to work seamlessly on core business logic implementation and design independently.
  • State Management solves the problems of managing the state of the webpage using the concepts of sessions state management and application state management.
  • The graphical user interface makes the developer easy by making use of drag-drop control from the toolbox and also IntelliSense support provided. IntelliSense support provided not only for server-side controls even for HTML and XML.
  • Ability to update files while the server is up and running and when clients are connected. By making use of the framework features, the new files are served on the subsequent client requests seamlessly.
  • As ASP.NET build under server-side technology, helps every developer to develop the most robust and secure web applications.

 Q2: Explain about ASP.NET Page Lifecycle?

When a client requests a page, then the page response(served) sent to the client and displayed. In the phase of request and response, there are a lot of exciting stages involved. These exciting phases are what we call it as page lifecycle.

There are four crucial phases involved in the phase life cycle, which every developer should remember

  1. Initialisation: During this phase, initialization of all the controls on the web page is performed. Each control is set with a UniqueID property so that it can be utilized at runtime by the programmer. The Page_Init event is called only once when the first request is made.
  2. Loading: The Page_Load event is used to know, whether page loaded for the first time or not.
  3. Rendering: During Page_Prerender phase options like ViewState is stored and custom themes can be fixed.
  4. Unloading: The Page_Unload is the last phase, where all controls are ready to render to the client.

Q3: What is ViewState?

Every webpage is stateless by default If ViewState technique is not there. Next question comes what is Stateless? Default, any HTML page cannot preserve the values after a postback, so this is why we call webpage as stateless. The only solution to overcome this is the ViewState.

The process of preserving the page control properties like ID, text, tooltip, etc. after a postback is known as maintaining the state of the webpage. The ASP.NET page framework uses the concept of ViewState to store control settings between postbacks.

Q4: What is the Web.config file in ASP.NET?

The web.config file is one of the most critical file in development of the ASP.NET application. In simple terms, the web.config is an XML file which is separated from your application code so that it does not impact the development code files.

The configuration file enables the web application settings for compiler options, user authentication, debugging, connection strings, and more. Please find the few critical “web.config” settings mentioned with examples.

  • Compiler and debugger settings: To serve the request of any web application, ASP.NET must compile. In compilation tag, debug, targetFramework are two important settings.
    • debug: true/false.
    • targetFramework: 3.0/3.5/4.0 etc.

  • Connection strings: Specifies the collection of database connection settings.

  • Custom Errors: Enables the application to handle the unexpected error, like showing the custom error pages.

Q5: What are the data controls available in ASP.NET

The controls are having the data source property signify as data controls in ASP.NET. The data source property is a dominant feature which allows the application to bind data from the data table, arrays, collections. It acts as a wrapper between controls and database, while read and write operations. The data binding uses a special syntax [<%# %] to evaluate the expression.

List of data-bind controls in ASP.NET

  • DataGrid
  • GridView
  • DataList
  • Repeater
  • FormView
  • BulletList
  • ListBox
  • DropDownList
  • RadioButtonList
  • CheckBoxList
  • much more.

Q6: What is User control in ASP.NET?

User controls in ASP.NET are much like derived/composite controls which works much like an ASP.NET web page. You can add existing web controls as per customer requirement and markup to user control. Moreover, you can define with custom properties and methods. The user control you can embed them in any web page, where they act like as a unit and gets your task done, just like your web controls.

Q7: What are the different Session state management techniques available in ASP.NET?

In traditional web programming, it would be typically mean when every page is posted to server the associated values will be lost. This happens because every time page is posted to the server a new instance of page class is created. to overcome this situation state management technique is used. ASP.NET includes several methods to include the data after postback. These features are as follows.

  • Client-Based State Management
    • View state
    • Cookies
    • Hidden fields
    • Query strings
  • Server-Based State Management
    • Application State
    • Session State
    • Profile Properties

Q8: What is Session State?

ASP.NET allows the save the data using session state. If different users are using the application, each user has a separate session state memory. Which means when one user leaves the system and another user will have different session state different from first.

Session state is maintained in the form of key, values pair for storing session-specific information. This would be useful to restore the values of each control while round trips to server happen.

Q9: What is Query String in ASP.NET?

Query string comes under client-based session management technique in ASP.NET. If a user wants to send values from one page(1.aspx) to another page(2.aspx) then query string is the best and easy approach.

1.aspx code:

If you look at below example code, here we are trying to pass two values namely first name, last name in “1.aspx” form.

2.aspx code:

In “2.aspx” web page using “Request.QueryString[“parameter_name“]” method, we can retrieve the value.

Q10: What are the different validators in ASP.NET?

  • RequiredField Validator.
  • Compare Validator.
  • RegularExpression Validator.
  • Range Validator.
  • Custom Validator.
  • Validation Summary.

Q11: What is a master page in ASP.NET?

Master pages concept in ASP.NET allows you to create a standard template based layout for your application. A master page defines the look & feel and grouping the standard option required for your application into one single template. Once a master page is defined then inheriting web pages will automatically have those look and fell and option defined in a master page. The extension of the master page is “***.master”.

Advantages of master pages

  • Master pages allow you to create a common functionality for all your web pages.
  • Any update happens on master pages then changes are implemented automatically on all the inheriting subpages, which makes maintenance easy.

Q12: What is caching?

Q13: What is the authentication and authorization in ASP.NET?

Q14: What is the web API in ASP.NET?

Q15: What is the difference between ASP.NET Web API and WCF?

Q16: What are the different types of caching?

Q17: What is the difference between Server.Transfer and Response.Redirect?

Q18: What is the base class for all Web Forms are inherited?

Q19: How can we apply Themes to an application?

Themes in application allow you to define a custom name for all your CSS files. Setting a theme at web configuration level will override all the CSS properties of controls unless you override theme for the individual page.

How to apply themes at the website level

The following example will help you to understand, how to apply themes using web.config files?

Q20: How can we improve the Performance of an ASP.NET Web Page?

Youtube: TOP 50 ASP.NET Interview Questions and Answers

Search Terms:

  • ASP.NET Interview Questions.
  • ASP.NET Interview Questions 2018.
  • ASP.NET Interview Questions and Answers.
  • ASP.NET Interview Questions and Answers 2018.
  • ASP.NET Interview Question and Answers.
  • ASP.NET Interview Question and Answers 2018.
  • ASP.NET Interview Question.
  • ASP.NET Interview Questions for experienced.
  • ASP.NET Interview Questions for experienced 2018.
  • ASP.NET Interview Questions top MNCs.
  • ASP.NET Interview Questions and answers Top MNC FAQ.
  • C# 8.0 Features

Allow only numbers in textbox, Allow only numbers in textbox Javascript

[Resolved]: Allow only numbers in textbox Javascript |, HTML, Javascript

There are situations while working with a webpage using plain HTML/Javascript/ c# to allow only numbers in textbox. There are two solutions for this, choose the best suitable for your need.

  • Using plain javascript code.
  • Using built-in Regular expression validator.

Answer 1:

Allow only numbers in textbox Javascript

If we look at below code, we are going to make use of HTML and javascript code. we have created a textbox with id “txtChar” in HTML body tag and “isNumberKey(evt)” function in javascript code. The key logic how this works is based on event named “onkeypress“.

I have created an “onkeypress” event passing the key pressed as a parameter to a javascript code and “isNumberKey(evt)” function will validation whether this key is number or not.

Below is the example code to allow only numbers in a textbox javascript.


Answer 2:

Code to allow only numbers in textbox using Regular Expression Validator in ASP.NET

This solution will be quiet straightforward. Using the regular expression validator in controller on the toolbar, drag and drop to the required form. Next, we can make use of the property ValidationExpression for validating the user input using regex expression (“\d+“). To make sure only integers are allowed in the textbox.

Example code to allow only numbers in a textbox using regular expression validator in c# is below.

Example Code:


C# Nullable Types, What Is Nullable Types In C#, The syntax of Nullable Type In C#, Declaring Nullable Types In C#, Nullable Types In C# Example

C# Nullable Types | What Is Nullable Types In C# with Example

In this article, we are going to learn about C# Nullable Types / Nullable Type In C#. Before defining Nullable types, Let’s understand why c# nullable types introduced? what is nullable type in c# and then how to use them?

Why C# Nullable Types?

To understand the answer, why c# nullable types? and follow the problem that nullable type can solve. The c# programming language support two kinds of data types.

  • Value type (e.g., struct, int, double, etc.)
  • Reference type (e.g., string, object, etc.)

Assigning a null value to a value is not possible until nullable types were introduced in .NET framework. By taking the advantage of nullable types now value type can store a null value.

A nullable type can hold a correct range of values of a value type (int, boolean etc.) plus NULL. This feature is really helpful when you are working with the database in real-time applications. In a real-time application, there are possibilities that database fields like boolean may need to hold true, false or undefined. Using this nullable type we can solve the problem of undefined.

The syntax of Nullable Type In C#

Declaring Nullable Types In C#

Nullable Types In C# Example

The following example will demonstrate the nullable types usage. number1 assigned to a null value and number2 with 22. Once the code is executed it will give you blank value because of nullable and second with 22 because the value is assigned.

The output of the program when compiled and executed


C# 8.0 Features, New Features In C# 8.0

C# 8.0 Features | New Features In C# 8.0

C# programming language is the most popular because every release makes the job easier. From past two decades, it has released seven versions now came up with c# 8.0. Let’s see C# 8.0 features.

New Features In C# 8.0 | C# 8.0 Features

  1. Default Implementation for Interfaces.
  2. Light Weight Classes.
  3. Nullable Types.

Default Implementation for Interfaces in C# 8.0

Default implementation for an interface is an exciting feature in C# 8.0. Until 7.0, we could only see interfaces only with abstract methods but now in .NET framework 8.0 added a default implementation for interface methods.

Using default implementation for interface has made drastic changes in development life cycle.

The default implementation of interfaces will provide a most powerful way to extend the classes that implement interfaces.

C# Light Weight Classes, records in C#

C# Light Weight Classes – Records in C#

C# Light weight classes allow creating a class more flexible. It’s beautiful and new way to build your class called as records. Records in c# enable creating POCO type objects very quickly. Records / C# Light Weight Classes also solve the problem of equality comparison of objects.

Creating a C# Light Weight Classes

The below example will help you to understand in implement immutable classes and auto implementation of properties. Person class has a private set property which can be initialized only by a constructor. This example you can see, how to initialize the dynamic object creation using LINQ.


C# Interfaces, Interfaces In C#, Interfaces In C# Programming, Features about Interfaces in c#, interfaces with realtime example, all about interfaces in C#

Interfaces In C# Programming – A Complete Guide

Interfaces in C# programming is a very crucial concept and quite confusing for a lot of developers to understand and implement. So I have created C# interfaces article to make sure, even a basic developer also can understand.

After going through this article, you will get the complete knowledge of interfaces like

  • What is an interface?
  • When to use interfaces?
  • Where to use interface?

C# Interfaces | Interfaces In C#

Let’s understand what c# interfaces are?.

Interfaces are declared using interface keyword. An interface is like a contract that all derived classes/interfaces should follow.

In other words, it’s like rules defined in the interface and these interface rules has to be followed by derived class or interfaces. So remember we are defining rules in interfaces and forcing them to follow in next subclasses.

Example: How to declare and implement interfaces in c#?

If you look at the above code, we have declared “IInput” interface with two methods (rules).

  • getkeyBoard()
  • getMouse()

In subsequent classes of Computer and Laptop, I am implementing the same rules defined in IInput Interface. I hope now you understood how to create rules and implement methods (rules) using interfaces in c#.

Features about Interfaces in c#

  • Interfaces are declared using interface keyword.
  • All methods in interfaces are by default public and we can’t change them.
  • An Interface contains methods with no implementations.
  • Interfaces may contain properties, methods, events, and indexers.
  • Any Interfaces cannot be Instantiated directly.