c# interview questions and answers for freshers
1. Why C#.Net?
A) To develop any type of application by using Dot NET. we must one Dot NET LANGUAGE to write the business logic of that application.
2. Explain about primitive data types?
In C#.NET, according to the type of the data and size of the data, data types classified into 5 types.
1. Numerical Data types
a) Signed Numerical data types: sbyte, short, int, long
b) Unsigned Numerical data types;-byte, ushort, uint, ulong
float, double, decimal
3.Character related Data types a) Char
4.Logical Data Types
5. General data Types
These data types called as PRIMITIVE DATA TYPES.
3. What is the MaxValue and MinValue?
A) MaxValue & MinValue predefined constants, which are members. of every primitive data type structure except bool.
. Using this Constant we can get the LEAST value and MOST value of a data type.
4. Difference between value types and Reference types?
1.In value types, data will storing in STACK MEMORY
2.Value type variable can contain the actual data.
3.In primitive data types except General data types called VALUE TYPES. They are Numerical, Floating, Character and Logical Ex: Int, Long, Char
4. Structures and Enums are value types
1.In this, Data will be storing in HEAP MEMORY
2.Reference type variable will contain the address of the data.
3.In primitive data types only General data types will come under REFERENCE TYPE EX: String, Object
4.Class, interface, delegates come under this.
5. What is the output?
static void Main (string  args)
Char c=’a’; int j=c;
6.Can I assign 1 or 0 into bool variable? static void Main(string args)
bool b = 1; Console.WriteLine(b); Console.ReadLine();
7. What is the output ?
static void Main(string args)
bool b = true; Console.WriteLine(b); Console.ReadLine();
OUTPUT: True 8.Can we assign null value into value type variable?
but we can assign null values into reference type variable.
9.How to assign null value into value type variable?
A) We have to go for NULLABLE VALUE TYPES.
Syntax: <ValueType> ? <VariableName>=NULL;
10. What is the difference between GetType() and typeof()?
1.Type It will return the given data base type 2.It is a operator
1.It will return the given variable data type base type 2.It is a method
For more Dot net interview questions: click here