0% found this document useful (0 votes)
4 views12 pages

C#_.NET Interview Cheat sheet

The document is a C#/.NET interview cheat sheet created by Ashraf Rahman, summarizing common interview questions and concepts related to Object-Oriented Programming (OOP) and the SOLID principles. It covers key topics such as inheritance, encapsulation, abstraction, polymorphism, and various .NET and C# knowledge questions. The cheat sheet aims to help developers prepare for interviews by providing concise explanations and examples of important concepts.

Uploaded by

mokarram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

C#_.NET Interview Cheat sheet

The document is a C#/.NET interview cheat sheet created by Ashraf Rahman, summarizing common interview questions and concepts related to Object-Oriented Programming (OOP) and the SOLID principles. It covers key topics such as inheritance, encapsulation, abstraction, polymorphism, and various .NET and C# knowledge questions. The cheat sheet aims to help developers prepare for interviews by providing concise explanations and examples of important concepts.

Uploaded by

mokarram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

2/24/25, 2:00 PM C#/.NET Interview Cheat sheet.

I have been a software developer for 3… | by Ashraf Rahman | Medium

Open in app

Search Write

Get unlimited access to the best of Medium for less than $1/week. Become a member

C#/.NET Interview Cheat sheet


Ashraf Rahman · Follow
5 min read · Jul 1, 2020

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 1/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

I have been a software developer for 3 years since graduating, during which
I’ve applied to over 1000+ job applications around my field and noticed
specific questions being asked frequently.

I’ve complied as much questions and answers I can identify to help


Developers/Engineers achieve there dream job.

Disclaimer: I have made the answers short and simple as I find this works best
during interviews, please feel free to research in-depth about a topic you are
unfamiliar with.

We’ll start with explaining the four pillars of OOP (Object orientated
programming):

OOP — Object orientated programming (What is [blank] and


give me an example)
Inheritance:

Inheritance is when a derived class inherits the attributes and functions of


the base class. An example would be if class “Yatch” or “Row Boat” inherits
from the class “Boat” to utilise attributes that is common between them
where we can hold values such as: Passenger limit, size, weight etc.

Encapsulation:

Encapsulation provides security to your data by hiding it from irrelevant


classes or functions. It does this by using Access modifiers such as:

Public: Can be used to accessed anywhere in the assembly

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 2/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

Private: Can be used to accessed within the class only

Internal: Can be used to access members from the same assembly but
not a different assembly

Protected: Can be used to access members of the same class or derived


class

Abstraction:

A process of hiding implementation, not to be confused with encapsulation


(hiding information). For example, the process of creating coffee is to grind
the beans, boil water, mix the coffee in a pot and serve. When creating a
“Coffee” class the user does not need to know the entire process of making
the beverage.

Polymorphism:

Polymorphisim is when a object or function can take on multiple forms.


Most commonly found in inheritance/abstraction: where the derived class
uses the function of the base class and provides its own implementation of
it.

Secondly (…and my favourite) Overriding and Overloading is another


example where polymorphisim is used:

Overloading: writing two or more methods in the same class by using the
same method name, but the passing parameters are different.

Overriding: we use the method names in the different classes, that


means parent class method is used in the child class.

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 3/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

Understanding and explaining the SOLID principles is paramount to landing


the interview:

SOLID principles:
Question: What is SOLID?

Answer: It is five design principles intended to make software designs more


understandable, flexible and maintainable.

Single Responsibility Principle (SRP):

A class should take care of a Single Responsibility. For example, In an


automated email program, sending email and validating email should be in
different functions as their roles are different.

Open closed Principle (OSP):

A class is open for extension and closed for modification. For example,
utilising an inheritance, so it is open for extension but closed for
modification.

Liskov substitution Principle (LSP):

You should be able to use any derived class instead of a parent class and have
it behaved in the same manner without modification. The parent class
should be able to refer to child objects seamlessly during runtime
polymorphism.

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 4/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

It ensures that a derived class does not affect the behaviour of the parent
class.

Interface Segregation Principle (ISP)

You should not be forced to implement interfaces you do not use. Instead of
one big interface, many small interfaces are preferred based on groups of
methods, each one serving one sub-module.

Dependency Inversion Principle (DIP):

High-level modules/classes should not depend on low-level modules/classes.


Both should depend upon abstractions. Secondly, abstractions should not
depend upon details. Details should depend upon abstractions.

.Net knowledge Questions:


What is LINQ?

LINQ is known as Language Integrated Query, it provides the ability for


.NET languages (like C#, VB.NET, etc.) to generate queries to retrieve data
from the data source.

CLR (Common language runtime):

The CLR is essentially the heart of the .net framework, it helps the
development process by offering services such as: memory management,
debugging and security (to name a few), code which runs on the CLR is
known as managed code.

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 5/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

Garbage Collection:

The garbage collector manages the allocation and release of memory for an
application.

Generics:

Provides type safety by allowing you to tailor classes and functions to precis
data types. For example, Lists and arrays where it is required to specify the
data type to prevent irrelevant values from being placed inside.

Managed vs Un-managed code:

Managed code runs on the CLR and provides services such as: Garbage
collection and reference checking among other things. so essentially it is
code that is managed by the CLR.

Un-managed code compiles straight to machine code and is not managed by


the CLR.

Boxing vs Un-Boxing:

Boxing means to wrap a value type in an object type. In general, boxed


values uses more memory and takes a minimum of two memory look ups to
access. That’s why it’s really not a good practice.

Unboxing is the opposite of boxing.

C# Knowledge Questions:

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 6/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

What is [Blank]?

Object:

An object is an instance of a class

Class:

A class is a blueprint of an object, it contains instructions (known as


functions) and attributes to define what the object is and does.

Constructor:

A constructor is what is called first when instantiating an object. It allows


values to be initialised when the object is called.

Jagged Array:

Jagged arrays are arrays of arrays. Containing elements of different


dimensions and sizes

Ref & Out parameters:

An argument passed as Ref must be initialised before passing to the method


whereas the out parameter does not to be initialised before passing to a
method.

Of course there are hundreds of questions that can be asked but these are my
select few that I have come across the most frequent. It is also advised to

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 7/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

prepare for questions outside of the list above to solidify your understanding
of the language/framework.

Let me know if I have missed any questions or if you think you have a better
explanation.

I will be releasing more cheat sheets covering: JavaScript, REST API, JSON,
SQL and also Python and Machine Learning. Thank you for reading.

C Sharp Programming Dotnet Interview Preparation Interview Cheatsheet

Written by Ashraf Rahman Follow


6 Followers · 3 Following

Software Developer and Machine Learning Enthusiast

No responses yet

What are your thoughts?

Respond

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 8/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

More from Ashraf Rahman

Ashraf Rahman Ashraf Rahman

Harnessing Large Language NLP: Text Summarisation in 5 Easy


Models: Extracting Names from… Steps!
In today’s digital age, the ability to extract The topic of Natural language Processing can
specific information, such as names, from… be daunting and sometimes a little difficult t…

Sep 3, 2023 2 Sep 1, 2020 2

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 9/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

Ashraf Rahman

Image classification explained


using CNN (Convolutional Neural…
Neural networks is an algorithm used to
closely mimic the behaviours of the human…

Jun 18, 2020

See all from Ashraf Rahman

Recommended from Medium

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 10/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

Vinod Pal Kamlesh Singh

How I Review Code As a Senior Top Most Important ASP.NET Core


Developer For Better Results Interview Questions & Answers
I have been doing code reviews for quite What is .NET Core: —
some time and have become better at it. Fro…

Jan 25 699 21 Oct 25, 2024 71

Lists

The New Chatbots: ChatGPT, Stories to Help You Grow as a


Bard, and Beyond Software Developer
12 stories · 555 saves 19 stories · 1607 saves

Icon Design data science and AI


39 stories · 497 saves 40 stories · 334 saves

Mayur Shinde In Dev Genius by Piyush Doorwar 💻

Mastering API Design Patterns: Understanding DI Lifetimes:


Best Practices for Building Robus… Singleton, Scoped, and Transient
In the ever-evolving world of software Singleton, Scoped, and Transient may seem
development, APIs (Application… straightforward, but understanding when to…

Aug 29, 2024 3 3 Oct 31, 2024 2

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 11/12
2/24/25, 2:00 PM C#/.NET Interview Cheat sheet. I have been a software developer for 3… | by Ashraf Rahman | Medium

Vitaliy Korzhenko In CodeX by Apoorva

Understanding this in JavaScript Cracking DSA Problems with


What is this? Sliding Window: A Minimalist’s…
Solving in Python

Sep 25, 2024 85 Nov 25, 2024 2

See more recommendations

https://medium.com/@96ashraf96/c-net-interview-cheat-sheet-3eea66aab805 12/12

You might also like