WEB API Interview Questions

Q: Content Negotiation In Web API is “the process of selecting the best representation for a given response when there are multiple representations available.” The statement is True or False
Answer: True

Q: Which statement is true for Http header “Accept”
Statement 1: Accept specifies which media types are acceptable for the response such as “application/Json”, “application/xml”
Statement 2: Accept specifies which Character sets are acceptable
Answer: Statement 1

Q: Is Web API can be used with Web forms
Statement 1: Yes, Web API can be implemented in Web Forms through below steps
1. Drive a controller class from WebAPI Controller
2. Add route table to Application Start of Global.asax class.
3. Now, make http call to Web API either from Ajax/Jquery or from server side
Statement 2: No, It can’t be Implemented
Answer: Statement 1

Q: What is the correct way to create a Alias for Web API action method
Option 1:
Public void GetData(int ID)
// place your logic here
Option 2:
[ActionName = “GetDataOnID”]
Public void GetData(int ID)
// place your logic here
Answer: Option 1

Q: If some unhandled exception occurs in Web API which is not handled through Exception Filters, then the client will receive error message “Internal Server Error”. Is this true or not
Answer: True

Q: Exception Filters in Web API can be registered at what level
Option 1: At Controller level only
Option 2: At Action Method Level, At Controller Level and At Global Level
Answer: Option 2

Q: Can we restrict a particular Action method in WEB API to be called from Http Post verb only.
Option 1: Yes, by decorating the Action Method with [HttpPost] attribute
Option 2: No, all Action Methods are accessible for all Http Verbs
Answer: Option 1

Q: Can we configure WEB API to work over TCP protocol
Option 1: Yes, we can by changing the configuration file
Option 2: No, WEB API only works with Http protocol
Answer: Option 2

Q: Is WEB API generate proxy classes when they are called
Option 1: No, they are accessed over simple Http protocol
Option 2: Yes, proxy classes are used by clients to check what action methods are exposed by WEB API
Answer: Option 1

Good Luck, Go Crack Interviews 😉


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s