{"id":2930,"date":"2023-12-20T12:12:26","date_gmt":"2023-12-20T12:12:26","guid":{"rendered":"https:\/\/www.kaashivinfotech.com\/blog\/?p=2930"},"modified":"2025-04-14T09:30:37","modified_gmt":"2025-04-14T09:30:37","slug":"intermediate-dotnet-interview-questions-and-answers","status":"publish","type":"post","link":"https:\/\/www.kaashivinfotech.com\/blog\/intermediate-dotnet-interview-questions-and-answers\/","title":{"rendered":"Intermediate Dotnet Interview Questions and Answers"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"2930\" class=\"elementor elementor-2930\">\n\t\t\t\t<div class=\"elementor-element elementor-element-8d04a4c e-flex e-con-boxed e-con e-parent\" data-id=\"8d04a4c\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-b9cc2ba elementor-widget elementor-widget-heading\" data-id=\"b9cc2ba\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Introduction<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-897d4d3 e-flex e-con-boxed e-con e-parent\" data-id=\"897d4d3\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ff967b9 elementor-widget elementor-widget-text-editor\" data-id=\"ff967b9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The\u00a0<strong>DOT NET<\/strong>\u00a0is a\u00a0software framework. It is developed by\u00a0Microsoft. It includes a large\u00a0library\u00a0and also provides\u00a0language inter-operability across some\u00a0programming languages. Language inter-operability refers the capability of two different languages to interact and operate on the same kind of data structures.<\/p><p>The programs written for\u00a0<a href=\"http:\/\/bigclasses.com\/dot-net-online-training.html\" target=\"_blank\" rel=\"noopener\"><strong>DOT NET<\/strong><\/a>\u00a0execute in a software environment. The name of the software environment is Common Language Runtime (CLR). It is the virtual machine component. The compiled code is converted into machine code at first. Then it is executed by computer\u2019s CPU. The CLR provides additional services like exception handling, memory management, type safety, garbage collection, thread management etc.<\/p><p>The DOT NET Framework\u2019s\u00a0Base Class Library\u00a0offers\u00a0user interface,\u00a0database connectivity,\u00a0data access, cryptography,\u00a0web application\u00a0development, numeric\u00a0algorithms, network communications etc. Programmers produce software by combining their own\u00a0source code\u00a0with the\u00a0 DOT NET Framework and other libraries. The DOT NET Framework is projected to be used by most new applications created for the Windows platform. Microsoft also produces an integrated\u00a0largely for DOT NET software called\u00a0Visual Studio.<\/p><p>Intermediate .NET Interview Questions designed to assess your knowledge and proficiency in the .NET framework. Dive into topics such as Common Language Runtime (CLR), value types, reference types, Global Assembly Cache (GAC), JIT compiler, boxing\/unboxing, &#8216;using&#8217; statement, abstract classes, interfaces, ASP.NET ViewState, and the ASP.NET Page Life Cycle.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-6c74b70 e-flex e-con-boxed e-con e-parent\" data-id=\"6c74b70\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-7b520ba elementor-widget elementor-widget-heading\" data-id=\"7b520ba\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Intermediate Dotnet Interview Questions<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9d32c3f elementor-widget elementor-widget-accordion\" data-id=\"9d32c3f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"accordion.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-accordion\">\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1641\" class=\"elementor-tab-title\" data-tab=\"1\" role=\"button\" aria-controls=\"elementor-tab-content-1641\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">1. What is Polymorphism, types and example ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1641\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"1\" role=\"region\" aria-labelledby=\"elementor-tab-title-1641\"><p>Polymorphism is a fundamental concept in object-oriented programming (OOP) that allows objects of different types to be treated as objects of a common type. It is used to implement the &#8220;one interface, multiple methods&#8221; principle, where a single method can be defined with multiple implementations.<\/p><p>There are two types of polymorphism in C#:<\/p><ol><li><strong> Compile-time polymorphism (or static polymorphism) :<\/strong><\/li><\/ol><ul><li>This type of polymorphism is achieved through method overloading, where multiple methods with the same name but different parameter lists are defined in the same class. The correct method is called at compile-time based on the number and type of arguments passed to the method.<\/li><\/ul><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class PolymorphismExample<br\/>{<br\/>    public void Display(int num)<br\/>    {<br\/>        Console.WriteLine(&quot;Integer value: {0}&quot;, num);<br\/>    }<br\/>    public void Display(float num)<br\/>    {<br\/>        Console.WriteLine(&quot;Float value: {0}&quot;, num);<br\/>    }<br\/>    public void Display(string str)<br\/>    {<br\/>        Console.WriteLine(&quot;String value: {0}&quot;, str);<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ol start=\"2\"><li><strong> Run-time polymorphism (or dynamic polymorphism) :<\/strong><\/li><\/ol><ul><li>This type of polymorphism is achieved through method overriding, where a derived class provides a new implementation for a method that is already defined in its base class. The correct method is called at run-time based on the actual type of the object at runtime.<\/li><\/ul><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class Shape<br\/>{<br\/>    public virtual void Draw()<br\/>    {<br\/>        Console.WriteLine(&quot;Drawing Shape&quot;);<br\/>    }<br\/>}<br\/>class Circle : Shape<br\/>{<br\/>    public override void Draw()<br\/>    {<br\/>        Console.WriteLine(&quot;Drawing Circle&quot;);<br\/>    }<br\/>}<br\/>class Square : Shape<br\/>{<br\/>    public override void Draw()<br\/>    {<br\/>        Console.WriteLine(&quot;Drawing Square&quot;);<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>In C# and other languages that support OOP, polymorphism is a powerful feature that allows developers to write more generic and flexible code. It allows objects of different types to be treated as objects of a common type, making it possible to write code that can handle objects of different types in a uniform way.<\/p><p>For example, in the above example, we can create an array of Shape and add objects of Circle and Square classes to it. We can call the Draw() method on each element of the array, and it will call the overridden method of the actual type of the object.<\/p><p>Polymorphism helps to make the code more maintainable and easy to understand, as it allows you to write code that works with multiple types of objects in a consistent way, without the need to write separate code for each type of object.<\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1642\" class=\"elementor-tab-title\" data-tab=\"2\" role=\"button\" aria-controls=\"elementor-tab-content-1642\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">2. Explain the Function ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1642\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"2\" role=\"region\" aria-labelledby=\"elementor-tab-title-1642\"><ul><li>A function in C# is a block of code that can be reused throughout a program. Functions are also known as methods in C#. A function can take zero or more parameters as input and can return a value or not.<\/li><\/ul><p>Here is an example of a function in C#:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class MyFunctions<br\/>{<br\/>    public int AddNumbers(int num1, int num2)<br\/>    {<br\/>        return num1 + num2;<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>This function is named\u00a0<strong>AddNumbers<\/strong>\u00a0and it takes two int parameters,\u00a0<strong>num1<\/strong>\u00a0and\u00a0<strong>num2.<\/strong>\u00a0The function uses the\u00a0<strong>return<\/strong>\u00a0statement to return the sum of\u00a0<strong>num1<\/strong>\u00a0and\u00a0<strong>num2.<\/strong><\/li><\/ul><p>You can call this function by creating an instance of the class and call the method.<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">MyFunctions mf = new MyFunctions();<br\/>int result = mf.AddNumbers(5, 7);<br\/>Console.WriteLine(result);<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>This will output\u00a0<strong>12<\/strong><\/li><\/ul><p>You can also declare a function without a return type, like this:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class MyFunctions<br\/>{<br\/>    public void PrintHello()<br\/>    {<br\/>        Console.WriteLine(&quot;Hello, World!&quot;);<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>This function is named\u00a0<strong>PrintHello<\/strong>\u00a0and it takes no parameters. It uses the\u00a0<strong>Console.WriteLine()<\/strong>\u00a0method to print the string &#8220;<strong>Hello, World!<\/strong>&#8221; when the function is called. You can call this function in the same way as before.<\/li><\/ul><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">MyFunctions mf = new MyFunctions();<br\/>mf.PrintHello();<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>This will output &#8220;<strong>Hello, World!<\/strong>&#8220;<\/li><li>C# also supports the use of optional parameters, default parameter values and parameter arrays. You can also declare a function as a static function which can be called without creating an instance of the class.<\/li><\/ul><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class MyFunctions<br\/>{<br\/>    public static int AddNumbers(int num1, int num2)<br\/>    {<br\/>        return num1 + num2;<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>This function can be called using the class name instead of an instance.<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">int result = MyFunctions.AddNumbers(5, 7);<br\/>Console.WriteLine(result);<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>Functions in C# are a powerful tool for organizing and reusing code, and are an essential part of the C# programming language.<\/li><\/ul><p><br \/><br \/><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1643\" class=\"elementor-tab-title\" data-tab=\"3\" role=\"button\" aria-controls=\"elementor-tab-content-1643\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">3. Explain the Object ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1643\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"3\" role=\"region\" aria-labelledby=\"elementor-tab-title-1643\"><ul><li>An object in C# is an instance of a class. A class is a blueprint or template that defines the properties, methods, and events of an object. Objects are created from classes, and each object has its own unique set of property values and can perform the methods and events defined in the class.<\/li><\/ul><p>Here is an example of a simple class named &#8220;<strong>Car<\/strong>&#8221; in C#:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class Car<br\/>{<br\/>    public string Make { get; set; }<br\/>    public string Model { get; set; }<br\/>    public int Year { get; set; }<br\/>    public void StartEngine()<br\/>    {<br\/>        Console.WriteLine(&quot;Vroom!&quot;);<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>This class defines three properties:\u00a0<strong>Make, Model,<\/strong>\u00a0and\u00a0<strong>Year<\/strong>, and a method\u00a0<strong>StartEngine.<\/strong>\u00a0Each property has a get and set accessor which allows you to access the value of the property and change the value of the property.<\/li><\/ul><p>To create an object from this class, you would use the\u00a0<strong>new<\/strong>\u00a0keyword, like this:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">Car myCar = new Car();<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>This creates a new object of the class &#8220;<strong>Car<\/strong>&#8221; and assigns it to the variable\u00a0<strong>myCar.<\/strong><\/li><\/ul><p>You can then use the dot notation to access the properties and methods of the object, like this:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">myCar.Make = &quot;Toyota&quot;;<br\/>myCar.Model = &quot;Camry&quot;;<br\/>myCar.Year = 2020;<br\/>Console.WriteLine(myCar.Make + &quot; &quot; + myCar.Model + &quot; &quot; + myCar.Year);<br\/>myCar.StartEngine();<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>This will output:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">Toyota Camry 2020<br\/>Vroom!<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>You can also create an object and initialize the properties at the same time using object initializer syntax<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">Car myCar = new Car() { Make = &quot;Toyota&quot;, Model = &quot;Camry&quot;, Year = 2020 };<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>In C#, objects are used to model real-world entities and their behaviors and properties, and they are a fundamental part of object-oriented programming (OOP). C# provides many features to work with objects, including inheritance, polymorphism, and encapsulation, which help to create robust and maintainable code.<\/li><\/ul><p><br \/><br \/><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1644\" class=\"elementor-tab-title\" data-tab=\"4\" role=\"button\" aria-controls=\"elementor-tab-content-1644\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">4. What is main method explain ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1644\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"4\" role=\"region\" aria-labelledby=\"elementor-tab-title-1644\"><ul><li>The\u00a0<strong>main<\/strong>\u00a0method in C# is the entry point of a console application. It is the method that is executed when the program starts. The\u00a0<strong>main<\/strong>\u00a0method must be defined as a\u00a0<strong>static<\/strong>\u00a0method and must have a specific signature, as follows:<\/li><\/ul><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">static void Main(String[] args)<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>Or<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">static int Main(String[] args)<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>The\u00a0<strong>static<\/strong>\u00a0keyword means that the method can be called without creating an instance of the class in which the method is defined. The\u00a0<strong>void<\/strong>\u00a0or\u00a0<strong>int<\/strong>\u00a0keyword<\/li><li>specifies the return type of the method. The\u00a0<strong>Main<\/strong>\u00a0method is defined as\u00a0<strong>void<\/strong>\u00a0if it does not return any value, and\u00a0<strong>int<\/strong>\u00a0if it returns a value.<\/li><li>The\u00a0<strong>string[] args<\/strong>\u00a0parameter is an array of strings that can be passed to the program when it is run from the command line. These arguments can be accessed within the\u00a0<strong>Main<\/strong>\u00a0method using the\u00a0<strong>args<\/strong>\u00a0parameter.<\/li><\/ul><p>Here is an example of a simple\u00a0<strong>Main<\/strong>\u00a0method in C#:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class Program<br\/>{<br\/>    static void Main(string[] args)<br\/>    {<br\/>        Console.WriteLine(&quot;Hello, World!&quot;);<br\/>        Console.ReadKey();<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>This program writes the string &#8220;<strong>Hello, World!<\/strong>&#8221; to the console and waits for the user to press a key before ending.<\/li><li>In C#, the\u00a0<strong>Main<\/strong>\u00a0method is the starting point of the program and it serves as a container for the program&#8217;s logic and instructions. Once the\u00a0<strong>Main<\/strong>\u00a0method completes, the program exits.<\/li><li>It&#8217;s worth noting that if you are creating a Windows Forms application or WPF application, the entry point of the program will be different, in this case, the Main method is not required and the entry point is the\u00a0<strong>Application.Run(new Form())<\/strong>\u00a0method where Form is the class that inherits from the Form class.<\/li><\/ul><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1645\" class=\"elementor-tab-title\" data-tab=\"5\" role=\"button\" aria-controls=\"elementor-tab-content-1645\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">5. Types Inheritance Syntax tell in orally ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1645\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"5\" role=\"region\" aria-labelledby=\"elementor-tab-title-1645\"><ul><li>In C#, Inheritance is a mechanism that allows one class to inherit the properties and methods of another class, known as the base class or parent class. This allows for code reusability and helps to organize related classes in a logical and hierarchical manner.<\/li><\/ul><p>The syntax for creating a class that inherits from another class in C# is as follows:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class ChildClass : BaseClass<br\/>{<br\/>    \/\/ Child class members<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>Here, &#8220;<strong>ChildClass<\/strong>&#8221; is the class that inherits from the &#8220;<strong>BaseClass<\/strong>&#8220;. The colon &#8220;<strong>:<\/strong>&#8221; symbol is used to indicate that the ChildClass is inheriting from the BaseClass.<\/li><li>It&#8217;s important to note that the child class can access all the public and protected members of the base class and can also override the methods of the base class if necessary.<\/li><\/ul><p>There are three types of inheritance in C#:<\/p><ol><li><strong> Single Inheritance :<\/strong><\/li><\/ol><ul><li>A class inherits from only one class.<\/li><\/ul><ol start=\"2\"><li><strong> Multi-level Inheritance :<\/strong><\/li><\/ol><ul><li>A class inherits from a class which further inherits from another class.<\/li><\/ul><ol start=\"3\"><li><strong> Multiple Inheritance :<\/strong><\/li><\/ol><ul><li>A class inherits from more than one class.<\/li><\/ul><p>C# does not support Multiple Inheritance directly, but it can be achieved using Interface.<\/p><p><br \/><br \/><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1646\" class=\"elementor-tab-title\" data-tab=\"6\" role=\"button\" aria-controls=\"elementor-tab-content-1646\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">6. Write if else loop syntax ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1646\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"6\" role=\"region\" aria-labelledby=\"elementor-tab-title-1646\"><p>In C#, the syntax for an\u00a0<strong>if-else<\/strong>\u00a0loop is as follows:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">if (condition)<br\/>{<br\/>    \/\/ code to be executed if the condition is true<br\/>}<br\/>else<br\/>{<br\/>    \/\/ code to be executed if the condition is false<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>The\u00a0<strong>condition<\/strong>\u00a0is an expression that is evaluated to either\u00a0<strong>true<\/strong>\u00a0or\u00a0<strong>false.<\/strong>\u00a0If the condition is\u00a0<strong>true<\/strong>, the code inside the first set of curly braces (<strong>{ }<\/strong>) is executed. If the condition is\u00a0<strong>false<\/strong>, the code inside the second set of curly braces is executed.<\/li><\/ul><p>You can add multiple conditions by adding else if statement:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">if (condition1)<br\/>{<br\/>    \/\/ code to be executed if condition1 is true<br\/>}<br\/>else if (condition2)<br\/>{<br\/>    \/\/ code to be executed if condition1 is false and condition2 is true<br\/>}<br\/>else<br\/>{<br\/>    \/\/ code to be executed if both condition1 and condition2 are false<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>You can also use the ternary operator ? to write a shorthand version of an\u00a0<strong>if-else<\/strong>\u00a0statement:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">variable = condition ? value1 : value2;<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>It will assign\u00a0<strong>value1<\/strong>\u00a0to\u00a0<strong>variable<\/strong>\u00a0if the\u00a0<strong>condition<\/strong>\u00a0is true and assign\u00a0<strong>value2<\/strong>\u00a0to\u00a0<strong>variable<\/strong>\u00a0if the\u00a0<strong>condition<\/strong>\u00a0is false.<\/li><\/ul><p><br \/><br \/><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1647\" class=\"elementor-tab-title\" data-tab=\"7\" role=\"button\" aria-controls=\"elementor-tab-content-1647\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">7. Write For loop syntax ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1647\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"7\" role=\"region\" aria-labelledby=\"elementor-tab-title-1647\"><p>In C#, the syntax for a\u00a0<strong>for<\/strong>\u00a0loop is as follows:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">for (initializer; condition; iterator)<br\/>{<br\/>    \/\/ code to be executed while the condition is true<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>The\u00a0<strong>initializer<\/strong>\u00a0is the starting value of the loop counter,\u00a0<strong>condition<\/strong>\u00a0is an expression that is evaluated to either\u00a0<strong>true<\/strong>\u00a0or\u00a0<strong>false<\/strong>\u00a0and\u00a0<strong>iterator<\/strong>\u00a0is used to update the value of the loop counter after each iteration.<\/li><li>The loop starts with the initializer, then the condition is evaluated. If the condition is true, the code inside the curly braces is executed, then the iterator is executed. The process is repeated as long as the condition is true.<\/li><\/ul><p>For example, the following code will print the numbers from 1 to 10:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">for (int i = 1; i &lt;= 10; i++)<br\/>{<br\/>    Console.WriteLine(i);<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>You can also use the\u00a0<strong>foreach<\/strong>\u00a0loop to iterate over the elements of a collection, such as an array or a list:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">foreach (var item in collection)<br\/>{<br\/>    \/\/ code to be executed for each item in the collection<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>The\u00a0<strong>var<\/strong>\u00a0keyword is used to infer the type of the variable from the type of the collection.<\/li><\/ul><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1648\" class=\"elementor-tab-title\" data-tab=\"8\" role=\"button\" aria-controls=\"elementor-tab-content-1648\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\"> 8. What is While loop and While loop syntax ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1648\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"8\" role=\"region\" aria-labelledby=\"elementor-tab-title-1648\"><ul><li>In C#, the\u00a0<strong>while<\/strong>\u00a0loop is a control flow statement that repeatedly executes a block of code as long as a given condition is true.<\/li><\/ul><p>The syntax for a\u00a0<strong>while<\/strong>\u00a0loop is as follows:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">while (condition)<br\/>{<br\/>    \/\/ code to be executed while the condition is true<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>The\u00a0<strong>condition<\/strong>\u00a0is an expression that is evaluated to either\u00a0<strong>true<\/strong>\u00a0or\u00a0<strong>false.<\/strong>\u00a0As long as the condition is true, the code inside the curly braces is executed. Once the condition becomes false, the loop is terminated and the program continues with the next statement after the loop.<\/li><\/ul><p>For example, the following code will print the numbers from 1 to 10:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">int i = 1;<br\/>while (i &lt;= 10)<br\/>{<br\/>    Console.WriteLine(i);<br\/>    i++;<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>It&#8217;s important to note that, if the condition is always true, the loop will run indefinitely causing an infinite loop. It&#8217;s a good practice to include a way to terminate the loop inside the body of the loop.<\/li><\/ul><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1649\" class=\"elementor-tab-title\" data-tab=\"9\" role=\"button\" aria-controls=\"elementor-tab-content-1649\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">9. What is Do while loop and Do while loop syntax ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-1649\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"9\" role=\"region\" aria-labelledby=\"elementor-tab-title-1649\"><ul><li>In C#, the\u00a0<strong>do-while<\/strong>\u00a0loop is a control flow statement that repeatedly executes a block of code as long as a given condition is true.<\/li><\/ul><p>The syntax for a\u00a0<strong>do-while<\/strong>\u00a0loop is as follows:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">do<br\/>{<br\/>    \/\/ code to be executed<br\/>} while (condition);<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>The\u00a0<strong>condition<\/strong>\u00a0is an expression that is evaluated to either\u00a0<strong>true<\/strong>\u00a0or\u00a0<strong>false.<\/strong>\u00a0The code inside the curly braces is executed at least once, before the condition is evaluated. If the condition is true, the code inside the curly braces is executed again, and the process repeats as long as the condition is true. Once the condition becomes false, the loop is terminated and the program continues with the next statement after the loop.<\/li><\/ul><p>For example, the following code will print the numbers from 1 to 10:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">int i = 1;<br\/>do<br\/>{<br\/>    Console.WriteLine(i);<br\/>    i++;<br\/>} while (i &lt;= 10);<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>It&#8217;s important to note that, if the condition is always true, the loop will run indefinitely causing an infinite loop. It&#8217;s a good practice to include a way to terminate the loop inside the body of the loop.<\/li><li>It&#8217;s similar to While loop but the difference is that, in do-while loop, the loop body will execute at least once regardless of the condition. In While loop, if the condition is false, the loop body will not execute at all.<\/li><\/ul><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16410\" class=\"elementor-tab-title\" data-tab=\"10\" role=\"button\" aria-controls=\"elementor-tab-content-16410\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">10. What is Switch and Switch syntax ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16410\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"10\" role=\"region\" aria-labelledby=\"elementor-tab-title-16410\"><ul><li>In C#, the\u00a0<strong>switch<\/strong>\u00a0statement is a control flow statement that allows you to choose between multiple options based on the value of a single expression. The expression is evaluated, and the corresponding case statement is executed. If no case statement matches the expression value, the default case statement is executed, if present.<\/li><\/ul><p>The syntax for a\u00a0<strong>switch<\/strong>\u00a0statement is as follows:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">switch (expression)<br\/>{<br\/>    case value1:<br\/>        \/\/ code to be executed if expression == value1<br\/>        break;<br\/>    case value2:<br\/>        \/\/ code to be executed if expression == value2<br\/>        break;<br\/>    \/\/ ...<br\/>    default:<br\/>        \/\/ code to be executed if no case matches the expression value<br\/>        break;<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>For example, the following code will print the name of a color based on the value of the variable\u00a0<strong>color<\/strong>:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">string color = &quot;green&quot;;<br\/>switch (color)<br\/>{<br\/>    case &quot;red&quot;:<br\/>        Console.WriteLine(&quot;The color is red&quot;);<br\/>        break;<br\/>    case &quot;green&quot;:<br\/>        Console.WriteLine(&quot;The color is green&quot;);<br\/>        break;<br\/>    case &quot;blue&quot;:<br\/>        Console.WriteLine(&quot;The color is blue&quot;);<br\/>        break;<br\/>    default:<br\/>        Console.WriteLine(&quot;Invalid color&quot;);<br\/>        break;<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>It&#8217;s important to note that the\u00a0<strong>break<\/strong>\u00a0statement is used to exit a case statement and move to the next statement after the switch. If a\u00a0<strong>break<\/strong>\u00a0statement is not used, the execution will continue to the next case statement, regardless of whether it matches the expression value or not.<\/li><li>Also, it&#8217;s possible to use\u00a0<strong>goto<\/strong>\u00a0statement to jump to a labeled statement.<\/li><li><strong>switch<\/strong>\u00a0statement is generally more efficient than a large number of if-else statements when the number of cases is high.<\/li><\/ul><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16411\" class=\"elementor-tab-title\" data-tab=\"11\" role=\"button\" aria-controls=\"elementor-tab-content-16411\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">11. Can we have more than one abstract class ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16411\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"11\" role=\"region\" aria-labelledby=\"elementor-tab-title-16411\"><ul><li>Yes, you can have multiple abstract classes in a single program or project. An abstract class is a class that cannot be instantiated, but can be inherited by other classes. It is a way to define a common interface or set of behaviors for a group of related classes.<\/li><li>An abstract class is created by using the keyword &#8216;<strong>abstract<\/strong>&#8216; before the class keyword. An abstract class can have both abstract and non-abstract methods. The derived<\/li><li>class that inherits the abstract class, must provide implementation for all the abstract methods defined in the base abstract class.<\/li><\/ul><p>Here is an example of multiple abstract classes in C#:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">abstract class Shape<br\/>{<br\/>    public abstract double Area();<br\/>}<br\/><br\/>abstract class Circle : Shape<br\/>{<br\/>    public abstract double Circumference();<br\/>}<br\/><br\/>abstract class Square : Shape<br\/>{<br\/>    public abstract double Perimeter();<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>In this example, we have three abstract classes\u00a0<strong>Shape, Circle,<\/strong>\u00a0and\u00a0<strong>Square<\/strong>\u00a0which inherits from\u00a0<strong>Shape.<\/strong>\u00a0Each class has its own abstract method and the derived class that inherits these classes must provide the implementation for them.<\/li><li>It is important to note that, it is not a good practice to create too many abstract classes as it can make the codebase complex and harder to understand. It&#8217;s recommended to use abstract classes only when it makes sense to group classes together that share common behavior or interface.<\/li><\/ul><p>\u00a0<\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16412\" class=\"elementor-tab-title\" data-tab=\"12\" role=\"button\" aria-controls=\"elementor-tab-content-16412\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">12. Abstract class with coding ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16412\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"12\" role=\"region\" aria-labelledby=\"elementor-tab-title-16412\"><ul><li>An abstract class is a class that cannot be instantiated and is typically used as a base class for other classes that implement its functionality. Abstract classes are defined using the\u00a0<strong>abstract<\/strong>\u00a0keyword in C#.<\/li><\/ul><p>Here&#8217;s an example of an abstract class called\u00a0<strong>Shape<\/strong>:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">abstract class Shape<br\/>{<br\/>    \/\/ properties and fields<br\/>    public double Width { get; set; }<br\/>    public double Height { get; set; }<br\/><br\/>    \/\/ abstract method<br\/>    public abstract double CalculateArea();<br\/><br\/>    \/\/ non-abstract method<br\/>    public double CalculatePerimeter()<br\/>    {<br\/>        return 2 * (Width + Height);<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>In this example,\u00a0<strong>Shape<\/strong>\u00a0is an abstract class with two properties (Width and Height), an abstract method\u00a0<strong>CalculateArea()<\/strong>\u00a0and non-abstract method\u00a0<strong>CalculatePerimeter().<\/strong><\/li><li>Abstract methods are methods that do not have an implementation and must be overridden by any class that inherits from the abstract class. In this example, the\u00a0<strong>CalculateArea()<\/strong>\u00a0method is abstract and does not have an implementation in the Shape class.<\/li><\/ul><p>Here&#8217;s an example of how to create a derived class called\u00a0<strong>Rectangle<\/strong>\u00a0that inherits from the\u00a0<strong>Shape<\/strong>\u00a0class:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class Rectangle : Shape<br\/>{<br\/>    public override double CalculateArea()<br\/>    {<br\/>        return Width * Height;<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>The\u00a0<strong>Rectangle<\/strong>\u00a0class inherits from the\u00a0<strong>Shape<\/strong>\u00a0class and overrides the\u00a0<strong>CalculateArea()<\/strong>\u00a0method to provide its own implementation. It can also call\u00a0<strong>CalculatePerimeter()<\/strong>\u00a0method from Shape class.<\/li><\/ul><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">Rectangle rectangle = new Rectangle();<br\/>rectangle.Width = 4.5;<br\/>rectangle.Height = 7.5;<br\/>Console.WriteLine(&quot;Area of rectangle: &quot; + rectangle.CalculateArea());<br\/>Console.WriteLine(&quot;Perimeter of rectangle: &quot; + rectangle.CalculatePerimeter());<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>It is important to note that, you can&#8217;t create the object of an abstract class, you can only inherit it in other classes.<\/li><\/ul><p><br \/><br \/><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16413\" class=\"elementor-tab-title\" data-tab=\"13\" role=\"button\" aria-controls=\"elementor-tab-content-16413\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">13. What is the difference b\/w Constructor and normal method ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16413\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"13\" role=\"region\" aria-labelledby=\"elementor-tab-title-16413\"><p>A constructor in C# is a special method used to initialize an object of a class, while a normal method is just a regular method that performs specific operations. Key differences include:<\/p><ol><li><strong> Naming :<\/strong><\/li><\/ol><ul><li>A constructor must have the same name as the class, while a normal method can have any name.<\/li><\/ul><ol start=\"2\"><li><strong> Invocation :<\/strong><\/li><\/ol><ul><li>A constructor is automatically called when an object is created, while a normal method must be explicitly called.<\/li><\/ul><ol start=\"3\"><li><strong> Return type :<\/strong><\/li><\/ol><ul><li>A constructor does not have a return type, while a normal method can have a return type or be a void method.<\/li><\/ul><ol start=\"4\"><li><strong> Overloading :<\/strong><\/li><\/ol><ul><li>Constructors can be overloaded, meaning multiple constructors with different parameters can be defined in a single class, while normal methods cannot be overloaded with the same name.<\/li><\/ul><p><br \/><br \/><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16414\" class=\"elementor-tab-title\" data-tab=\"14\" role=\"button\" aria-controls=\"elementor-tab-content-16414\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">14. How you called Constructor Explain ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16414\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"14\" role=\"region\" aria-labelledby=\"elementor-tab-title-16414\"><ul><li>A constructor in C# is automatically called when an object of a class is created using the &#8220;<strong>new<\/strong>&#8221; operator.<\/li><\/ul><p>The syntax for creating an object of a class and calling its constructor is as follows:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">ClassName objectName = new ClassName();<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>The constructor is defined within the class and has the same name as the class. It is executed automatically when the object is created and can be used to initialize the object&#8217;s properties or fields.<\/li><li>If the class has multiple constructors, the appropriate constructor to be called can be selected by passing the required parameters when creating the object.<\/li><\/ul><p>For example:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">class Person<br\/>{<br\/>    public string Name;<br\/>    public int Age;<br\/><br\/>    public Person(string name)<br\/>    {<br\/>        Name = name;<br\/>    }<br\/><br\/>    public Person(string name, int age)<br\/>    {<br\/>        Name = name;<br\/>        Age = age;<br\/>    }<br\/>}<br\/><br\/>\/\/ Creating an object and calling the constructor with one parameter<br\/>Person person1 = new Person(&quot;John&quot;);<br\/><br\/>\/\/ Creating an object and calling the constructor with two parameters<br\/>Person person2 = new Person(&quot;Jane&quot;, 30);<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>\u00a0<\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16415\" class=\"elementor-tab-title\" data-tab=\"15\" role=\"button\" aria-controls=\"elementor-tab-content-16415\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">15. What is the Advantage of Constructor ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16415\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"15\" role=\"region\" aria-labelledby=\"elementor-tab-title-16415\"><p>There are several advantages of using constructors in C#:<\/p><ol><li><strong> Initialization :<\/strong><\/li><\/ol><ul><li>Constructors are used to initialize objects of a class, setting their initial state and values. This eliminates the need to manually initialize the object&#8217;s properties and fields after it is created.<\/li><\/ul><ol start=\"2\"><li><strong> Overloading :<\/strong><\/li><\/ol><ul><li>Constructors can be overloaded, allowing multiple constructors with different parameters to be defined in a single class. This provides flexibility in creating objects of the class, as different constructors can be used to initialize objects with different sets of parameters.<\/li><\/ul><ol start=\"3\"><li><strong> Code Reusability :<\/strong><\/li><\/ol><ul><li>Constructors allow for code reuse, as the same code can be executed each time an object is created, reducing the amount of code duplication and increasing efficiency.<\/li><\/ul><ol start=\"4\"><li><strong> Improved Readability :<\/strong><\/li><\/ol><ul><li>Constructors help to improve the readability of code, as the logic for initializing objects is encapsulated within the class, rather than spread out in multiple places in the code.<\/li><\/ul><ol start=\"5\"><li><strong> Simplified Memory Management :<\/strong><\/li><\/ol><ul><li>Constructors automatically allocate memory for objects, simplifying the process of memory management and reducing the risk of memory leaks.<\/li><\/ul><p><br \/><br \/><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16416\" class=\"elementor-tab-title\" data-tab=\"16\" role=\"button\" aria-controls=\"elementor-tab-content-16416\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">16. What is the Advantage of Exception Handling ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16416\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"16\" role=\"region\" aria-labelledby=\"elementor-tab-title-16416\"><p>Exception handling in C# provides several advantages, including:<\/p><ol><li><strong> Improved Reliability :<\/strong><\/li><\/ol><ul><li>Exception handling makes it easier to detect and respond to unexpected errors and conditions, improving the reliability of an application.<\/li><\/ul><ol start=\"2\"><li><strong> Better Error Management :<\/strong><\/li><\/ol><ul><li>Exception handling provides a structured way to handle errors, making it easier to diagnose and resolve problems. It also separates error-handling code from the main logic of the application, making the code more maintainable and easier to understand.<\/li><\/ul><ol start=\"3\"><li><strong> Graceful Failure :<\/strong><\/li><\/ol><ul><li>Exception handling enables an application to gracefully fail, by allowing it to catch and handle exceptions and continue running, instead of abruptly crashing.<\/li><\/ul><ol start=\"4\"><li><strong> Reduced Debugging Time :<\/strong><\/li><\/ol><ul><li>Exception handling makes it easier to debug an application, as errors can be caught and logged, providing more information about the cause of the error.<\/li><\/ul><ol start=\"5\"><li><strong> Improved User Experience :<\/strong><\/li><\/ol><ul><li>Exception handling can improve the user experience, by displaying meaningful error messages and allowing the user to recover from errors, instead of just displaying a generic error message and crashing the application.<\/li><\/ul><ol start=\"6\"><li><strong> Better Resource Management :<\/strong><\/li><\/ol><ul><li>Exception handling helps to ensure that resources, such as database connections and file handles, are properly cleaned up, even in the event of an error, reducing the risk of resource leaks and improving the performance of an application.<\/li><\/ul><p><br \/><br \/><\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16417\" class=\"elementor-tab-title\" data-tab=\"17\" role=\"button\" aria-controls=\"elementor-tab-content-16417\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">17. What is Linq Explain ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16417\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"17\" role=\"region\" aria-labelledby=\"elementor-tab-title-16417\"><ul><li>LINQ (Language Integrated Query) is a set of features in C# that provides a simple and consistent way to query and manipulate data, regardless of the data source. LINQ allows you to write queries against a variety of data sources, including arrays, collections, XML documents, and databases.<\/li><\/ul><p>Here&#8217;s an example of using LINQ to query a list of integers in C#:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">using System;<br\/>using System.Linq;<br\/><br\/>class Program<br\/>{<br\/>    static void Main(string[] args)<br\/>    {<br\/>        int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };<br\/><br\/>        var evenNumbers = from n in numbers<br\/>                          where n % 2 == 0<br\/>                          select n;<br\/><br\/>        Console.WriteLine(&quot;Even numbers:&quot;);<br\/>        foreach (var n in evenNumbers)<br\/>        {<br\/>            Console.WriteLine(n);<br\/>        }<br\/><br\/>        Console.ReadLine();<br\/>    }<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>In this example, an array of integers is declared. A LINQ query is then used to select only the even numbers from the array and store the result in a variable\u00a0<strong>evenNumbers.<\/strong>\u00a0The\u00a0<strong>where<\/strong>\u00a0clause filters the numbers based on the condition\u00a0<strong>n % 2 == 0<\/strong>, and the\u00a0<strong>select<\/strong>\u00a0clause specifies which values to select from the data source. Finally, the selected numbers are displayed on the console using a foreach loop.<\/li><\/ul><p>This will output:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">Even numbers:<br\/>2<br\/>4<br\/>6<br\/>8<br\/>10<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>\u00a0<\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16418\" class=\"elementor-tab-title\" data-tab=\"18\" role=\"button\" aria-controls=\"elementor-tab-content-16418\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">18. What is the difference between for and foreach loop ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16418\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"18\" role=\"region\" aria-labelledby=\"elementor-tab-title-16418\"><p>The\u00a0<strong>for<\/strong>\u00a0loop and the\u00a0<strong>foreach<\/strong>\u00a0loop are both used to iterate over a set of items, but they have some key differences:<\/p><ol><li><strong> Iteration Control :<\/strong><\/li><\/ol><ul><li>In a\u00a0<strong>for<\/strong>\u00a0loop, you have complete control over the iteration, including the starting and ending conditions, as well as the increment or decrement of the loop variable. In a\u00a0<strong>foreach<\/strong>\u00a0loop, the iteration is controlled by the enumerator of the collection and you don&#8217;t have control over the iteration.<\/li><\/ul><ol start=\"2\"><li><strong> Collection Type :<\/strong><\/li><\/ol><ul><li>The for loop can be used with any type of collection, including arrays, lists, and custom collections, while the\u00a0<strong>foreach<\/strong>\u00a0loop is limited to collections that implement the\u00a0<strong>IEnumerable<\/strong>\u00a0interface.<\/li><\/ul><ol start=\"3\"><li><strong> Modifying Elements :<\/strong><\/li><\/ol><ul><li>In a for loop, you can modify the elements of the collection. In a\u00a0<strong>foreach<\/strong>\u00a0loop, you cannot modify the elements of the collection because the\u00a0<strong>foreach<\/strong>\u00a0loop enumerates a read-only version of the collection.<\/li><\/ul><p>Here&#8217;s an example of a for loop:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">int[] numbers = { 1, 2, 3, 4, 5 };<br\/><br\/>for (int i = 0; i &lt; numbers.Length; i++)<br\/>{<br\/>    Console.WriteLine(numbers[i]);<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>And here&#8217;s an example of a\u00a0<strong>foreach<\/strong>\u00a0loop:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">int[] numbers = { 1, 2, 3, 4, 5 };<br\/><br\/>foreach (int number in numbers)<br\/>{<br\/>    Console.WriteLine(number);<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><p>In general, you should use a\u00a0<strong>foreach<\/strong>\u00a0loop when you need to iterate over a collection and you don&#8217;t need to modify the elements, and a\u00a0<strong>for<\/strong>\u00a0loop when you need more control over the iteration or need to modify the elements.<\/p><p>\u00a0<\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16419\" class=\"elementor-tab-title\" data-tab=\"19\" role=\"button\" aria-controls=\"elementor-tab-content-16419\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">19. What is Array and Array list ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16419\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"19\" role=\"region\" aria-labelledby=\"elementor-tab-title-16419\"><ul><li>An array is a collection of elements of the same type that are stored in contiguous memory locations. Arrays are a fixed size, meaning that the number of elements in an array cannot be changed once the array has been created.<\/li><\/ul><p>Here&#8217;s an example of how you can create and use an array in C#:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">int[] numbers = new int[5];<br\/><br\/>numbers[0] = 1;<br\/>numbers[1] = 2;<br\/>numbers[2] = 3;<br\/>numbers[3] = 4;<br\/>numbers[4] = 5;<br\/><br\/>foreach (int number in numbers)<br\/>{<br\/>    Console.WriteLine(number);<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>An ArrayList, on the other hand, is a dynamic size collection of elements of any type that are stored in an array. Unlike arrays, ArrayLists can grow and shrink dynamically to accommodate the number of elements that are added or removed.<\/li><\/ul><p>Here&#8217;s an example of how you can create and use an ArrayList in C#:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">ArrayList list = new ArrayList();<br\/><br\/>list.Add(1);<br\/>list.Add(2);<br\/>list.Add(3);<br\/>list.Add(4);<br\/>list.Add(5);<br\/><br\/>foreach (int number in list)<br\/>{<br\/>    Console.WriteLine(number);<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>While ArrayLists provide more flexibility than arrays, they come at a cost of performance, as the operations on an ArrayList are generally slower than the equivalent operations on an array. If you know the number of elements in advance, you should use an array, and if you don&#8217;t, you should use an ArrayList.<\/li><\/ul><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-accordion-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-16420\" class=\"elementor-tab-title\" data-tab=\"20\" role=\"button\" aria-controls=\"elementor-tab-content-16420\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon elementor-accordion-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-closed\"><svg class=\"e-font-icon-svg e-fas-plus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-accordion-icon-opened\"><svg class=\"e-font-icon-svg e-fas-minus\" viewBox=\"0 0 448 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-accordion-title\" tabindex=\"0\">20. Explain the try catch ?<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t<div id=\"elementor-tab-content-16420\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"20\" role=\"region\" aria-labelledby=\"elementor-tab-title-16420\"><ul><li>In C#, the\u00a0<strong>try-catch<\/strong>\u00a0block is used to handle exceptions, which are errors that occur during the execution of a program. The\u00a0<strong>try<\/strong>\u00a0block contains the code that might throw an exception, and the\u00a0<strong>catch<\/strong>\u00a0block contains the code that will be executed if an exception is thrown.<\/li><\/ul><p>The basic syntax for the\u00a0<strong>try-catch<\/strong>\u00a0block is as follows:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">try<br\/>{<br\/>    \/\/ Code that might throw an exception<br\/>}<br\/>catch (ExceptionType ex)<br\/>{<br\/>    \/\/ Code to handle the exception<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>In this example, the code inside the\u00a0<strong>try<\/strong>\u00a0block might throw an exception. If an exception is thrown, the control of the program will jump to the\u00a0<strong>catch<\/strong>\u00a0block, where the exception will be caught and processed. The\u00a0<strong>ExceptionType<\/strong>\u00a0in the\u00a0<strong>catch<\/strong>\u00a0block specifies the type of exception that will be caught, and\u00a0<strong>ex<\/strong>\u00a0is a variable that can be used to access information about the exception.<\/li><li>You can also include multiple\u00a0<strong>catch<\/strong>\u00a0blocks to handle different types of exceptions, and you can include a\u00a0<strong>finally<\/strong>\u00a0block to specify code that will be executed regardless of whether an exception was thrown.<\/li><\/ul><p>Example:<\/p><div class=\"code-embed-wrapper\"> <pre class=\"language-csharp code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-csharp code-embed-code\">try<br\/>{<br\/>    int a = 10;<br\/>    int b = 0;<br\/>    int c = a \/ b;<br\/>}<br\/>catch (DivideByZeroException ex)<br\/>{<br\/>    Console.WriteLine(&quot;Caught DivideByZeroException: &quot; + ex.Message);<br\/>}<br\/>catch (Exception ex)<br\/>{<br\/>    Console.WriteLine(&quot;Caught Exception: &quot; + ex.Message);<br\/>}<br\/>finally<br\/>{<br\/>    Console.WriteLine(&quot;Finally block executed.&quot;);<br\/>}<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><ul><li>In this example, the\u00a0<strong>try<\/strong>\u00a0block contains code that might throw a\u00a0<strong>DivideByZeroException<\/strong>\u00a0if an attempt is made to divide by zero. The first\u00a0<strong>catch<\/strong>\u00a0block is designed to catch the\u00a0<strong>DivideByZeroException<\/strong>\u00a0and print a message to the console. The second\u00a0<strong>catch<\/strong>\u00a0block is designed to catch any other type of exception and print a message to the console. The\u00a0<strong>finally<\/strong>\u00a0block contains code that will be executed regardless of whether an exception was thrown or not.<\/li><\/ul><p>\u00a0<\/p><\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Introduction The\u00a0DOT NET\u00a0is a\u00a0software framework. It is developed by\u00a0Microsoft. It includes a large\u00a0library\u00a0and also provides\u00a0language inter-operability across some\u00a0programming languages. Language inter-operability refers the capability of two different languages to interact and operate on the same kind of data structures. The programs written for\u00a0DOT NET\u00a0execute in a software environment. The name of the software environment is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[724,3203],"tags":[806,799,800,833,801,803,1033,811,1031,834,835,836],"class_list":["post-2930","post","type-post","status-publish","format-standard","hentry","category-interview-questions","category-programming","tag-net-interview-questions-and-answers","tag-asp-net-interview-questions","tag-asp-net-interview-questions-and-answers","tag-asp-net-mvc-interview-questions-and-answers","tag-c-interview-questions","tag-c-interview-questions-and-answers","tag-c-interview-questions-and-answers-for-experienced","tag-c-interview-questions-with-answers","tag-interview-questions-and-answers","tag-mvc-interview-questions-and-answers","tag-mvc-interview-questions-and-answers-for-experienced","tag-mvc-interview-questions-and-answers-for-freshers"],"_links":{"self":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/2930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/comments?post=2930"}],"version-history":[{"count":0,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/posts\/2930\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/media?parent=2930"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/categories?post=2930"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaashivinfotech.com\/blog\/wp-json\/wp\/v2\/tags?post=2930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}