Software Engineer Intern - Technical Interview Questions
What is an object in C#?
A block of memory that has been allocated and configured according to the blueprint.
What is a blueprint in C#?
A class is a blueprint or a template definition from which the objects are created.
What is a partial class?
A feature in C# that allows you to split the functionality of a class into multiple files. When the application is compiled, the compiler combines the files into a single class file. The partial keyword is used to create a partial class.
What is dependency injection?
A software design pattern that allows us to develop loosely coupled code. a great way to reduce tight coupling between software components. DI also enables us to better manage future changes and other complexity in our software. The purpose of DI is to make code maintainable.
Which constructor is called first in C#?
Base Constructor is always called first in C#, followed by Derived class constructor.
What languages fall under .NET?
C#/F#/VB
What is Abstraction? Give an example.
Hides implementation details and displays only essential features of an object. In C#, abstraction is used to simplify designs and make them easier to understand and maintain.
Why are strings in c# immutable?
In C# Arrays have a fixed size, which means that once an array is created of some size, it cannot be dynamically increased or decreased in size.
Can you override a constructor?
No, in C#, it is necessary to define properly which constructor you are trying to call to instantiate a class and what arguments are being passed. So you cannot override a constructor in C#.
What is the difference between software engineers and software developers?
Software developers and software engineers are both involved in the design, development, and testing of software. However, software developers work on a smaller scale, while software engineers work on a larger scale. Software developers design specific computer systems and application software, while software engineers design, develop, and test entire computer systems and application software for a company or organization
What is the difference between OOP and Functional Programming?
The main difference between the two is that OOP uses objects and methods as the key coding elements, while FP emphasizes functional factors such as variables and functions.
What makes an Object-Oriented Programming Language?
The use of objects that contain both data and code. The principles of OOP are Abstraction, Polymorphism, Inheritance, and Encapsulation.
How are Constructors used?
Whenever an instance of a class or a struct is created, its constructor is called. A class or struct may have multiple constructors that take different arguments. Constructors enable the programmer to set default values, limit instantiation, and write code that is flexible and easy to read.
What is an object pool?
a container built to keep the most used objects for faster access and use.
What is Encapsulation? Give an example.
a key feature of object-oriented programming languages like C#. It's the process of grouping data and functions into a single unit. The unit can be a class, record, or struct. Encapsulation allows an object to hide data and behavior that aren't necessary for the user. It also prevents outside alteration of data.
What is a delegate?
a reference type entity that is used to store the reference of a method. So whenever you need to call a method, you can easily use the delegate by initializing a pointer to that method, thereby helping to implement Encapsulation.
What is loosely-coupled code? Why is it important?
a software development practice that involves writing code in isolated components with a clearly described interface. The goal of loose coupling is to reduce the inter-dependencies between components of a system. This reduces the risk that changes in one component will require changes in any other component. In a loosely coupled system, each component has little or no knowledge of the definitions of other separate components. Communication is done through interfaces.
What is Inheritance? Give an example.
allows developers to create a new class or a "child class" from an existing class also known as the "base class" or "parent class". An example of this would be having a parent class of "Vehicle" that has a method for honking a horn, since all vehicles should have a horn. Then from that parent class we create a child class called "Car" a type of Vehicle.
Describe the "Public" access modifier.
an access modifier that allows the member to be accessed by other classes.
What is .NET?
an open-source platform for building desktop, web, and mobile applications that can run natively on any operating system. The . NET system includes tools, libraries, and languages that support modern, scalable, and high-performance software development.
What is Unit-Testing and why is it important? Give an example.
breaks the program down into the smallest bit of code, usually function-level, and ensures that the function returns the value one expects. It is important because it saves time and limits the numbers of bugs that go into production. So forth saving money.
What is the need for Encapsulation?
has some hidden advantages as well which make it the need of the hour for every software developer such as preventing accidental corruption, unauthorized access to entities, etc.
What is a constructor?
in C# is a special method that is automatically called when an object of a class is created. Constructors are used to initialize objects and set initial values for fields.
What is an Interface in C#?
in C# is a type definition that looks like a class but has no implementation. It's a collection of method and property declarations that represent a contract between an object and its user. An interface can only define abstract methods, which are methods without a body or implementation.
What is Framework targeting in C# and what is the use of it?
in C# is used to mention the version of the .NET framework that the project is intended to run upon.
What is Polymorphism? Give an example.
means "many forms", and it occurs when we have many classes that are related to each other by inheritance. An example of this would be having a parent class of "Animal" that has a method for Animal Sounds, and then having child classes for a "Pig" and a "Dog" that all Inherit the Animal base class and use the Animal Sound method.
What is C#?
object-oriented programming language developed by Microsoft. It is type-safe and managed language that is compiled by the Roslyn .NET compiler to generate Microsoft intermediate language (machine code).
Describe Static.
something which cannot be instantiated. You cannot create an object of a static class and cannot access static members using an object.
What is serialization? Give an example
the conversion of any object into a stream of bytes. This is done to transmit the object to the memory, file or database. The reverse of this process is known as deserialization as it involves reading the object from the stream of bytes.
State the uses of Reflection in C#
the process of describing the metadata of types, methods, and fields in a code.
Describe what "Void" means and does.
used to indicate that a method does not return a value. When a method is declared as such, it means that the method does not return anything, and the method call is used for its side effects. A method declared with the void return type cannot provide any arguments to any return statements they contain.