{"id":12473,"date":"2024-08-28T10:00:48","date_gmt":"2024-08-28T04:30:48","guid":{"rendered":"https:\/\/www.placementpreparation.io\/blog\/?p=12473"},"modified":"2024-12-26T17:11:07","modified_gmt":"2024-12-26T11:41:07","slug":"c-sharp-interview-questions-for-freshers","status":"publish","type":"post","link":"https:\/\/www.placementpreparation.io\/blog\/c-sharp-interview-questions-for-freshers\/","title":{"rendered":"Top C# Interview Questions for Freshers"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Are you preparing for your first C# interview and wondering what questions you might face?<\/p><p>Understanding the key C# interview questions for freshers can give you more clarity.<\/p><p>With this guide, you&rsquo;ll be well-prepared to tackle these C# interview questions and answers for freshers and make a strong impression in your interview.<\/p><p><a href=\"https:\/\/www.guvi.in\/courses\/aptitude\/interview-preparation\/?utm_source=placement_preparation&amp;utm_medium=blog_banner&amp;utm_campaign=c_sharp_interview_questions_for_freshers_horizontal\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone wp-image-10341 size-full\" src=\"https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/interview-preparation-course-desktop-banner-horizontal.webp\" alt=\"interview preparation course desktop banner horizontal\" width=\"2270\" height=\"600\" srcset=\"https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/interview-preparation-course-desktop-banner-horizontal.webp 2270w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/interview-preparation-course-desktop-banner-horizontal-300x79.webp 300w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/interview-preparation-course-desktop-banner-horizontal-1024x271.webp 1024w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/interview-preparation-course-desktop-banner-horizontal-768x203.webp 768w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/interview-preparation-course-desktop-banner-horizontal-1536x406.webp 1536w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/interview-preparation-course-desktop-banner-horizontal-2048x541.webp 2048w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/interview-preparation-course-desktop-banner-horizontal-150x40.webp 150w\" sizes=\"(max-width: 2270px) 100vw, 2270px\"><\/a><\/p><h2 id=\"practice-c-sharp-interview-questions\">Practice C# Interview Questions and Answers<\/h2><p>Below are the top 50 C# interview questions for freshers with answers:<\/p><h3 id=\"declare-and-initialize-variable\">1. How do you declare and initialize a variable in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Declare a variable by specifying its type and name, followed by initialization with a value using the assignment operator.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>int number = 5;<\/p>\n<\/div><\/div><h3 id=\"difference-between-==-and-equals\">2. What is the difference between == and Equals() in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>== compares the reference or value type of objects, while <strong>Equals()<\/strong> compares the actual content of the objects.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>string a = &ldquo;hello&rdquo;;<br>\nstring b = &ldquo;hello&rdquo;;<br>\nbool result = a == b; \/\/ True<br>\nbool result2 = a.Equals(b); \/\/ True<\/p>\n<\/div><\/div><h3 id=\"creating-a-constant\">3. How do you create a constant in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>const<\/strong> keyword to declare a constant, which means its value cannot be changed after initialization.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>const double Pi = 3.14159;<\/p>\n<\/div><\/div><h3 id=\"purpose-of-using-statement\">4. What is the purpose of the using statement in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>The <strong>using<\/strong> statement is used to include namespaces and ensure that resources are disposed of correctly at the end of their usage.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>using System.IO;<\/p>\n<\/div><\/div><h3 id=\"define-an-enum\">5. How do you define an enum in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Define an <strong>enum<\/strong> using the enum keyword, followed by the enum name and a list of named constants.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }<\/p>\n<\/div><\/div><h3 id=\"create-and-instantiate-class\">6. How do you create a class in C# and instantiate an object of that class?<\/h3><p><strong>Answer:<\/strong><\/p><p>Define a class using the <strong>class<\/strong> keyword and instantiate it using the new keyword.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class Car {<br>\npublic string Make { get; set; }<br>\n}<br>\nCar myCar = new Car();<\/p>\n<\/div><\/div><h3 id=\"class-vs-object\">7. What is the difference between a class and an object in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>A class is a blueprint or template for objects, while an object is an instance of a class, containing data and methods defined in the class.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>Car myCar = new Car(); \/\/ `myCar` is an object, `Car` is the class<\/p>\n<\/div><\/div><h3 id=\"implement-encapsulation\">8. How do you implement encapsulation in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Encapsulation is implemented using access modifiers like <strong>private<\/strong>, <strong>protected<\/strong>, and <strong>public<\/strong> to restrict access to class members.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class Account {<br>\nprivate decimal balance;<br>\npublic void Deposit(decimal amount) {<br>\nbalance += amount;<br>\n}<br>\n}<\/p>\n<\/div><\/div><h3 id=\"implement-inheritance\">9. What is inheritance, and how do you implement it in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Inheritance allows a class to inherit members from another class using the <strong>:<\/strong> symbol. The derived class inherits properties and methods from the base class.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class Vehicle {<br>\npublic string Brand { get; set; }<br>\n}<br>\nclass Car : Vehicle {<br>\npublic int Wheels { get; set; }<br>\n}<\/p>\n<\/div><\/div><h3 id=\"polymorphism-achievement\">10. What is polymorphism in C#, and how do you achieve it?<\/h3><p><strong>Answer:<\/strong><\/p><p>Polymorphism allows methods to have different implementations in derived classes. It is achieved using method overriding with the <strong>virtual<\/strong> and <strong>override<\/strong> keywords.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class Animal {<br>\npublic virtual void Speak() {<br>\nConsole.WriteLine(&ldquo;Animal speaks&rdquo;);<br>\n}<br>\n}<br>\nclass Dog : Animal {<br>\npublic override void Speak() {<br>\nConsole.WriteLine(&ldquo;Dog barks&rdquo;);<br>\n}<br>\n}<\/p>\n<\/div><\/div><h3 id=\"implement-an-interface\">11. How do you implement an interface in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>An interface is implemented by a class using the <strong>:<\/strong> symbol. The class must provide implementations for all interface members.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>interface IDriveable {<br>\nvoid Drive();<br>\n}<br>\nclass Car : IDriveable {<br>\npublic void Drive() {<br>\nConsole.WriteLine(&ldquo;Driving a car&rdquo;);<br>\n}<br>\n}<\/p>\n<\/div><\/div><h3 id=\"abstract-class-vs-interface\">12. What is the difference between an abstract class and an interface in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>An abstract class can have method implementations and fields, while an interface can only have method declarations. A class can inherit multiple interfaces but only one abstract class.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>abstract class Animal {<br>\npublic abstract void MakeSound();<br>\n}<br>\ninterface IRun {<br>\nvoid Run();<br>\n}<\/p>\n<\/div><\/div><h3 id=\"handle-exceptions\">13. How do you handle exceptions in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use <strong>try<\/strong>, <strong>catch<\/strong>, and <strong>finally<\/strong> blocks to handle exceptions, allowing you to manage runtime errors gracefully.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>try {<br>\nint result = 10 \/ 0;<br>\n} catch (DivideByZeroException ex) {<br>\nConsole.WriteLine(&ldquo;Cannot divide by zero&rdquo;);<br>\n} finally {<br>\nConsole.WriteLine(&ldquo;End of try-catch block&rdquo;);<br>\n}<\/p>\n<\/div><\/div><h3 id=\"delegate-declaration-and-use\">14. What is a delegate in C#, and how do you declare and use it?<\/h3><p><strong>Answer:<\/strong><\/p><p>A delegate is a type-safe function pointer. It is declared using the <strong>delegate<\/strong> keyword and can point to methods with a matching signature.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public delegate void PrintMessage(string message);<br>\nPrintMessage pm = new PrintMessage(Console.WriteLine);<br>\npm(&ldquo;Hello, Delegates!&rdquo;);<\/p>\n<\/div><\/div><h3 id=\"implement-generic-class\">15. How do you implement a generic class in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>A generic class is defined using a type parameter that allows the class to operate on different data types.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class GenericClass&lt;T&gt; {<br>\npublic T Field;<br>\npublic GenericClass(T value) {<br>\nField = value;<br>\n}<br>\n}<br>\nGenericClass&lt;int&gt; myClass = new GenericClass&lt;int&gt;(10);<\/p>\n<\/div><\/div><h3 id=\"use-linq-for-filtering\">16. How do you use LINQ to filter and sort a list of integers?<\/h3><p><strong>Answer:<\/strong><\/p><p>LINQ allows you to query collections using query syntax or method syntax, enabling powerful filtering, sorting, and aggregation operations.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>int[] numbers = { 5, 3, 9, 1 };<br>\nvar sortedNumbers = from n in numbers<br>\nwhere n &gt; 2<br>\norderby n<br>\nselect n;<\/p>\n<\/div><\/div><h3 id=\"list-purpose-and-add\">17. What is the purpose of the List&lt;T&gt; class, and how do you add elements to it?<\/h3><p><strong>Answer:<\/strong><\/p><p><strong>List&lt;T&gt;<\/strong> is a generic collection that provides dynamic array-like storage for elements. Use the <strong>Add<\/strong> method to add elements.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>List&lt;int&gt; numbers = new List&lt;int&gt;();<br>\nnumbers.Add(1);<br>\nnumbers.Add(2);<\/p>\n<\/div><\/div><h3 id=\"find-maximum-value-linq\">18. How do you find the maximum value in a list using LINQ?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>Max()<\/strong> method provided by LINQ to find the maximum value in a list or collection.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>List&lt;int&gt; numbers = new List&lt;int&gt; { 1, 5, 3 };<br>\nint maxValue = numbers.Max();<\/p>\n<\/div><\/div><h3 id=\"ienumerable-vs-iqueryable\">19. What is the difference between IEnumerable and IQueryable in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p><strong>IEnumerable<\/strong> is used for in-memory collections, while <strong>IQueryable<\/strong> is designed for querying data from out-of-memory sources like databases, allowing for deferred execution and remote querying.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>IEnumerable&lt;int&gt; numbers = new List&lt;int&gt; { 1, 2, 3 };<\/p>\n<\/div><\/div><h3 id=\"group-data-using-linq\">20. How do you group data using LINQ in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>group by<\/strong> clause in LINQ to group elements in a collection based on a specific key.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>var grouped = from n in numbers<br>\ngroup n by n % 2 into g<br>\nselect g;<\/p>\n<\/div><\/div><h3 id=\"read-file-line-by-line\">21. How do you read the contents of a file line by line in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>StreamReader<\/strong> class in a <strong>using<\/strong> block to read the contents of a file line by line.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>using (StreamReader sr = new StreamReader(&ldquo;file.txt&rdquo;)) {<br>\nstring line;<br>\nwhile ((line = sr.ReadLine()) != null) {<br>\nConsole.WriteLine(line);<br>\n}<br>\n}<\/p>\n<\/div><\/div><h3 id=\"write-text-to-file\">22. What is the method to write text to a file in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>StreamWriter<\/strong> class to write text to a file, which creates a new file or appends to an existing one.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>using (StreamWriter sw = new StreamWriter(&ldquo;file.txt&rdquo;)) {<br>\nsw.WriteLine(&ldquo;Hello, World!&rdquo;);<br>\n}<\/p>\n<\/div><\/div><h3 id=\"check-if-file-exists\">23. How do you check if a file exists in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>File.Exists()<\/strong> method to check whether a specific file exists in the specified path.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>bool exists = File.Exists(&ldquo;file.txt&rdquo;);<\/p>\n<\/div><\/div><h3 id=\"copy-a-file\">24. What is the method to copy a file from one location to another in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>File.Copy()<\/strong> method to copy a file from one directory to another, specifying the source and destination paths.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>File.Copy(&ldquo;source.txt&rdquo;, &ldquo;destination.txt&rdquo;);<\/p>\n<\/div><\/div><h3 id=\"delete-a-file\">25. How do you delete a file in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>File.Delete()<\/strong> method to delete a file from the filesystem by providing its path.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>File.Delete(&ldquo;file.txt&rdquo;);<\/p>\n<\/div><\/div><h3 id=\"declare-an-event\">26. What is an event in C#, and how do you declare one?<\/h3><p><strong>Answer:<\/strong><\/p><p>An event is a message that objects send to signal the occurrence of an action. Declare an <strong>event<\/strong> using the event keyword and a delegate type.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public event EventHandler MyEvent;<\/p>\n<\/div><\/div><h3 id=\"subscribe-to-event\">27. How do you subscribe to an event in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Subscribe to an event by attaching an event handler method using the <strong>+=<\/strong> operator.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>MyEvent += new EventHandler(EventHandlerMethod);<\/p>\n<\/div><\/div><h3 id=\"multicast-delegate\">28. What is a multicast delegate in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>A multicast delegate can reference multiple methods. When invoked, all methods in the delegate chain are called in sequence.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public delegate void Notify();<br>\nNotify del = Method1;<br>\ndel += Method2;<\/p>\n<\/div><\/div><h3 id=\"remove-delegate-method\">29. How do you remove a method from a delegate&rsquo;s invocation list in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>-=<\/strong> operator to remove a method from a delegate&rsquo;s invocation list.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>del -= Method1;<\/p>\n<\/div><\/div><h3 id=\"raise-an-event\">30. How do you raise an event in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Raise an event by invoking it, typically using a protected virtual method to ensure it&rsquo;s properly raised by derived classes.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>protected virtual void OnMyEvent() {<br>\nMyEvent?.Invoke(this, EventArgs.Empty);<br>\n}<\/p>\n<\/div><\/div><h3 id=\"create-custom-exception\">31. How do you create a custom exception in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Create a custom exception by deriving a class from <strong>Exception<\/strong> and implementing appropriate constructors.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public class MyCustomException : Exception {<br>\npublic MyCustomException(string message) : base(message) { }<br>\n}<\/p>\n<\/div><\/div><h3 id=\"throw-vs-throw-ex\">32. What is the difference between throw and throw ex in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p><strong>throw<\/strong> preserves the original stack trace, while <strong>throw ex<\/strong> resets the stack trace, making it harder to trace the original source of the exception.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>try {<br>\n\/\/ Code that throws an exception<br>\n} catch (Exception ex) {<br>\nthrow; \/\/ Preserves stack trace<br>\n}<\/p>\n<\/div><\/div><h3 id=\"try-finally-block\">33. How do you implement a try-finally block in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use a <strong>try-finally<\/strong> block to execute code that must run whether or not an exception is thrown, such as resource cleanup.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>try {<br>\n\/\/ Code that may throw an exception<br>\n} finally {<br>\n\/\/ Code that always runs<br>\n}<\/p>\n<\/div><\/div><h3 id=\"purpose-of-stacktrace\">34. What is the purpose of the StackTrace class in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>The <strong>StackTrace<\/strong> class provides information about the current call stack, useful for debugging and logging.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>StackTrace st = new StackTrace();<br>\nConsole.WriteLine(st.ToString());<\/p>\n<\/div><\/div><h3 id=\"log-exceptions\">35. How do you log exceptions in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Log exceptions by writing them to a file, database, or logging framework like <strong>log4net<\/strong> or <strong>NLog<\/strong>, typically inside a <strong>catch<\/strong> block.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>try {<br>\n\/\/ Code that may throw an exception<br>\n} catch (Exception ex) {<br>\nFile.WriteAllText(&ldquo;log.txt&rdquo;, ex.ToString());<br>\n}<\/p>\n<\/div><\/div><h3 id=\"create-new-thread\">36. How do you create a new thread in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Create a new thread using the <strong>Thread<\/strong> class, passing a <strong>ThreadStart<\/strong> delegate or lambda expression as the method to run.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>Thread myThread = new Thread(new ThreadStart(MyMethod));<br>\nmyThread.Start();<\/p>\n<\/div><\/div><h3 id=\"task-class-for-async\">37. What is the Task class in C#, and how do you use it for asynchronous operations?<\/h3><p><strong>Answer:<\/strong><\/p><p>The <strong>Task<\/strong> class represents an asynchronous operation. Use <strong>Task.Run()<\/strong> to execute a method asynchronously.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>Task.Run(() =&gt; {<br>\n\/\/ Code to run asynchronously<br>\n});<\/p>\n<\/div><\/div><h3 id=\"use-async-and-await\">38. How do you use the async and await keywords in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Mark a method with <strong>async<\/strong> and use <strong>await<\/strong> to asynchronously wait for the completion of a task.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public async Task&lt;int&gt; GetDataAsync() {<br>\nint result = await Task.Run(() =&gt; {<br>\n\/\/ Simulate long-running task<br>\nreturn 42;<br>\n});<br>\nreturn result;<br>\n}<\/p>\n<\/div><\/div><h3 id=\"threadpool-usage\">39. What is a ThreadPool, and how do you use it in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>A <strong>ThreadPool<\/strong> manages a pool of worker threads, reducing the overhead of thread creation. Use <strong>ThreadPool.QueueUserWorkItem()<\/strong> to queue tasks.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>ThreadPool.QueueUserWorkItem(state =&gt; {<br>\n\/\/ Code to run in the thread pool<br>\n});<\/p>\n<\/div><\/div><h3 id=\"implement-cancellation-token\">40. How do you implement a cancellation token to cancel an ongoing task in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>CancellationTokenSource<\/strong> and <strong>CancellationToken<\/strong> to signal and check for cancellation in a task.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>CancellationTokenSource cts = new CancellationTokenSource();<br>\nTask.Run(() =&gt; {<br>\nwhile (!cts.Token.IsCancellationRequested) {<br>\n\/\/ Long-running task<br>\n}<br>\n}, cts.Token);<br>\n\/\/ Cancel the task<br>\ncts.Cancel();<\/p>\n<\/div><\/div><h3 id=\"model-class-in-entity\">41. How do you create a model class for a database table in Entity Framework?<\/h3><p><strong>Answer:<\/strong><\/p><p>Define a C# class with properties corresponding to the database table columns, and annotate it with data annotations if needed.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public class Product {<br>\npublic int ProductId { get; set; }<br>\npublic string Name { get; set; }<br>\n}<\/p>\n<\/div><\/div><h3 id=\"crud-using-entity-framework\">42. How do you perform a basic CRUD operation using Entity Framework?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>DbContext<\/strong> to perform Create, Read, Update, and Delete operations on the database.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>using (var context = new MyDbContext()) {<br>\nvar product = new Product { Name = &ldquo;Laptop&rdquo; };<br>\ncontext.Products.Add(product); \/\/ Create<br>\ncontext.SaveChanges();<\/p>\n<p>var products = context.Products.ToList(); \/\/ Read<\/p>\n<p>product.Name = &ldquo;Updated Laptop&rdquo;; \/\/ Update<br>\ncontext.SaveChanges();<\/p>\n<p>context.Products.Remove(product); \/\/ Delete<br>\ncontext.SaveChanges();<br>\n}<\/p>\n<\/div><\/div><h3 id=\"lazy-loading-in-entity\">43. What is lazy loading in Entity Framework, and how do you enable or disable it?<\/h3><p><strong>Answer:<\/strong><\/p><p>Lazy loading delays the loading of related data until it is explicitly accessed. Enable or disable it using L<strong>azyLoadingEnabled<\/strong> in the <strong>DbContext<\/strong>.<\/p><p>context.Configuration.LazyLoadingEnabled = false;<\/p><p>\n[\/su_note]\n<\/p><h3 id=\"handle-database-migrations\">44. How do you handle database migrations in Entity Framework?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use <strong>Add-Migration<\/strong> and <strong>Update-Database<\/strong> commands in the Package Manager Console to handle schema changes and apply them to the database.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>Add-Migration InitialCreate<br>\nUpdate-Database<\/p>\n<\/div><\/div><h3 id=\"execute-raw-sql\">45. How do you execute a raw SQL query in Entity Framework?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>context.Database.SqlQuery&lt;T&gt;()<\/strong> method to execute a raw SQL query and return the result as a collection of entities.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>var products = context.Database.SqlQuery&lt;Product&gt;(&ldquo;SELECT * FROM Products&rdquo;).ToList();<\/p>\n<\/div><\/div><h3 id=\"singleton-pattern\">46. What is the Singleton pattern, and how do you implement it in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>The Singleton pattern ensures a class has only one instance and provides a global point of access to it. Implement it using a private constructor and a static instance.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public class Singleton {<br>\nprivate static readonly Singleton instance = new Singleton();<br>\nprivate Singleton() { }<br>\npublic static Singleton Instance {<br>\nget { return instance; }<br>\n}<br>\n}<\/p>\n<\/div><\/div><h3 id=\"dependency-injection-pattern\">47. How do you implement the Dependency Injection pattern in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Implement Dependency Injection by injecting dependencies through constructors, properties, or methods, often managed by an IoC container like Autofac or Unity.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public class MyClass {<br>\nprivate readonly IService _service;<br>\npublic MyClass(IService service) {<br>\n_service = service;<br>\n}<br>\n}<\/p>\n<\/div><\/div><h3 id=\"purpose-of-solid-principles\">48. What is the purpose of the SOLID principles in C# development?<\/h3><p><strong>Answer:<\/strong><\/p><p><strong>SOLID<\/strong> principles are guidelines for writing maintainable and scalable code, focusing on single responsibility, open-closed, Liskov substitution, interface segregation, and dependency inversion.<\/p><h3 id=\"implement-factory-method\">49. How do you implement the Factory Method pattern in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>The Factory Method pattern defines an interface for creating an object but lets subclasses alter the type of objects that will be created.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public abstract class Creator {<br>\npublic abstract IProduct FactoryMethod();<br>\n}<br>\npublic class ConcreteCreator : Creator {<br>\npublic override IProduct FactoryMethod() {<br>\nreturn new ConcreteProduct();<br>\n}<br>\n}<\/p>\n<\/div><\/div><h3 id=\"multiple-interfaces-implementation\">50. How do you ensure that a class implements multiple interfaces with the same method signature in C#?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use explicit interface implementation to ensure that each interface method is implemented separately, avoiding conflicts.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>public class MyClass : IInterface1, IInterface2 {<br>\nvoid IInterface1.Method() {<br>\n\/\/ Implementation for IInterface1<br>\n}<br>\nvoid IInterface2.Method() {<br>\n\/\/ Implementation for IInterface2<br>\n}<br>\n}<\/p>\n<\/div><\/div><h2>Final Words<\/h2><p>Getting ready for an interview can feel overwhelming, but going through these C# fresher interview questions can help you feel more confident.<\/p><p>With the right preparation, you&rsquo;ll ace your C# interview but don&rsquo;t forget to practice the C# basic syntax, object-oriented programming concepts, and .NET framework-related interview questions too.<\/p><hr><h2>Frequently Asked Questions<\/h2><h3>1. What are the most common interview questions for C#?<\/h3><p>Common interview questions for C# typically focus on object-oriented programming, syntax, exception handling, and the .NET framework.<\/p><h3>2. What are the important C# topics freshers should focus on for interviews?<\/h3><p>Important C# topics freshers should focus on include classes and objects, inheritance, polymorphism, delegates, and LINQ.<\/p><h3>3. How should freshers prepare for C# technical interviews?<\/h3><p>Freshers should prepare for C# technical interviews by practicing coding problems, reviewing OOP principles, and understanding the .NET framework.<\/p><h3>4. What strategies can freshers use to solve C# coding questions during interviews?<\/h3><p>Freshers can use strategies like breaking down the problem, using proper OOP practices, and testing edge cases to solve C# coding questions during interviews.<\/p><h3>5. Should freshers prepare for advanced C# topics in interviews?<\/h3><p>Yes, freshers should prepare for advanced C# topics in interviews if the role demands in-depth knowledge or if specified in the job description.<\/p><hr><h2>Explore More C# Resources<\/h2><ul class=\"explore-more\">\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/c-sharp-project-ideas-for-beginners\/\">C# Project Ideas<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/cpp-vs-c-sharp\/\">C# vs C++<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/c-sharp-vs-java\/\">C# vs Java<\/a><\/li>\n<\/ul><h2>Explore More Interview Questions<\/h2><ul class=\"explore-more\">\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/python-interview-questions-for-freshers\/\">Python<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/java-interview-questions-for-freshers\/\">Java<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/sql-interview-questions-for-freshers\/\">SQL<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/react-interview-questions-for-freshers\/\">React<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/javascript-interview-questions-for-freshers\/\">JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/c-programming-interview-questions-for-freshers\/\">C Programming<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/html-interview-questions-for-freshers\/\">HTML<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/css-interview-questions-for-freshers\/\">CSS<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/angular-interview-questions-for-freshers\/\">Angular<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/cpp-interview-questions-for-freshers\/\">C++<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/spring-boot-interview-questions-for-freshers\/\">Spring Boot<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/node-js-interview-questions-for-freshers\/\">Node JS<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/excel-interview-questions-for-freshers\/\">Excel<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Are you preparing for your first C# interview and wondering what questions you might face?Understanding the key C# interview questions for freshers can give you more clarity.With this guide, you&rsquo;ll be well-prepared to tackle these C# interview questions and answers for freshers and make a strong impression in your interview.Practice C# Interview Questions and AnswersBelow [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":12474,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45],"tags":[],"class_list":["post-12473","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming-interview-questions"],"_links":{"self":[{"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/posts\/12473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/comments?post=12473"}],"version-history":[{"count":3,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/posts\/12473\/revisions"}],"predecessor-version":[{"id":12484,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/posts\/12473\/revisions\/12484"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/media\/12474"}],"wp:attachment":[{"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/media?parent=12473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/categories?post=12473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/tags?post=12473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}