Subscribe - It's FREE!!

Stay Connected Here

Stay Updated With Us Here



Google

C# Interview questions and answers for freshers and experienced - Part Two


Share with WhatsApp


With my first post of C# Interview Questions and Answers for freshers and experienced developers in this post I am sharing some more questions for the same range of experience.

If you have not provide any access modifier to a class then what is the default access specifier?

This is very basic question but for freshers it can create confusion between internal and private. Coming to the answer when you don't specify any access modifier to class then by default it has "internal" as its access modifier.
Don't get confused between access modifier and member accessibility of class. Access modifier is for class and it is "internal" by default on the other hand member accessibility is for members of a class for which "private" is default access modifier if not provided.

For others below are default access modifiers if not provided.

struct - internal
enum -  public
interface - public
methods, fields, and properties - private

When class is instantiated by using the new keyword then its constructor gets called. Right??
Suppose If I haven't provide any constructor for class then can I create a object a class?

Yes, you can create a object of class as C# will create one by default if you do not provide any constructor which instantiates class object and sets member variables to the default values.

What are Generics in C#?

Generics is C# feature introduced in version 2.0 using which you can define type-safe classes to maximize code reuse,type safety and performance.For example using generic type T you can write a single class that other client code can use without incurring the cost or risk of runtime casts or boxing operations.

In simple words, using generic you can create a common code which will allow us to use type as a parameter.

To know more about generics do visit this post on MSDN here.

Can we inherit from static class if we declare instance constructor in the that class?

No you cannot inherit from static class as by default it is sealed and you cannot declare instance constructor for static class as you cannot create a object of it and CLR loads it automatically when the program or namespace that contains the class is loaded however they can contain static constructor.

What are the different types of JIT (Just in Time) compiler?

There are 3 types for JIT(Just in Time) compiler which are as follows,

Pre-JIT

This type of JIT Compiler compiles complete source code into native code in a single compilation cycle which is done at the time of deployment of the application.

Econo-JIT  

This type of JIT Compiler compiles only those methods that are called at runtime but these compiled methods are removed when they are not required.

Normal JIT 

Normal-JIT compiles only those methods that are called at runtime.These methods are compiled the first time they are called, and then they are stored in cache.When the same methods are called again, the compiled code from cache is used for execution.


Hope you have benefited by reading this post. If you are finding these questions very basic you can read some advanced interview questions here.

Do not forget to share your thoughts in comment section below also share these questions with your friends by using share buttons provided. Thanks.

Go to Part Three



If you enjoyed this post take 5 seconds to share it! Be Socialable. :-)

Share with WhatsApp

Posts To Read Next

C# Interview questions and answers for freshers and experienced - Part One

C# Interview Questions & Answers for 1-3 years of experience. Collection of some fresher and experienced level interview questions.


C# Interview questions and answers for freshers and experienced - Part Three

What is InvariantCulture,Difference between string & System.String,Kinds of parameters,int vs uint are some questions which I am sharing in this post.


How to Prepare for the interviews - Simple but important tips - Part 1 - Resume Writing

In this post I will share some interview tips from my own personal experience which will help you to prepare for the interview. In part one I will cover how to design a resume which will put your first impression smartly.


How to Prepare for the interviews - Simple but important tips - Part 3 - Prepare for HR Round

In this third post of my interview tips series, I am going to share some tips about how to prepare for HR Round. Also about things to do and things to not to do during the same.


How to Prepare for the interviews - Simple but important tips - Part 2 - Things that matter during interview

In this second post of my interview tips series, I am going to share some tips about how to behave during the interview. Also about how to prepare for the interview and maintain self confidence during the interview.


Your opinion is valuable for us! Comments, suggetions are welcome.


Submit your Email Id to stay updated with us and get notified with our new posts. It's FREE!
Vu 32'' TV Vu 24'' TV
We know this popup is disturbing you!
But We would greatly appreciate if you share us with your friends below!

It will not take more than 2 seconds but will motivate us greatly to write more,share more!

x