Interview Tips Interview Tips, Interview Questions and Answers

14May/100

.NET Object Serialization – How do you encapsulate the binary serialization?

How do you encapsulate the binary serialization?

public static void SerializeBinary( object o, string file_name)
{
using (FileStream fs = new FileStream(file_name, FileMode.Create)) {
BinaryFormatter fmt = new BinaryFormatter ();
fmt.Serialize(fs, o);
}
}

How do you implement a custom serialization?

CUSTOM SERIALIZATION implementation
public class A: ISerializable
{
private int a;
protected A(SerializationInfo si, StreamingContext sc)
{
this.a = serializationInfo.GetInt32("a");
}
public void ISerializable.GetObjectData(SerializationInfo si, StreamingContext sc)
{
si.AddValue("a", this.a);
}
}

20Apr/100

.NET interview: Questions on serialization

How do you encapsulate the binary serialization?

public static void SerializeBinary( object o, string file_name)
{
using (FileStream fs = new FileStream(file_name, FileMode.Create)) {
BinaryFormatter fmt = new BinaryFormatter ();
fmt.Serialize(fs, o);
}
}

How do you implement a custom serialization?

CUSTOM SERIALIZATION implementation
public class A: ISerializable
{
private int a;
protected A(SerializationInfo si, StreamingContext sc)
{
this.a = serializationInfo.GetInt32("a");
}
public void ISerializable.GetObjectData(SerializationInfo si, StreamingContext sc)
{
si.AddValue("a", this.a);
}
}

12Mar/100

simple C# interview question that most developer fails

How do you define a property read only for the outside world and writable for the same assembly classes?

For example I have a class named User where everyone outside the assembly can read the string ‘Name’ property but cannot set it. However the classes inside the assembly is able to set the property.  I am further detailing the exlanation.

User myUser = SomeClass.GetUser();

// OK for all classes since all can read it
string name = myUser.Name;   

// This line does not compile if this code is
// written in a class that is not in the same
// assembly as the type User. But it compiles
// if the code is written in the same assembly
// that contains the type user.
myUser.Name = "C# Developer";

Answer:

Now all I want is the c# code declaration for the property name that matches my requirement of being read only for the outside world. Write it in the comments section. I will answer the question 24 hours from now.

8Mar/100

Microsoft – C# Interview Questionsv

1. How do you inherit from a class in C#?
2. What is .NET Framework?
3. How we handle sql exceptions? What is the class that handles SqlServer exceptions?
4. What is the advantage of serialization?
5. how to fill datalist usinf XML file and how to bind it,code behind language is c#
6. What is the difference between const and static read-only?
7. Is it mandatory to implement all the methods which are there in abstract class if we inherit that abstract
8. Why do I get a "CS5001: does not have an entry point defined" error when compiling?
9. What's the implicit name of the parameter that gets passed into the class' set method?
10. What is indexer? Where it is used explain
11. Does C# support multiple inheritance?
12. When you inherit a protected class-level variable, who is it available to?
13. Are private class-level variables inherited?
14. Describe the accessibility modifier protected internal.
15. What is the implicit name of the parameter that gets passed into the class set method?
16. What's the top .NET class that everything is derived from?
17. How's method overriding different from overloading?
18. What does the keyword virtual mean in the method definition?
19. What is an abstract class?
20. What is the data provider name to connect to Access database?

28Dec/090

Reasons Why People Don’t Get Hired

It is very important to be on time for the interview. On time means ten to fifteen minutes early. If need be, take some time to drive to the office ahead of time so you know exactly where you are going. Know the interviewer's name and use it during the interview. If your not sure of the name, call and ask prior to the interview. Remember to bring an extra copy of your resume and a list of references.

During the interview try to remain as calm as possible. Ask for clarification if you're not sure what's been asked and remember that it is perfectly acceptable to take a moment or two to frame your responses so you can be sure too fully answer the question.

Reasons Why People Don't Get Hired:

  • Untidy personal appearance
  • Inability to express information clearly
  • Lack of genuine interest or enthusiasm
  • Unwillingness to start at the bottom
  • Negative attitude
  • Lack of eye contact
  • Incomplete or sloppy application
  • Being late for the interview