Blog for Junior Developers C#/.NET

Wednesday, June 26, 2024

Today is the last article in our series in which I present to you the 100 most frequently asked questions that you may have during a job interview for a junior .NET developer position. So I hope that after this entry you will be 100% prepared for such an interview and you can send your CV with confidence.

100-interview-questions-and-answers-for-junior-developers-csharp-dotnet-part-10-10.jpg

91) What is Scrum?


Scrum is an agile approach to software development. I mean, it doesn't have to be just software, it can be any thing, any product. In scrum, we work incrementally, in short iterations, and at any time we have a working version of our software. We try to add new functionalities iteratively. Such one iteration is called sprint. It should last a maximum of a month, most often such a sprint lasts 2 weeks.

Part of the sprint includes, among others, sprint planning (planning work for the next sprint), daily scrum (daily meetings during which we discuss in the team what has already been done, what problems we have and what we will deal with next), sprint review (review of what has been done works) and a retrospective sprint.

We have several roles in scrum. These include Developers (programmers), Product Owner (product owner) and Scrum Master (the person who supervises how we operate).


92) What is SOLID?


SOLID is five rules for object-oriented programming. They were proposed by American programmer Robert C. Martin (Uncle Bob) - considered by many as an authority in the world of programming.

The word SOLID itself means something solid, constructive, or specific, but that's not where the name comes from. They consist of principles that come from each letter in the word SOLID.

S is for Single Responsibility Principle (SRP)
Principle of Single Responsibility - Each class should have only one responsibility. There should never be more than one reason to change it in the future.

O is for Open-Closed Principle (OCP)
Open-Closed Principle - A software item should be open to extension but closed to modification. If we have a method that is used in other parts of the system, it should no longer be modified.

L is for Liskov Substitution Principle (LSP)
Liskov Substitution Principle - Functions that use pointers or references to base classes must also be able to use objects of classes that inherit from base classes, without knowing these objects precisely. You can substitute any type of a derived class in place of the base type and it should not lose proper operation.

I like Interface Segregation Principle (ISP)
Principle of Interface Segregation - No client should be forced to rely on methods it does not use. Several dedicated interfaces are better than one that is too general.

D is for Dependency Inversion Principle (DIP)
Dependency Inversion Principle - High-level modules should not depend on low-level modules. Both the first and the second should depend on abstractions (interfaces or abstract classes). Abstractions should not depend on details. It is the details that should depend on the abstraction.

I develop each topic in more detail on my blog, so if you are interested in the details, be sure to take a look.


93) What is managed and unmanaged code?


Managed code is written in a high-level language such as C# and allows the code to run in a managed CLR runtime in .NET. The CLR is responsible for this code, compiles it into machine code and then executes it. The runtime provides various services such as memory management, security, exception handling, etc.

Unmanaged code occurs when code does not run in the CLR. This is code that runs outside of the .NET platform. They do not provide high-level language services and operate without them.


94) What is reflection in C#?


Thanks to reflection, we can retrieve metadata about classes and change their definition during program execution. Thanks to it, we can also call methods dynamically. Reflection methods in C# are available in the System.Reflection namespace.


95) What is a deadlock?


Deadlock is a situation in which a process is unable to complete its task because two or more processes are waiting for each other.


96) What is serialization and deserialization?


Serialization is a process that transforms an object into, for example, a stream of bytes. Thanks to this, the serialized object can be, for example, saved on disk or sent to another process over the network.

In turn, deserialization is the opposite process to serialization. Thanks to it, you can restore an object that was previously a stream of bytes.


97) What is a destructor in C#?


The destructor is used to clear memory and free resources. We can also create such a destructor ourselves. To do this, simply create a method with the same name as the class name, without the access modifier and return type, preceded by the ~ character.

Fortunately, in C# we have Garbage Collector, which deals with releasing resources and clearing memory itself, so we do not need to create destructors.

public class Program
{
    ~Program()
    {

    }
}


98) What is Garbage Collector in C#?


You could say that Garbage Collector makes a programmer's life easier. It makes memory management easier, thanks to it we do not have to call destructors, as is the case in C++, for example.

Garbage Collector protects applications against memory overflows or leaks. It works automatically, more precisely it deals with heap management, i.e. it looks for references to objects. If no reference is assigned to an object, it is a sign to the Garbage Collector that the object can be deleted. Unfortunately, Garbage Collector only releases managed resources (i.e. regular classes), but does not release unmanaged resources such as open files, open connections to databases, or COM objects. In such cases, we must take care of releasing such resources ourselves.


99) What is routing?


Routing translates HTTP requests into controller actions. This means that it is responsible for ensuring that the appropriate URL performs the action assigned to it. We can define routing in an ASP.NET Core application in several ways.

app.UseEndpoints(endpoints =>
{
    endpoints.MapControllerRoute(
        name: "default",
        pattern: "{controller=Home}/{action=Index}/{id?}");
});
[Route("[controller]/[action]")]
public class TicketController : Controller { }

[Route("Home")]
public IActionResult Index() { return View(); }

[HttpGet("/tickets")]
public IActionResult Tickets() { // … }

[HttpPost("/tickets")]
public IActionResult CreateTicket() { // … }


100) What is the lock statement used for in C#?


Thanks to the lock instruction, we can safely execute code executed synchronously in a multi-threaded environment. Only one thread can access the code inside the lock statement at a time.

private readonly object lockObject = new object();

public void CriticalMethod()
{
    lock (lockObject)
    {

    }
}


TERMINATION


These were all the questions I prepared for you. I hope you liked these materials. We'll see you in a future article with a new topic. Let me know if such entries are valuable to you. If you like this material, be sure to join my community - free registration, where you will also have access to additional materials.

That's all for today, see you in the next article.

Author of the article:
Kazimierz Szpin

KAZIMIERZ SZPIN
Software Developer C#/.NET, Freelancer. Specializes in ASP.NET Core, ASP.NET MVC, ASP.NET Web API, Blazor, WPF and Windows Forms.
Author of the blog CodeWithKazik.com

Previous article - 100 Interview Questions (and Answers!) for Junior Developers C#/.NET (Part 9/10)
Next article - 40 Visual Studio Keyboard Shortcuts Every Programmer Should Know
Comments (2)
Kebin
KEBIN, środa, 31 lipca 2024 06:40
I would like lear more about .net, c shar
Kazimierz Szpin
KAZIMIERZ SZPIN, środa, 31 lipca 2024 07:02
Hi @Kebin. You will find many such articles on the blog. And there will be more new articles in the future, so you are in the right place :)
Dodaj komentarz

Search engine

© Copyright 2024 CodeWithKazik.com. All rights reserved. Privacy policy.
Design by Code With Kazik