InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What is MVC? Write difference between MVC and Web API? |
||||||||||||
|
Answer» MVC (Model, View, and Controller) is basically an application design model that comprises three interconnect parts I.e., model, view, and controller. It allows coders to factor out different components of the application and UPDATE them more easily. It is mostly used for developing model user interfaces. Its main purpose is to display PATTERNS in structure for keeping display and data separate to enable both of them to change WITHOUT affecting others.
|
|||||||||||||
| 2. |
How to register an exception filter globally? |
|
Answer» One can REGISTER exception FILTER globally USING FOLLOWING code: |
|
| 3. |
How to handle errors in Web API? |
|
Answer» Web API generally provides greater FLEXIBILITY in terms of handling errors. Exception handling is a technique that is used to handle run-time errors in APPLICATION code. One can use HttpResponseException, HttpError, Exception FILTERS, register exception filters, Exception handlers to handle errors. Exception filter can be used to identify unhandled exceptions on actions or controllers, exception handlers can be used to identify any type of unhandled exception application-wide, and HttpResponseException can be used when there is the POSSIBILITY of an exception. |
|
| 4. |
Who can consume Web API? |
|
Answer» A large range of clients such as browsers, mobile devices, iPhone, etc., include or CONSUME WEB API. It is also good for using along native applications that require web services but not SOAP support. It can also be consumed by any CLIENT that supports HTTP verbs such as GET, DELETE, POST, PUT. |
|
| 5. |
What are Web API filters? |
|
Answer» Filters are BASICALLY used to add extra logic at different LEVELS of Web API framework request processing. Different types of Web API filters are available as given below:
|
|
| 6. |
What is XML and JSON? |
|
Answer» XML (Extensible Markup Language):
|
|
| 7. |
Which of the following Open-source libraries is used by WEB API for JSON serialization? |
|
Answer» Json.NET LIBRARY is generally USED by Web API for JSON serialization. |
|
| 9. |
Explain media type formatters. |
|||||||||||||||
|
Answer» In WEB API, MEDIA type formatters are classes that are responsible for serialization data. Here, serialization generally means a process of translating data into a format that can be transmitted and RECONSTRUCTED later. Because of serializing request/response data, Web API can understand request data format in a better way and send data in a format that the client expects. It simply specifies data that is being transferred among client and SERVER in HTTP response or request.
|
||||||||||||||||
| 10. |
What is Web API 2.0? |
|
Answer» It is basically an enhanced and modified feature of Web API. This new version supports various new features as given below:
Because of all the new features of Web API 2.0, it is considered an optimal choice and suitable development MODEL that makes it easier to develop RESTful services interfaces to different clients running on various platforms. It also supports configuring routes in the Web API method or controller LEVEL. |
|
| 11. |
What is REST and SOAP? What is different between them? |
||||||||||||||||
|
Answer» REST (Representational State Transfer): It is a NEW and improved form of web service. It describes the architectural style of networked systems. It does not require greater bandwidth when requests are sent to the SERVER. It just includes JSON message. For example: {"city":"Mumbai","state":"Maharashtra"}SOAP (Simple Object Access Protocol): It is a simple and lightweight protocol that is generally used for exchanging structured and typed information on the Web. It works mostly with HTTP and RPC (Remote Procedure Call). This protocol is mainly used for B2B applications one can define a data contract with it. SOAP messages are heavier in content and THEREFORE use greater bandwidth. For example: <?xml version="1.0"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP-ENV:encodingStyle=" http://www.w3.org/2001/12/soap-encoding"><soap:Body><Demo.guru99WebService xmlns="http://tempuri.org/"> <EmployeeID>int</EmployeeID> </Demo.guru99WebService> </soap:Body></SOAP-ENV:Envelope>
|
|||||||||||||||||
| 12. |
What are the advantages of using Rest in Web API? |
|
Answer» REST is very IMPORTANT and beneficial in Web API because of the following REASONS:
|
|
| 13. |
What is different between REST API and RESTful API? |
||||||||||||
|
Answer» REST (Representation State Transfer) API: It is basically an architectural style that makes PRODUCTIVE USE of existing technology and protocols of the web. It is a SET of rules that developers need to follow when they develop their API or services that are scalable. It is used with HTTP protocol using its verbs such as GET, DELETE, POST, PUT.
|
|||||||||||||
| 14. |
Why to choose Web API over WCF? |
|
Answer» Web API is considered the best choice over WCF because of the following reasons:
|
|
| 15. |
What is the difference between Web API and WCF? |
||||||||||||||
|
Answer» WCF (Windows Communication Foundation): It is a framework used for developing SOAP (Service-oriented applications). This framework is used for developing, configuring, and deploying, or implementing network-distributed services.
|
|||||||||||||||
| 16. |
What are the main return types supported in Web API? |
|
Answer» It does not have any specific data type. It can return data of any type DEPENDING upon the business requirement. There are many HTTP methods LIKE GET, POST, PUT, etc., which can return data in different formats depending upon the use CASE. |
|
| 17. |
What is Web API and why we use it ? |
|
Answer» Web API (Application Programming Interface), as the name suggests, is an API that can be accessed over the Web using the HTTP PROTOCOL. It is basically considered the best platform for revealing or uncovering data and services to various different services. It is a tool that can be USED to PUSH data to a server and can be accessed by server code. It can be built or developed using various technologies LIKE java, ASP.NET, etc.
|
|
| 18. |
Why is the Web API important? |
|
Answer» Web API is generally considered as a service that basically provides us information or data from the server. It is very important because of the following reasons:
|
|