Professionallearn.com

[ Log On ]
< <
 

TUTORIALS

Interview-Questions C#

General Questions

1. Does C# support multiple-inheritance?

No.

2. Who is a protected class-level variable available to?

It is available to any sub-class (a class inheriting this class).

3. Are private class-level variables inherited?

Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.

4. Describe the accessibility modifier “protected internal”.

It is available to classes that are within the same assembly and derived from the specified base class.

5. What’s the top .NET class that everything is derived from?

System.Object.

6. What does the term immutable mean?

The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

7. What’s the difference between System.String and System.Text.StringBuilder classes?

System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

8. What’s the advantage of using System.Text.StringBuilder over System.String?

StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.

9. How do you convert a value-type to a reference-type?

Use Boxing.

10. What happens in memory when you Box and Unbox a value- type?

Boxing converts a value-type to a reference-type, thus storing the object on the heap. Unboxing converts a reference-type to a valuetype, thus storing the value on the stack.
More Questions Download Here

--.NET Interview questions

1. Basic .NET Framework

What is a IL?

Twist :- What is MSIL or CIL , What is JIT? (IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In- Time (JIT) compiler.

What is a CLR?

Full form of CLR is Common Language Runtime and it forms the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program. For example VC++ has MSCRT40.DLL,VB6 has MSVBVM60.DLL, Java has Java Virtual Machine etc. Similarly .NET has CLR. Following are the responsibilities of CLR

√ Garbage Collection :- CLR automatically manages memory thus eliminating memory leaks. When objects are not referred GC automatically releases those memories thus providing efficient memory management.


√ Code Access Security :-

CAS grants rights to program depending on the security configuration of the machine. Example the program has rights to edit or create a new file but the security configuration of machine does not allow the program to delete a file. CAS will take care that the code runs under the environment of machines security configuration.


√ Code Verification :-

This ensures proper code execution and type safety while the code runs. It prevents the source code to perform illegal operation such as accessing invalid memory locations etc.


√ IL( Intermediate language )-to-native translators and optimizer’s :-

CLR uses JIT and compiles the IL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the IL code.


More Question Download Here


--Microsoft Certification Questions ( MCTS)

QUESTION 1:

You create a Web Form that allows users to create a new account. You add a CreateUserWizard control by using the following code segment. You need to ensure that the wizard automatically sends an e-mail message to users when they finish creating their accounts. You add a valid element to the Web.config file. Which code segment should you add to the PageLoad event?

A. Wizard1.RequireEmail = True
B. Wizard1.Email = "user@address.com"
C. Wizard1.MailDefinition.From = "registration@mysite.com"
D. SmtpMail.SmtpServer = "mail.contoso.com"

Answer: C
Explanation: Correct Answer: C Setting the MailDefinition.From property of the wizard will enable the automatic sending of emails. A RequireEmail property to True will have no affect because this is the default value anyway. The wizard will throw an exception if the RequireEmail property is true and an email for the user is not given. B will set the email address of the user to user@address.com. Clearly this is incorrect because the intention is to email the specific user that has been created. D The question states that details of the SMTP server have already been provided in the web.config file.
More Questions Download Here

Share Your Source Code or Article

Do you have source code, articles, tutorials, web links, and books to share? You can write your own content here. You can even have your own blog.

Submit now...

Sponsor