c# interview questions and answers

c#questions and answers

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.
They are—
1. Numerical Data types
a) Signed Numerical data types: sbyte, short, int, long
b) Unsigned Numerical data types;-byte, ushort, uint, ulong
2.Floating
float, double, decimal
3.Character related Data types a) Char
4.Logical Data Types
a) bool
5. General data Types
a) string
b) object
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?
VALUE 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
REFERENCE 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;
Console.WriteLine (j);
Console.ReadLine ();
}
Output: 97
 
6.Can I assign 1 or 0 into bool variable? static void Main(string[] args)
{
bool b = 1; Console.WriteLine(b); Console.ReadLine();
}
A) No.
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()?
Typeof()
1.Type It will return the given data base type 2.It is a operator
GetType()
1.It will return the given variable data type base type 2.It is a method

For more Dot net interview questions: click here

Dot net training in Hyderabad:-Kosmik provides dot net training in Hyderabad. we are providing lab facilities with complete real time training and training based on advanced concepts.

 

Dot net interview questions and answers

dot net interview questions and answers for freshers

1.Difference between .Net Framework and VisualStudio.Net?

.NET FRAMEWORK

  • It is a run- time environment, which
    we can use to run applications.
  • It is required for .net developers and
    .net application end users
  • It is a freeware which we can
    download from Microsoft Website.

VISUAL STUDIO .NET

  • It is a development environment,
    which we can use to develop
    applications.
  • It is required for only .net developers.
  • It is not freeware which we have to
    purchase from Microsoft.

2 . What is JIT Compiler?

JIT (JUST-IN-TIME) Compiler will convert MSIL (Microsoft Intermediate Language) code to Native code because operating system can understand only Native code or machine code.

3 .What is CLS?
 . CLS (Common Language Specifications) is a set of common language standard defined by the Microsoft for all .NET Languages.

  .Every .NET Language has to follow CLS Standards.

 . Whenever a Programming Language wants to recognize as .NET Language then it has to follow CLS.

4. What is CTS?

–CTS (Common Type System) is a subset of CLS. It is a set of common

based data types defined by Microsoft for all .NET Languages.

–2. Every .NET Language has to map their data types with CTS types.

Common Type System

 

 

 

 

 

5. Explain .net application Execution process?

Diagram for .net application execution process :

A) .Net application Execution process can be divided into 2 steps:

.net applicationcompilation process

Step1. Converting HIGH level language code into MSIL (Microsoft Intermediate Language) with the help of language compilers because .Net execution engine (CLR) can understand only MSIL code.

Step2. JIT (JUST-IN-TIME) compiler will convert MSIL code to NATIVE code because operating system can understand only NATIVE code or MACHINE code.

6. What is MSIL Code?
.Microsoft Intermediate Language (MSIL), is one of the Core component of the

.NET Framework. Any .NET source codes written in any .net supportive language (C#, VB.net etc), when compiled are converted to MSIL. This MSIL, when installed or at Runtime, gets converted to the machine code. The Runtime conversion of MSIL code to the machine code is handled by a component called as the Just In Time (JIT) Compiler.

7.What is Managed Code and Unmanaged Code?

Managed Code

 A) Managed code:

 The code which is taking the help of CLR for execution is called as managed code.

 Example for Managed Code:-

 All .net languages code is managed code.

 VB.Net code, C#.Net code…etc

 B) Unmanaged code: –

 The code which is not taking the help of CLR for execution is called as Unmanaged code..

 Example for Unmanaged Code:-VB Code, VC++ Code…

 Note: – .net application can contain non .net code.

8. What is CLR?

 CLR stands for Common Language Runtime, it is .net execution.

CLR is a common execution engine for all .NET Languages that means

every .NET language application has to execute with the help of CLR.

Dot net training in hyderabad:-

Kosmik provides dot net training in Hyderabad. we are providing lab facilities with complete real time training and training based on advanced concepts. 

for latest Dot net interview questions and answers :-