Showing posts with label Interview-WCF. Show all posts
Showing posts with label Interview-WCF. Show all posts

Wednesday, April 4, 2018

EC Info System

OOPS
1. Diff between struct and class.

2. When we should use struct and when class?
Ans:Its identity is important. Structures get copied implicitly when being passed by value into a method.
It will have a large memory footprint.
Its fields need initializers.
You need to inherit from a base class.
You need polymorphic behavior;
Use a structure if:

It will act like a primitive type (int, long, byte, etc.).
It must have a small memory footprint.
You are calling a P/Invoke method that requires a structure to be passed in by value.
You need to reduce the impact of garbage collection on application performance.
Its fields need to be initialized only to their default values. This value would be zero for numeric types, false for Boolean types, and null for reference types.
Note that in C# 6.0 structs can have a default constructor that can be used to initialize the struct’s fields to nondefault values.
You do not need to inherit from a base class (other than ValueType, from which all structs inherit).
You do not need polymorphic behavior

3. A class has a list struct array, what will be the impact on performance.
Ans : degrade because member variable will go in heap

4. When static variable initialized?
Ans : Static variables are initialized as soon as the class loads with the default value. A variable in C# can never have an uninitialized value.

SQL
1. What is index?
2. Why do we need index?
3. On which column we should apply index.
4. Diff bet store procedure and function.
5. Which function return more than one value?
Ans :

To return multiple values from a function you need to return table

CREATE FUNCTION MyFunction
(
@MyParam int
)
RETURNS TABLE 
(
MyColumn1 int,
    MyColumn2 nvarchar(max)
)
AS
BEGIN


RETURN (SELECT Column1,Column2 FROM MyTable WHERE ColumnX="MyParam)

END

It is called table valued function.

6. Inner join, Left Outer Join, Right Outer Join, Full Join, Cross Join, Union  and Union All
7. If table has wrong entry for a column named gender, write query to correct. Female has entered M and Male has entered F by mistake.
Ans : UPDATE tbl SET Gender = (CASE WHEN Gender = 'Male' THEN 'Female' ELSE 'Male' END)

8. What is data integrity?
9.

Entityframework
1. What is DBContext?
Ans: It is a bridge between your domain or entity classes and the database.

2. We have two table Customer and Order, We want data for the order, customer wise.
3. What is benefit of MVC?
4. What is difference between MVVM and MVC?
5. Which approach will you use model first, code first, data base first.
And which approach will you use when.
6. What is data anotation?
7. Write an annotation so that a field only accept value in hexa decimal.
8. What are contents in edmx file?

http://tutorial.techaltum.com/Edmx-file-in-Entity-Framework.html

WCF
1. How many contract are there in WCF?
2. If we have private property in a data contract than this property will expose or not.
Ans Yes

3. If want to prevent a property from exposing to outside world in WCF.
Ans : Make it private and remove DataMember

4. If we have two method with same name in WCF. Than how will you handle it.
Ans : Overload with Name attribute of OperationContract.

Web API
1. Diff Between Web API and Web Service.
2. We have an enum which contains color name, How will you pass enum value in Web APi method.
Ans: 
Use it like this.
public class Person { public string FirstName { get; set; } public string LastName { get; set; } [JsonConverter(typeof(StringEnumConverter))] public Language PrimaryLanguage { get; set; } }
https://exceptionnotfound.net/serializing-enumerations-in-asp-net-web-api/

Thursday, February 1, 2018

Evon

1.   What is the first step to create WCF service?
Ans: 1. Select the project type class library.
2. Add a class named Calc.
3. Add a namespace System.Runtime.Serialization.
4. Decorate the class with DataContratc.
5. Decorate the member with DataMember
6. Decorate the methods with OpertaionContract.
7. Add an interface named ICalcService.
8. Add a namespace System.ServiceModel
9. Decorate the interface with ServiceContract.
10. Decorate the method declaration with OperationContract.
11. Implement the class with interface ICalsService
12. Add ServiceBehavior attribute on class
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
13. Add the App.config and Edit it.

2.   What are Instance Mode?
3.   What are Concurrency Mode?
4.   Which is better WCF or Web APi?
5.   If we have two client desktop and Mobile what will you create?
6.   Where will be the entityframe work used in WPF or in WCF?
7.   How model will update while updating database in entity-framework?
Ans : Right clicking on your EDMX file and selecting Open With -> ADO.NET Entity Data Model Designer
Right click on the designer surface of the EDMX designer and click Update Model From Database...
All entities are refreshed by default, new entities are only added if you select them.

8.   What is renterent mode?
9.   What are the resources in WPF?
10. If you have user control consisting text block where will you create resources?
11. Can we mix Data Contract and Message Contract both in a single class?
Ans : No
 Mixing message and data contracts will cause a run time error when you generate WSDL from the service.
12. What is binding?
13. How will you fast a WPF application?
14. What are the ways of DataContext?
Ans. Xaml and in Code behind
Xaml is better.

Followers

Link

Labels