SlideShare a Scribd company logo
Net-informations.com
.Net (C#/Vb.net/Asp.Net) Interview Questions and Answers
The practical guide to the .Net interview process
http://net-informations.com/faq/default.htm
Which class is super class of all classes in .NET Classes?
Object Class (System.Object) is the base class of .NET Classes
What is the execution entry point for a C# console application?
The Main method is the execution entry point of C# console
application.
static void main(string args[])
{
}
Why Main() method is static?
You need an entry point into your program. A static method can be
called without instantiating an object. Therefore main() needs to be
static in order to allow it to be the entry to your program.
What is string[] args in Main method? What is there use?
The parameter of the Main method is a String array that represents the
command-line arguments. The string[] args may contain any number
of Command line arguments which we want to pass to Main() method.
More Questions and Answers: http://net-informations.com/faq/default.htm
.Net is Pass by Value or Pass by Reference?
By default in .Net, you don't pass objects by reference. You pass
references to objects by value. However, you get the illusion it's pass
by reference, because when you pass a reference type you get a copy
of the reference (the reference was passed by value).
What is nullable type in c#?
Nullable type is new concept introduced in C#2.0 which allow user to
assingn null value to primitive data types of C# language.
It is important to not taht Nullable type is Structure type.
What is Upcasting ?
Upcasting is an operation that creates a base class reference from a
subclass reference. (subclass -> superclass) (i.e. Manager -> Employee)
What is Downcasting?
Downcasting is an operation that creates a subclass reference from a
base class reference. (superclass -> subclass) (i.e. Employee ->
Manager)
More Questions and Answers: http://net-informations.com/faq/default.htm
What is managed/unmanaged code?
Managed code is not directly compiled to machine code but to an
intermediate language which is interpreted and executed by some
service on a machine and is therefore operating within a secure
framework which handles things like memory and threads for you.
Unmanaged code is compiled diredtly to machine code and therefore
executed by the OS directly. So, it has the ability to do
damaging/powerful things Managed code does not.
C# is managed code because Common language runtime can compile
C# code to Intermediate language.
Can I override a static methods in C#?
No. You can't override a static method. A static method can't be virtual,
since it's not related to an instance of the class.
Can we call a non-static method from inside a static method?
Yes. You have to create an instance of that class within the static
method and then call it, but you ensure there is only one instance.
More Questions and Answers: http://net-informations.com/faq/default.htm
Explain namespaces in C#?
Namespaces are containers for the classes. Namespaces are using for
grouping the related classes in C#.
"Using" keyword can be used for using the namespace in other
namespace.
What is the % operator?
It is the modulo (or modulus) operator. The modulus operator (%)
computes the remainder after dividing its first operand by its second.
3 % 2 == 1
What is Jagged Arrays?
The array which has elements of type array is called jagged array. The
elements can be of different dimensions and sizes.
We can also call jagged array as Array of arrays.
More Questions and Answers: http://net-informations.com/faq/default.htm
Difference between a break statement and a continue statement?
Break statement: If a particular condition is satisfied then break
statement exits you out from a particular loop or switch case etc.
Continue statement: When the continue statement is encountered in a
code, all the actions up till this statement are executed again without
execution of any statement after the continue statement.
Difference between an if statement and a switch statement?
The if statement is used to select among two alternatives only. It uses a
boolean expression to decide which alternative should be executed.
While the switch statement is used to select among multiple
alternatives. It uses an int expression to determine which alternative
should be executed.
Difference between the prefix and postfix forms of the ++
operator?
Prefix: increments the current value and then passes it to the function.
i = 10;
Console.WriteLine(++i);
Above code return 11 because the value of i is incremented, and the
value of the expression is the new value of i.
More Questions and Answers: http://net-informations.com/faq/default.htm
Postfix: passes the current value of i to the function and then increments
it.
i = 20;
Console.WriteLine(i++);
Above code return 20 because the value of i is incremented, but the
value of the expression is the original value of i
Can a private virtual method be overridden?
No, because they are not accessible outside the class.
Can you store multiple data types in System.Array?
No , because Array is type safe.
If you want to store different types, use System.Collections.ArrayList
or object[]
What’s a multicast delegate in C#?
Multicast delegate is an extension of normal delegate. It helps you to
point more than one method at a single moment of time
More Questions and Answers: http://net-informations.com/faq/default.htm
Can a Class extend more than one Class?
It is not possible in C#, use interfaces instead.
Can we define private and protected modifiers for variables in
interfaces?
Interface is like a blueprint of any class, where you declare your
members. Any class that implement that interface is responsible for its
definition. Having private or protected members in an interface doesn't
make sense conceptually. Only public members matter to the code
consuming the interface. The public access specifier indicates that the
interface can be used by any class in any package.
When does the compiler supply a default constructor for a class?
In the CLI specification, a constructor is mandatory for non-static
classes, so at least a default constructor will be generated
by the compiler if you don't specify another constructor. So the default
constructor will be supplied by the C# Compiler for you.
How destructors are defined in C#?
C# destructors are special methods that contains clean up code for the
object. You can not call them explicitly in your code as they are called
implicitly by GC.
In C# they have same name as the class name preceded by the ~ sign.
More Questions and Answers: http://net-informations.com/faq/default.htm
What is a structure in C#?
In C#, a structure is a value type data type. It helps you to make a single
variable hold related data of various data types. The struct keyword is
used for creating a structure.'
What's the difference between the Debug class and Trace class?
The Debug and Trace classes have very similar methods. The primary
difference is that calls to the Debug class are typically only included in
Debug build and Trace are included in all builds (Debug and Release).
What is the difference between == and quals() in C#?
The "==" compares object references and .Equals method compares
object content
Can we create abstract classes without any abstract methods?
Yes, you can. There is no requirement that abstract classes must have
abstract methods. An Abstract class means the definition of the class is
not complete and hence cannot be instantiated.
More Questions and Answers: http://net-informations.com/faq/default.htm
Can we have static methods in interface?
You can't define static members on an interface in C#. An interface is
a contract, not an implementation.
Can we use "this" inside a static method in C#?
No. Because this points to an instance of the class, in the static method
you don't have an instance.
Can you inherit multiple interfaces?
Yes..you can
Explain object pool in C#?
Object pool is used to track the objects which are being used in the
code. So object pool reduces the object creation overhead.
What is static constructor?
Static constructor is used to initialize static data members as soon as
the class is referenced first time.
More Questions and Answers: http://net-informations.com/faq/default.htm
Difference between this and base ?
this represents the current class instance while base the parent.
What's the base class of all exception classes?
System.Exception class is the base class for all exceptions.
How the exception handling is done in C#?
In C# there is a "try… catch" block to handle the exceptions.
Why to use "using" in C#?
The reason for the "using" statement is to ensure that the object is
disposed as soon as it goes out of scope, and it doesn't require explicit
code to ensure that this happens. Using calls Dispose() after the using-
block is left, even if the code throws an exception.
What is a collection?
A collection works as a container for instances of other classes. All
classes implement ICollection interface.
More Questions and Answers: http://net-informations.com/faq/default.htm
Can finally block be used without catch?
Yes, it is possible to have try block without catch block by using finally
block. The "using" statement is equivalent try-finally.
How do you initiate a string without escaping each backslash?
You put an @ sign in front of the double-quoted string.
String ex = @"without escaping each backslashrn"
Can we execute multiple catch blocks in C#?
No. Once any exception is occurred it executes specific exception catch
block and the control comes out.
What does the term immutable mean?
The data value may not be changed.
What is Reflection?
Reflection allows us to get metadata and assemblies of an object at
runtime.
More Questions and Answers: http://net-informations.com/faq/default.htm

More Related Content

What's hot

Angular Interview Questions & Answers
Angular Interview Questions & AnswersAngular Interview Questions & Answers
Angular Interview Questions & Answers
Ratnala Charan kumar
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
Sagar Pednekar
 
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
ASP.NET MVC Interview Questions and Answers by Shailendra ChauhanASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
Shailendra Chauhan
 
Basic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a jobBasic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a job
Garuda Trainings
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
Dr.Neeraj Kumar Pandey
 
C# conventions & good practices
C# conventions & good practicesC# conventions & good practices
C# conventions & good practices
Tan Tran
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
Prem Kumar Badri
 
Inner class
Inner classInner class
Inner class
Guna Sekaran
 
Coding Best Practices
Coding Best PracticesCoding Best Practices
Coding Best Practices
mh_azad
 
Info manual testing questions
Info manual testing questionsInfo manual testing questions
Info manual testing questions
Sandeep
 
Exception Handling in JAVA
Exception Handling in JAVAException Handling in JAVA
Exception Handling in JAVA
SURIT DATTA
 
C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
sharqiyem
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
Ashita Agrawal
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
Iwan van der Kleijn
 
Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
Dr.Neeraj Kumar Pandey
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
rahulsahay19
 
C#.NET
C#.NETC#.NET
C#.NET
gurchet
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
Lalit Kale
 
.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
Doncho Minkov
 
Exception Handling in C#
Exception Handling in C#Exception Handling in C#
Exception Handling in C#
Abid Kohistani
 

What's hot (20)

Angular Interview Questions & Answers
Angular Interview Questions & AnswersAngular Interview Questions & Answers
Angular Interview Questions & Answers
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
ASP.NET MVC Interview Questions and Answers by Shailendra ChauhanASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
ASP.NET MVC Interview Questions and Answers by Shailendra Chauhan
 
Basic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a jobBasic java important interview questions and answers to secure a job
Basic java important interview questions and answers to secure a job
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
C# conventions & good practices
C# conventions & good practicesC# conventions & good practices
C# conventions & good practices
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
 
Inner class
Inner classInner class
Inner class
 
Coding Best Practices
Coding Best PracticesCoding Best Practices
Coding Best Practices
 
Info manual testing questions
Info manual testing questionsInfo manual testing questions
Info manual testing questions
 
Exception Handling in JAVA
Exception Handling in JAVAException Handling in JAVA
Exception Handling in JAVA
 
C# Exceptions Handling
C# Exceptions Handling C# Exceptions Handling
C# Exceptions Handling
 
Introduction to Java
Introduction to JavaIntroduction to Java
Introduction to Java
 
Type script - advanced usage and practices
Type script  - advanced usage and practicesType script  - advanced usage and practices
Type script - advanced usage and practices
 
Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
 
Introduction To C#
Introduction To C#Introduction To C#
Introduction To C#
 
C#.NET
C#.NETC#.NET
C#.NET
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
 
Exception Handling in C#
Exception Handling in C#Exception Handling in C#
Exception Handling in C#
 

Similar to C# interview-questions

C# interview
C# interviewC# interview
C# interview
ajeesharakkal
 
C#
C#C#
Java interview questions
Java interview questionsJava interview questions
Java interview questions
G C Reddy Technologies
 
Core java questions
Core java questionsCore java questions
Core java questions
Pradheep Ayyanar
 
Java scjp-part1
Java scjp-part1Java scjp-part1
Java scjp-part1
Raghavendra V Gayakwad
 
Viva file
Viva fileViva file
Viva file
anupamasingh87
 
Csci360 20
Csci360 20Csci360 20
Csci360 20
neetukalra
 
Csci360 20 (1)
Csci360 20 (1)Csci360 20 (1)
Csci360 20 (1)
manish katara
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
Gradeup
 
Code Metrics
Code MetricsCode Metrics
Code Metrics
Attila Bertók
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
Shashwat Shriparv
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
ansariparveen06
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
Ganesh Samarthyam
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
Questpond
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
Krishnaov
 
Java mcq
Java mcqJava mcq
Java mcq
avinash9821
 
Object-oriented programming 3.pptx
Object-oriented programming 3.pptxObject-oriented programming 3.pptx
Object-oriented programming 3.pptx
Adikhan27
 
C# interview
C# interviewC# interview
C# interview
Thomson Reuters
 
How to ace your .NET technical interview :: .Net Technical Check Tuneup
How to ace your .NET technical interview :: .Net Technical Check TuneupHow to ace your .NET technical interview :: .Net Technical Check Tuneup
How to ace your .NET technical interview :: .Net Technical Check Tuneup
Bala Subra
 
VB.net
VB.netVB.net
VB.net
PallaviKadam
 

Similar to C# interview-questions (20)

C# interview
C# interviewC# interview
C# interview
 
C#
C#C#
C#
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Core java questions
Core java questionsCore java questions
Core java questions
 
Java scjp-part1
Java scjp-part1Java scjp-part1
Java scjp-part1
 
Viva file
Viva fileViva file
Viva file
 
Csci360 20
Csci360 20Csci360 20
Csci360 20
 
Csci360 20 (1)
Csci360 20 (1)Csci360 20 (1)
Csci360 20 (1)
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
 
Code Metrics
Code MetricsCode Metrics
Code Metrics
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 
Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Java mcq
Java mcqJava mcq
Java mcq
 
Object-oriented programming 3.pptx
Object-oriented programming 3.pptxObject-oriented programming 3.pptx
Object-oriented programming 3.pptx
 
C# interview
C# interviewC# interview
C# interview
 
How to ace your .NET technical interview :: .Net Technical Check Tuneup
How to ace your .NET technical interview :: .Net Technical Check TuneupHow to ace your .NET technical interview :: .Net Technical Check Tuneup
How to ace your .NET technical interview :: .Net Technical Check Tuneup
 
VB.net
VB.netVB.net
VB.net
 

Recently uploaded

Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
Celine George
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
Payaamvohra1
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
Celine George
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
David Douglas School District
 

Recently uploaded (20)

Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
 

C# interview-questions

  • 1. Net-informations.com .Net (C#/Vb.net/Asp.Net) Interview Questions and Answers The practical guide to the .Net interview process http://net-informations.com/faq/default.htm
  • 2. Which class is super class of all classes in .NET Classes? Object Class (System.Object) is the base class of .NET Classes What is the execution entry point for a C# console application? The Main method is the execution entry point of C# console application. static void main(string args[]) { } Why Main() method is static? You need an entry point into your program. A static method can be called without instantiating an object. Therefore main() needs to be static in order to allow it to be the entry to your program. What is string[] args in Main method? What is there use? The parameter of the Main method is a String array that represents the command-line arguments. The string[] args may contain any number of Command line arguments which we want to pass to Main() method. More Questions and Answers: http://net-informations.com/faq/default.htm
  • 3. .Net is Pass by Value or Pass by Reference? By default in .Net, you don't pass objects by reference. You pass references to objects by value. However, you get the illusion it's pass by reference, because when you pass a reference type you get a copy of the reference (the reference was passed by value). What is nullable type in c#? Nullable type is new concept introduced in C#2.0 which allow user to assingn null value to primitive data types of C# language. It is important to not taht Nullable type is Structure type. What is Upcasting ? Upcasting is an operation that creates a base class reference from a subclass reference. (subclass -> superclass) (i.e. Manager -> Employee) What is Downcasting? Downcasting is an operation that creates a subclass reference from a base class reference. (superclass -> subclass) (i.e. Employee -> Manager) More Questions and Answers: http://net-informations.com/faq/default.htm
  • 4. What is managed/unmanaged code? Managed code is not directly compiled to machine code but to an intermediate language which is interpreted and executed by some service on a machine and is therefore operating within a secure framework which handles things like memory and threads for you. Unmanaged code is compiled diredtly to machine code and therefore executed by the OS directly. So, it has the ability to do damaging/powerful things Managed code does not. C# is managed code because Common language runtime can compile C# code to Intermediate language. Can I override a static methods in C#? No. You can't override a static method. A static method can't be virtual, since it's not related to an instance of the class. Can we call a non-static method from inside a static method? Yes. You have to create an instance of that class within the static method and then call it, but you ensure there is only one instance. More Questions and Answers: http://net-informations.com/faq/default.htm
  • 5. Explain namespaces in C#? Namespaces are containers for the classes. Namespaces are using for grouping the related classes in C#. "Using" keyword can be used for using the namespace in other namespace. What is the % operator? It is the modulo (or modulus) operator. The modulus operator (%) computes the remainder after dividing its first operand by its second. 3 % 2 == 1 What is Jagged Arrays? The array which has elements of type array is called jagged array. The elements can be of different dimensions and sizes. We can also call jagged array as Array of arrays. More Questions and Answers: http://net-informations.com/faq/default.htm
  • 6. Difference between a break statement and a continue statement? Break statement: If a particular condition is satisfied then break statement exits you out from a particular loop or switch case etc. Continue statement: When the continue statement is encountered in a code, all the actions up till this statement are executed again without execution of any statement after the continue statement. Difference between an if statement and a switch statement? The if statement is used to select among two alternatives only. It uses a boolean expression to decide which alternative should be executed. While the switch statement is used to select among multiple alternatives. It uses an int expression to determine which alternative should be executed. Difference between the prefix and postfix forms of the ++ operator? Prefix: increments the current value and then passes it to the function. i = 10; Console.WriteLine(++i); Above code return 11 because the value of i is incremented, and the value of the expression is the new value of i. More Questions and Answers: http://net-informations.com/faq/default.htm
  • 7. Postfix: passes the current value of i to the function and then increments it. i = 20; Console.WriteLine(i++); Above code return 20 because the value of i is incremented, but the value of the expression is the original value of i Can a private virtual method be overridden? No, because they are not accessible outside the class. Can you store multiple data types in System.Array? No , because Array is type safe. If you want to store different types, use System.Collections.ArrayList or object[] What’s a multicast delegate in C#? Multicast delegate is an extension of normal delegate. It helps you to point more than one method at a single moment of time More Questions and Answers: http://net-informations.com/faq/default.htm
  • 8. Can a Class extend more than one Class? It is not possible in C#, use interfaces instead. Can we define private and protected modifiers for variables in interfaces? Interface is like a blueprint of any class, where you declare your members. Any class that implement that interface is responsible for its definition. Having private or protected members in an interface doesn't make sense conceptually. Only public members matter to the code consuming the interface. The public access specifier indicates that the interface can be used by any class in any package. When does the compiler supply a default constructor for a class? In the CLI specification, a constructor is mandatory for non-static classes, so at least a default constructor will be generated by the compiler if you don't specify another constructor. So the default constructor will be supplied by the C# Compiler for you. How destructors are defined in C#? C# destructors are special methods that contains clean up code for the object. You can not call them explicitly in your code as they are called implicitly by GC. In C# they have same name as the class name preceded by the ~ sign. More Questions and Answers: http://net-informations.com/faq/default.htm
  • 9. What is a structure in C#? In C#, a structure is a value type data type. It helps you to make a single variable hold related data of various data types. The struct keyword is used for creating a structure.' What's the difference between the Debug class and Trace class? The Debug and Trace classes have very similar methods. The primary difference is that calls to the Debug class are typically only included in Debug build and Trace are included in all builds (Debug and Release). What is the difference between == and quals() in C#? The "==" compares object references and .Equals method compares object content Can we create abstract classes without any abstract methods? Yes, you can. There is no requirement that abstract classes must have abstract methods. An Abstract class means the definition of the class is not complete and hence cannot be instantiated. More Questions and Answers: http://net-informations.com/faq/default.htm
  • 10. Can we have static methods in interface? You can't define static members on an interface in C#. An interface is a contract, not an implementation. Can we use "this" inside a static method in C#? No. Because this points to an instance of the class, in the static method you don't have an instance. Can you inherit multiple interfaces? Yes..you can Explain object pool in C#? Object pool is used to track the objects which are being used in the code. So object pool reduces the object creation overhead. What is static constructor? Static constructor is used to initialize static data members as soon as the class is referenced first time. More Questions and Answers: http://net-informations.com/faq/default.htm
  • 11. Difference between this and base ? this represents the current class instance while base the parent. What's the base class of all exception classes? System.Exception class is the base class for all exceptions. How the exception handling is done in C#? In C# there is a "try… catch" block to handle the exceptions. Why to use "using" in C#? The reason for the "using" statement is to ensure that the object is disposed as soon as it goes out of scope, and it doesn't require explicit code to ensure that this happens. Using calls Dispose() after the using- block is left, even if the code throws an exception. What is a collection? A collection works as a container for instances of other classes. All classes implement ICollection interface. More Questions and Answers: http://net-informations.com/faq/default.htm
  • 12. Can finally block be used without catch? Yes, it is possible to have try block without catch block by using finally block. The "using" statement is equivalent try-finally. How do you initiate a string without escaping each backslash? You put an @ sign in front of the double-quoted string. String ex = @"without escaping each backslashrn" Can we execute multiple catch blocks in C#? No. Once any exception is occurred it executes specific exception catch block and the control comes out. What does the term immutable mean? The data value may not be changed. What is Reflection? Reflection allows us to get metadata and assemblies of an object at runtime. More Questions and Answers: http://net-informations.com/faq/default.htm