{"id":13,"date":"2026-05-17T11:43:34","date_gmt":"2026-05-17T11:43:34","guid":{"rendered":"https:\/\/smitabharat.com\/blog\/?p=13"},"modified":"2026-05-17T18:09:45","modified_gmt":"2026-05-17T12:39:45","slug":"go-lang-interview-questions-and-answers-2026","status":"publish","type":"post","link":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/","title":{"rendered":"Go Lang Interview Questions and Answers 2026"},"content":{"rendered":"<h2 data-section-id=\"8iui6q\" data-start=\"241\" data-end=\"280\">1. What is Go and why is it popular?<\/h2>\n<p data-start=\"282\" data-end=\"454\">Go is an open-source programming language developed by <span class=\"hover:entity-accent entity-underline inline cursor-pointer align-baseline\"><span class=\"whitespace-normal\">Google<\/span><\/span>. It is designed for simplicity, concurrency, fast compilation, and scalability.<\/p>\n<h3 data-section-id=\"4ybteb\" data-start=\"456\" data-end=\"475\">Key advantages:<\/h3>\n<ul data-start=\"476\" data-end=\"635\">\n<li data-section-id=\"vrqrsf\" data-start=\"476\" data-end=\"491\">Simple syntax<\/li>\n<li data-section-id=\"190ltve\" data-start=\"492\" data-end=\"508\">Fast execution<\/li>\n<li data-section-id=\"jugp7p\" data-start=\"509\" data-end=\"544\">Built-in concurrency (goroutines)<\/li>\n<li data-section-id=\"4wfatn\" data-start=\"545\" data-end=\"565\">Garbage collection<\/li>\n<li data-section-id=\"1u9suzj\" data-start=\"566\" data-end=\"591\">Strong standard library<\/li>\n<li data-section-id=\"m7vxn2\" data-start=\"592\" data-end=\"635\">Great for microservices and cloud systems<\/li>\n<\/ul>\n<hr data-start=\"637\" data-end=\"640\" \/>\n<h2 data-section-id=\"17hphkv\" data-start=\"642\" data-end=\"668\">2. What are goroutines?<\/h2>\n<p data-start=\"670\" data-end=\"731\">Goroutines are lightweight threads managed by the Go runtime.<\/p>\n<p data-start=\"733\" data-end=\"741\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">go<\/span> <span class=\"\u037cm\">myFunction<\/span>()<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"q4c1cr\" data-start=\"769\" data-end=\"782\">Features:<\/h3>\n<ul data-start=\"783\" data-end=\"865\">\n<li data-section-id=\"lpgybk\" data-start=\"783\" data-end=\"806\">Very low memory usage<\/li>\n<li data-section-id=\"1plhxal\" data-start=\"807\" data-end=\"831\">Faster than OS threads<\/li>\n<li data-section-id=\"sc5c6e\" data-start=\"832\" data-end=\"865\">Used for concurrent programming<\/li>\n<\/ul>\n<hr data-start=\"867\" data-end=\"870\" \/>\n<h2 data-section-id=\"t4pbwa\" data-start=\"872\" data-end=\"902\">3. What is a channel in Go?<\/h2>\n<p data-start=\"904\" data-end=\"959\">Channels are used for communication between goroutines.<\/p>\n<p data-start=\"961\" data-end=\"969\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">ch<\/span> <span class=\"\u037cg\">:=<\/span> make(<span class=\"\u037cg\">chan<\/span> <span class=\"\u037cm\">int<\/span>)\r\n\r\n<span class=\"\u037cg\">go<\/span> <span class=\"\u037cg\">func<\/span>() {\r\n    <span class=\"\u037cm\">ch<\/span> <span class=\"\u037cg\">&lt;-<\/span> <span class=\"\u037cj\">10<\/span>\r\n}()\r\n\r\n<span class=\"\u037cm\">value<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cg\">&lt;-<\/span><span class=\"\u037cm\">ch<\/span>\r\n<span class=\"\u037cm\">fmt<\/span><span class=\"\u037cg\">.<\/span>Println(<span class=\"\u037cm\">value<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"1iaul7c\" data-start=\"1066\" data-end=\"1079\">Benefits:<\/h3>\n<ul data-start=\"1080\" data-end=\"1167\">\n<li data-section-id=\"1bv0u49\" data-start=\"1080\" data-end=\"1100\">Safe communication<\/li>\n<li data-section-id=\"rh5v85\" data-start=\"1101\" data-end=\"1137\">Synchronization between goroutines<\/li>\n<li data-section-id=\"clxs5o\" data-start=\"1138\" data-end=\"1167\">Avoids shared memory issues<\/li>\n<\/ul>\n<hr data-start=\"1169\" data-end=\"1172\" \/>\n<h2 data-section-id=\"1fbkigt\" data-start=\"1174\" data-end=\"1232\">4. Difference between buffered and unbuffered channels?<\/h2>\n<h3 data-section-id=\"8dnisf\" data-start=\"1234\" data-end=\"1256\">Unbuffered Channel<\/h3>\n<ul data-start=\"1257\" data-end=\"1301\">\n<li data-section-id=\"x90wtq\" data-start=\"1257\" data-end=\"1301\">Sender waits until receiver receives data.<\/li>\n<\/ul>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">ch<\/span> <span class=\"\u037cg\">:=<\/span> make(<span class=\"\u037cg\">chan<\/span> <span class=\"\u037cm\">int<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"k63rok\" data-start=\"1335\" data-end=\"1355\">Buffered Channel<\/h3>\n<ul data-start=\"1356\" data-end=\"1395\">\n<li data-section-id=\"ssz59a\" data-start=\"1356\" data-end=\"1395\">Sender can send until buffer is full.<\/li>\n<\/ul>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">ch<\/span> <span class=\"\u037cg\">:=<\/span> make(<span class=\"\u037cg\">chan<\/span> <span class=\"\u037cm\">int<\/span>, <span class=\"\u037cj\">3<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"1432\" data-end=\"1435\" \/>\n<h2 data-section-id=\"1eg6mkn\" data-start=\"1437\" data-end=\"1502\">5. What is the difference between concurrency and parallelism?<\/h2>\n<h3 data-section-id=\"8wom6b\" data-start=\"1504\" data-end=\"1519\">Concurrency<\/h3>\n<p data-start=\"1520\" data-end=\"1561\">Handling multiple tasks at the same time.<\/p>\n<h3 data-section-id=\"17xxym2\" data-start=\"1563\" data-end=\"1578\">Parallelism<\/h3>\n<p data-start=\"1579\" data-end=\"1639\">Executing multiple tasks simultaneously using multiple CPUs.<\/p>\n<p data-start=\"1641\" data-end=\"1675\">Go supports both using goroutines.<\/p>\n<hr data-start=\"1677\" data-end=\"1680\" \/>\n<h2 data-section-id=\"1x8ekxf\" data-start=\"1682\" data-end=\"1707\">6. What is GOMAXPROCS?<\/h2>\n<p data-start=\"1709\" data-end=\"1793\"><code data-start=\"1709\" data-end=\"1721\">GOMAXPROCS<\/code> sets the maximum number of OS threads executing Go code simultaneously.<\/p>\n<p data-start=\"1795\" data-end=\"1803\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">runtime<\/span><span class=\"\u037cg\">.<\/span>GOMAXPROCS(<span class=\"\u037cj\">4<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"1837\" data-end=\"1840\" \/>\n<h2 data-section-id=\"1sgqujc\" data-start=\"1842\" data-end=\"1872\">7. What are pointers in Go?<\/h2>\n<p data-start=\"1874\" data-end=\"1906\">Pointers store memory addresses.<\/p>\n<p data-start=\"1908\" data-end=\"1916\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">x<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cj\">10<\/span>\r\n<span class=\"\u037cm\">p<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cg\">&amp;<\/span><span class=\"\u037cm\">x<\/span>\r\n\r\n<span class=\"\u037cm\">fmt<\/span><span class=\"\u037cg\">.<\/span>Println(<span class=\"\u037cg\">*<\/span><span class=\"\u037cm\">p<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"hwjehr\" data-start=\"1961\" data-end=\"1971\">Notes:<\/h3>\n<ul data-start=\"1972\" data-end=\"2018\">\n<li data-section-id=\"yo3mtw\" data-start=\"1972\" data-end=\"1994\">Go supports pointers<\/li>\n<li data-section-id=\"1xnfe3m\" data-start=\"1995\" data-end=\"2018\">No pointer arithmetic<\/li>\n<\/ul>\n<hr data-start=\"2020\" data-end=\"2023\" \/>\n<h2 data-section-id=\"tend59\" data-start=\"2025\" data-end=\"2083\"><span role=\"text\">8. What is the difference between <code data-start=\"2062\" data-end=\"2069\">new()<\/code> and <code data-start=\"2074\" data-end=\"2082\">make()<\/code>?<\/span><\/h2>\n<h3 data-section-id=\"1ss4m7v\" data-start=\"2085\" data-end=\"2096\"><span role=\"text\"><code data-start=\"2089\" data-end=\"2096\">new()<\/code><\/span><\/h3>\n<p data-start=\"2097\" data-end=\"2134\">Allocates memory and returns pointer.<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">p<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cm\">new<\/span>(<span class=\"\u037cm\">int<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"13ln9et\" data-start=\"2161\" data-end=\"2173\"><span role=\"text\"><code data-start=\"2165\" data-end=\"2173\">make()<\/code><\/span><\/h3>\n<p data-start=\"2174\" data-end=\"2213\">Initializes slices, maps, and channels.<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">m<\/span> <span class=\"\u037cg\">:=<\/span> make(<span class=\"\u037cg\">map<\/span>[<span class=\"\u037cm\">string<\/span>]<span class=\"\u037cm\">int<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"2252\" data-end=\"2255\" \/>\n<h2 data-section-id=\"1llonzx\" data-start=\"2257\" data-end=\"2285\">9. What are slices in Go?<\/h2>\n<p data-start=\"2287\" data-end=\"2324\">Slices are dynamic views over arrays.<\/p>\n<p data-start=\"2326\" data-end=\"2334\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">nums<\/span> <span class=\"\u037cg\">:=<\/span> []<span class=\"\u037cm\">int<\/span>{<span class=\"\u037cj\">1<\/span>,<span class=\"\u037cj\">2<\/span>,<span class=\"\u037cj\">3<\/span>}<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"q4c1cr\" data-start=\"2367\" data-end=\"2380\">Features:<\/h3>\n<ul data-start=\"2381\" data-end=\"2445\">\n<li data-section-id=\"4dicvs\" data-start=\"2381\" data-end=\"2395\">Dynamic size<\/li>\n<li data-section-id=\"17r3j5f\" data-start=\"2396\" data-end=\"2414\">Backed by arrays<\/li>\n<li data-section-id=\"1o91jfs\" data-start=\"2415\" data-end=\"2445\">Contains length and capacity<\/li>\n<\/ul>\n<hr data-start=\"2447\" data-end=\"2450\" \/>\n<h2 data-section-id=\"1nqze22\" data-start=\"2452\" data-end=\"2494\">10. Difference between array and slice?<\/h2>\n<div class=\"TyagGW_tableContainer\">\n<div class=\"group TyagGW_tableWrapper flex flex-col-reverse w-fit\" tabindex=\"-1\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"2496\" data-end=\"2618\">\n<thead data-start=\"2496\" data-end=\"2513\">\n<tr data-start=\"2496\" data-end=\"2513\">\n<th class=\"last:pe-10\" data-start=\"2496\" data-end=\"2504\" data-col-size=\"sm\">Array<\/th>\n<th class=\"last:pe-10\" data-start=\"2504\" data-end=\"2513\" data-col-size=\"sm\">Slice<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2524\" data-end=\"2618\">\n<tr data-start=\"2524\" data-end=\"2553\">\n<td data-start=\"2524\" data-end=\"2537\" data-col-size=\"sm\">Fixed size<\/td>\n<td data-col-size=\"sm\" data-start=\"2537\" data-end=\"2553\">Dynamic size<\/td>\n<\/tr>\n<tr data-start=\"2554\" data-end=\"2585\">\n<td data-start=\"2554\" data-end=\"2567\" data-col-size=\"sm\">Value type<\/td>\n<td data-col-size=\"sm\" data-start=\"2567\" data-end=\"2585\">Reference-like<\/td>\n<\/tr>\n<tr data-start=\"2586\" data-end=\"2618\">\n<td data-start=\"2586\" data-end=\"2606\" data-col-size=\"sm\">Size part of type<\/td>\n<td data-col-size=\"sm\" data-start=\"2606\" data-end=\"2618\">Flexible<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<hr data-start=\"2620\" data-end=\"2623\" \/>\n<h2 data-section-id=\"ogl4e6\" data-start=\"2625\" data-end=\"2675\">11. What is the difference between len and cap?<\/h2>\n<h3 data-section-id=\"7mne3l\" data-start=\"2677\" data-end=\"2686\"><span role=\"text\"><code data-start=\"2681\" data-end=\"2686\">len<\/code><\/span><\/h3>\n<p data-start=\"2687\" data-end=\"2714\">Current number of elements.<\/p>\n<h3 data-section-id=\"7mf11w\" data-start=\"2716\" data-end=\"2725\"><span role=\"text\"><code data-start=\"2720\" data-end=\"2725\">cap<\/code><\/span><\/h3>\n<p data-start=\"2726\" data-end=\"2763\">Maximum capacity before reallocation.<\/p>\n<p data-start=\"2765\" data-end=\"2773\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">s<\/span> <span class=\"\u037cg\">:=<\/span> make([]<span class=\"\u037cm\">int<\/span>, <span class=\"\u037cj\">3<\/span>, <span class=\"\u037cj\">5<\/span>)\r\n\r\n<span class=\"\u037cm\">fmt<\/span><span class=\"\u037cg\">.<\/span>Println(<span class=\"\u037cm\">len<\/span>(<span class=\"\u037cm\">s<\/span>)) <span class=\"\u037ce\">\/\/ 3<\/span>\r\n<span class=\"\u037cm\">fmt<\/span><span class=\"\u037cg\">.<\/span>Println(<span class=\"\u037cm\">cap<\/span>(<span class=\"\u037cm\">s<\/span>)) <span class=\"\u037ce\">\/\/ 5<\/span><\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"2859\" data-end=\"2862\" \/>\n<h2 data-section-id=\"1s0oe2a\" data-start=\"2864\" data-end=\"2897\">12. What are interfaces in Go?<\/h2>\n<p data-start=\"2899\" data-end=\"2926\">Interfaces define behavior.<\/p>\n<p data-start=\"2928\" data-end=\"2936\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">type<\/span> <span class=\"\u037cm\">Animal<\/span> <span class=\"\u037cg\">interface<\/span> {\r\n    Speak()\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"de09ru\" data-start=\"2986\" data-end=\"3000\">Important:<\/h3>\n<ul data-start=\"3001\" data-end=\"3052\">\n<li data-section-id=\"7v32k5\" data-start=\"3001\" data-end=\"3026\">Implicit implementation<\/li>\n<li data-section-id=\"1ihqgvg\" data-start=\"3027\" data-end=\"3052\">No <code data-start=\"3032\" data-end=\"3044\">implements<\/code> keyword<\/li>\n<\/ul>\n<hr data-start=\"3054\" data-end=\"3057\" \/>\n<h2 data-section-id=\"1p4gid5\" data-start=\"3059\" data-end=\"3093\">13. What is an empty interface?<\/h2>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">interface<\/span>{}<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"3118\" data-end=\"3149\">It can hold values of any type.<\/p>\n<p data-start=\"3151\" data-end=\"3165\">Equivalent to:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">any<\/span><\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"3181\" data-end=\"3184\" \/>\n<h2 data-section-id=\"14xous3\" data-start=\"3186\" data-end=\"3216\">14. What is type assertion?<\/h2>\n<p data-start=\"3218\" data-end=\"3264\">Used to extract concrete value from interface.<\/p>\n<p data-start=\"3266\" data-end=\"3274\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">var<\/span> <span class=\"\u037cm\">i<\/span> <span class=\"\u037cg\">interface<\/span>{} <span class=\"\u037cg\">=<\/span> <span class=\"\u037ck\">\"hello\"<\/span>\r\n\r\n<span class=\"\u037cm\">s<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cm\">i<\/span><span class=\"\u037cg\">.<\/span>(<span class=\"\u037cm\">string<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"3331\" data-end=\"3346\">Safe assertion:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">s<\/span>, <span class=\"\u037cm\">ok<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cm\">i<\/span><span class=\"\u037cg\">.<\/span>(<span class=\"\u037cm\">string<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"3378\" data-end=\"3381\" \/>\n<h2 data-section-id=\"13pg4mu\" data-start=\"3383\" data-end=\"3407\">15. What is a struct?<\/h2>\n<p data-start=\"3409\" data-end=\"3443\">Structs group related data fields.<\/p>\n<p data-start=\"3445\" data-end=\"3453\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">type<\/span> <span class=\"\u037cm\">User<\/span> <span class=\"\u037cg\">struct<\/span> {\r\n    Name <span class=\"\u037cm\">string<\/span>\r\n    Age  <span class=\"\u037cm\">int<\/span>\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"3515\" data-end=\"3518\" \/>\n<h2 data-section-id=\"1ntig5h\" data-start=\"3520\" data-end=\"3555\">16. Does Go support inheritance?<\/h2>\n<p data-start=\"3557\" data-end=\"3599\">Go does not support classical inheritance.<\/p>\n<p data-start=\"3601\" data-end=\"3618\">Instead, it uses:<\/p>\n<ul data-start=\"3619\" data-end=\"3644\">\n<li data-section-id=\"mbgkwg\" data-start=\"3619\" data-end=\"3632\">Composition<\/li>\n<li data-section-id=\"1mqmdyf\" data-start=\"3633\" data-end=\"3644\">Embedding<\/li>\n<\/ul>\n<p data-start=\"3646\" data-end=\"3654\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">type<\/span> <span class=\"\u037cm\">Engine<\/span> <span class=\"\u037cg\">struct<\/span> {}\r\n\r\n<span class=\"\u037cg\">type<\/span> <span class=\"\u037cm\">Car<\/span> <span class=\"\u037cg\">struct<\/span> {\r\n    <span class=\"\u037cm\">Engine<\/span>\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"3720\" data-end=\"3723\" \/>\n<h2 data-section-id=\"1ecwzpe\" data-start=\"3725\" data-end=\"3756\">17. What is embedding in Go?<\/h2>\n<p data-start=\"3758\" data-end=\"3821\">Embedding allows one struct to include another struct directly.<\/p>\n<p data-start=\"3823\" data-end=\"3864\">It promotes composition over inheritance.<\/p>\n<hr data-start=\"3866\" data-end=\"3869\" \/>\n<h2 data-section-id=\"1sgtr1\" data-start=\"3871\" data-end=\"3892\">18. What is defer?<\/h2>\n<p data-start=\"3894\" data-end=\"3954\"><code data-start=\"3894\" data-end=\"3901\">defer<\/code> delays execution until surrounding function returns.<\/p>\n<p data-start=\"3956\" data-end=\"3964\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">defer<\/span> <span class=\"\u037cm\">fmt<\/span><span class=\"\u037cg\">.<\/span>Println(<span class=\"\u037ck\">\"done\"<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"x1xdxd\" data-start=\"4002\" data-end=\"4018\">Common uses:<\/h3>\n<ul data-start=\"4019\" data-end=\"4070\">\n<li data-section-id=\"198lh8u\" data-start=\"4019\" data-end=\"4034\">Closing files<\/li>\n<li data-section-id=\"1yov3q7\" data-start=\"4035\" data-end=\"4054\">Unlocking mutexes<\/li>\n<li data-section-id=\"1hdlbjq\" data-start=\"4055\" data-end=\"4070\">Cleanup tasks<\/li>\n<\/ul>\n<hr data-start=\"4072\" data-end=\"4075\" \/>\n<h2 data-section-id=\"ghtqso\" data-start=\"4077\" data-end=\"4110\">19. What is panic and recover?<\/h2>\n<h3 data-section-id=\"7xu67n\" data-start=\"4112\" data-end=\"4121\">panic<\/h3>\n<p data-start=\"4122\" data-end=\"4145\">Stops normal execution.<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">panic<\/span>(<span class=\"\u037ck\">\"error\"<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"1tvowpo\" data-start=\"4173\" data-end=\"4184\">recover<\/h3>\n<p data-start=\"4185\" data-end=\"4225\">Catches panic inside deferred functions.<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">defer<\/span> <span class=\"\u037cg\">func<\/span>() {\r\n    <span class=\"\u037cm\">recover<\/span>()\r\n}()<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"4271\" data-end=\"4274\" \/>\n<h2 data-section-id=\"stkdyi\" data-start=\"4276\" data-end=\"4316\">20. What is garbage collection in Go?<\/h2>\n<p data-start=\"4318\" data-end=\"4380\">Go automatically frees unused memory using garbage collection.<\/p>\n<p data-start=\"4382\" data-end=\"4391\">Benefits:<\/p>\n<ul data-start=\"4392\" data-end=\"4441\">\n<li data-section-id=\"ix5cay\" data-start=\"4392\" data-end=\"4414\">Reduces memory leaks<\/li>\n<li data-section-id=\"1ly21v7\" data-start=\"4415\" data-end=\"4441\">Easier memory management<\/li>\n<\/ul>\n<hr data-start=\"4443\" data-end=\"4446\" \/>\n<h2 data-section-id=\"1xwi14n\" data-start=\"4448\" data-end=\"4471\">21. What is a mutex?<\/h2>\n<p data-start=\"4473\" data-end=\"4504\">Mutex prevents race conditions.<\/p>\n<p data-start=\"4506\" data-end=\"4514\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">var<\/span> <span class=\"\u037cm\">mu<\/span> <span class=\"\u037cm\">sync<\/span><span class=\"\u037cg\">.<\/span><span class=\"\u037cm\">Mutex<\/span>\r\n\r\n<span class=\"\u037cm\">mu<\/span><span class=\"\u037cg\">.<\/span>Lock()\r\n<span class=\"\u037cm\">counter<\/span><span class=\"\u037cg\">++<\/span>\r\n<span class=\"\u037cm\">mu<\/span><span class=\"\u037cg\">.<\/span>Unlock()<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"4577\" data-end=\"4580\" \/>\n<h2 data-section-id=\"1ce2htv\" data-start=\"4582\" data-end=\"4614\">22. What is a race condition?<\/h2>\n<p data-start=\"4616\" data-end=\"4703\">When multiple goroutines access shared data simultaneously causing unexpected behavior.<\/p>\n<p data-start=\"4705\" data-end=\"4731\">Go provides race detector:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code>go run <span class=\"\u037cn\">-race<\/span> main.go<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"4766\" data-end=\"4769\" \/>\n<h2 data-section-id=\"18hfdvg\" data-start=\"4771\" data-end=\"4811\">23. What is context package used for?<\/h2>\n<p data-start=\"4813\" data-end=\"4847\">The <code data-start=\"4817\" data-end=\"4826\">context<\/code> package is used for:<\/p>\n<ul data-start=\"4848\" data-end=\"4905\">\n<li data-section-id=\"y9qybj\" data-start=\"4848\" data-end=\"4862\">Cancellation<\/li>\n<li data-section-id=\"cdezk0\" data-start=\"4863\" data-end=\"4873\">Timeouts<\/li>\n<li data-section-id=\"7s9wmr\" data-start=\"4874\" data-end=\"4905\">Passing request-scoped values<\/li>\n<\/ul>\n<p data-start=\"4907\" data-end=\"4915\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">ctx<\/span>, <span class=\"\u037cm\">cancel<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cm\">context<\/span><span class=\"\u037cg\">.<\/span>WithTimeout(<span class=\"\u037cm\">context<\/span><span class=\"\u037cg\">.<\/span>Background(), <span class=\"\u037cm\">time<\/span><span class=\"\u037cg\">.<\/span>Second)\r\n<span class=\"\u037cg\">defer<\/span> <span class=\"\u037cm\">cancel<\/span>()<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"5012\" data-end=\"5015\" \/>\n<h2 data-section-id=\"10var3j\" data-start=\"5017\" data-end=\"5049\">24. What is select statement?<\/h2>\n<p data-start=\"5051\" data-end=\"5089\"><code data-start=\"5051\" data-end=\"5059\">select<\/code> works with multiple channels.<\/p>\n<p data-start=\"5091\" data-end=\"5099\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">select<\/span> {\r\n<span class=\"\u037cg\">case<\/span> <span class=\"\u037cm\">msg<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cg\">&lt;-<\/span><span class=\"\u037cm\">ch1<\/span>:\r\n    <span class=\"\u037cm\">fmt<\/span><span class=\"\u037cg\">.<\/span>Println(<span class=\"\u037cm\">msg<\/span>)\r\n<span class=\"\u037cg\">case<\/span> <span class=\"\u037cg\">&lt;-<\/span><span class=\"\u037cm\">time<\/span><span class=\"\u037cg\">.<\/span>After(<span class=\"\u037cm\">time<\/span><span class=\"\u037cg\">.<\/span>Second):\r\n    <span class=\"\u037cm\">fmt<\/span><span class=\"\u037cg\">.<\/span>Println(<span class=\"\u037ck\">\"timeout\"<\/span>)\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"5221\" data-end=\"5224\" \/>\n<h2 data-section-id=\"1p8pzzd\" data-start=\"5226\" data-end=\"5257\">25. What are packages in Go?<\/h2>\n<p data-start=\"5259\" data-end=\"5291\">Packages organize reusable code.<\/p>\n<p data-start=\"5293\" data-end=\"5319\">Every Go file starts with:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">package<\/span> <span class=\"\u037cm\">main<\/span><\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"5344\" data-end=\"5347\" \/>\n<h2 data-section-id=\"td8p2b\" data-start=\"5349\" data-end=\"5394\">26. Difference between process and thread?<\/h2>\n<div class=\"TyagGW_tableContainer\">\n<div class=\"group TyagGW_tableWrapper flex flex-col-reverse w-fit\" tabindex=\"-1\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"5396\" data-end=\"5566\">\n<thead data-start=\"5396\" data-end=\"5416\">\n<tr data-start=\"5396\" data-end=\"5416\">\n<th class=\"last:pe-10\" data-start=\"5396\" data-end=\"5406\" data-col-size=\"sm\">Process<\/th>\n<th class=\"last:pe-10\" data-start=\"5406\" data-end=\"5416\" data-col-size=\"sm\">Thread<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"5427\" data-end=\"5566\">\n<tr data-start=\"5427\" data-end=\"5486\">\n<td data-start=\"5427\" data-end=\"5456\" data-col-size=\"sm\">Independent execution unit<\/td>\n<td data-col-size=\"sm\" data-start=\"5456\" data-end=\"5486\">Lightweight execution path<\/td>\n<\/tr>\n<tr data-start=\"5487\" data-end=\"5516\">\n<td data-start=\"5487\" data-end=\"5501\" data-col-size=\"sm\">More memory<\/td>\n<td data-start=\"5501\" data-end=\"5516\" data-col-size=\"sm\">Less memory<\/td>\n<\/tr>\n<tr data-start=\"5517\" data-end=\"5566\">\n<td data-start=\"5517\" data-end=\"5541\" data-col-size=\"sm\">Slower context switch<\/td>\n<td data-start=\"5541\" data-end=\"5566\" data-col-size=\"sm\">Faster context switch<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p data-start=\"5568\" data-end=\"5604\">Goroutines are lighter than threads.<\/p>\n<hr data-start=\"5606\" data-end=\"5609\" \/>\n<h2 data-section-id=\"1mib7fx\" data-start=\"5611\" data-end=\"5638\">27. What are maps in Go?<\/h2>\n<p data-start=\"5640\" data-end=\"5667\">Maps store key-value pairs.<\/p>\n<p data-start=\"5669\" data-end=\"5677\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">m<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cg\">map<\/span>[<span class=\"\u037cm\">string<\/span>]<span class=\"\u037cm\">int<\/span>{\r\n    <span class=\"\u037ck\">\"a\"<\/span>: <span class=\"\u037cj\">1<\/span>,\r\n}<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"5724\" data-end=\"5740\">Check existence:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">v<\/span>, <span class=\"\u037cm\">ok<\/span> <span class=\"\u037cg\">:=<\/span> <span class=\"\u037cm\">m<\/span>[<span class=\"\u037ck\">\"a\"<\/span>]<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"5768\" data-end=\"5771\" \/>\n<h2 data-section-id=\"9q99t5\" data-start=\"5773\" data-end=\"5820\">28. Can Go functions return multiple values?<\/h2>\n<p data-start=\"5822\" data-end=\"5826\">Yes.<\/p>\n<p data-start=\"5828\" data-end=\"5836\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">func<\/span> <span class=\"\u037cm\">divide<\/span>(<span class=\"\u037cm\">a<\/span>, <span class=\"\u037cm\">b<\/span> <span class=\"\u037cm\">int<\/span>) (<span class=\"\u037cm\">int<\/span>, <span class=\"\u037cm\">error<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"5883\" data-end=\"5886\" \/>\n<h2 data-section-id=\"vbabox\" data-start=\"5888\" data-end=\"5923\">29. What are variadic functions?<\/h2>\n<p data-start=\"5925\" data-end=\"5964\">Functions accepting variable arguments.<\/p>\n<p data-start=\"5966\" data-end=\"5974\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">func<\/span> <span class=\"\u037cm\">sum<\/span>(<span class=\"\u037cm\">nums<\/span> ...<span class=\"\u037cm\">int<\/span>)<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"6008\" data-end=\"6011\" \/>\n<h2 data-section-id=\"1k3lmpg\" data-start=\"6013\" data-end=\"6056\">30. What is dependency management in Go?<\/h2>\n<p data-start=\"6058\" data-end=\"6074\">Go uses modules.<\/p>\n<p data-start=\"6076\" data-end=\"6087\">Initialize:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code>go mod init app<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"6117\" data-end=\"6133\">Install package:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code>go <span class=\"\u037cl\">get<\/span> package-name<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"6167\" data-end=\"6170\" \/>\n<h1 data-section-id=\"17rt2yo\" data-start=\"6172\" data-end=\"6209\">Advanced Golang Interview Questions<\/h1>\n<h2 data-section-id=\"19ivzqw\" data-start=\"6211\" data-end=\"6242\">31. Explain scheduler in Go.<\/h2>\n<p data-start=\"6244\" data-end=\"6282\">Go scheduler manages goroutines using:<\/p>\n<ul data-start=\"6283\" data-end=\"6330\">\n<li data-section-id=\"1lfyusr\" data-start=\"6283\" data-end=\"6298\">G \u2192 Goroutine<\/li>\n<li data-section-id=\"1sp92n9\" data-start=\"6299\" data-end=\"6314\">M \u2192 OS Thread<\/li>\n<li data-section-id=\"b039ng\" data-start=\"6315\" data-end=\"6330\">P \u2192 Processor<\/li>\n<\/ul>\n<p data-start=\"6332\" data-end=\"6351\">Known as GMP model.<\/p>\n<hr data-start=\"6353\" data-end=\"6356\" \/>\n<h2 data-section-id=\"e43jc9\" data-start=\"6358\" data-end=\"6390\">32. What is channel deadlock?<\/h2>\n<p data-start=\"6392\" data-end=\"6428\">Occurs when goroutines wait forever.<\/p>\n<p data-start=\"6430\" data-end=\"6438\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">ch<\/span> <span class=\"\u037cg\">:=<\/span> make(<span class=\"\u037cg\">chan<\/span> <span class=\"\u037cm\">int<\/span>)\r\n<span class=\"\u037cm\">ch<\/span> <span class=\"\u037cg\">&lt;-<\/span> <span class=\"\u037cj\">1<\/span> <span class=\"\u037ce\">\/\/ deadlock<\/span><\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"6491\" data-end=\"6494\" \/>\n<h2 data-section-id=\"t93p21\" data-start=\"6496\" data-end=\"6526\">33. What is sync.WaitGroup?<\/h2>\n<p data-start=\"6528\" data-end=\"6559\">Waits for goroutines to finish.<\/p>\n<p data-start=\"6561\" data-end=\"6569\">Example:<\/p>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">var<\/span> <span class=\"\u037cm\">wg<\/span> <span class=\"\u037cm\">sync<\/span><span class=\"\u037cg\">.<\/span><span class=\"\u037cm\">WaitGroup<\/span>\r\n\r\n<span class=\"\u037cm\">wg<\/span><span class=\"\u037cg\">.<\/span>Add(<span class=\"\u037cj\">1<\/span>)\r\n\r\n<span class=\"\u037cg\">go<\/span> <span class=\"\u037cg\">func<\/span>() {\r\n    <span class=\"\u037cg\">defer<\/span> <span class=\"\u037cm\">wg<\/span><span class=\"\u037cg\">.<\/span>Done()\r\n}()\r\n\r\n<span class=\"\u037cm\">wg<\/span><span class=\"\u037cg\">.<\/span>Wait()<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"6662\" data-end=\"6665\" \/>\n<h2 data-section-id=\"m1zk9l\" data-start=\"6667\" data-end=\"6702\">34. What are worker pools in Go?<\/h2>\n<p data-start=\"6704\" data-end=\"6774\">Pattern for limiting concurrent goroutines using channels and workers.<\/p>\n<p data-start=\"6776\" data-end=\"6786\">Common in:<\/p>\n<ul data-start=\"6787\" data-end=\"6829\">\n<li data-section-id=\"1j42c77\" data-start=\"6787\" data-end=\"6793\">APIs<\/li>\n<li data-section-id=\"66ew9w\" data-start=\"6794\" data-end=\"6810\">Job processing<\/li>\n<li data-section-id=\"hfwuuw\" data-start=\"6811\" data-end=\"6829\">Background tasks<\/li>\n<\/ul>\n<hr data-start=\"6831\" data-end=\"6834\" \/>\n<h2 data-section-id=\"v0xu37\" data-start=\"6836\" data-end=\"6900\">35. What is the difference between nil slice and empty slice?<\/h2>\n<h3 data-section-id=\"1j5ch25\" data-start=\"6902\" data-end=\"6915\">Nil slice<\/h3>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cg\">var<\/span> <span class=\"\u037cm\">s<\/span> []<span class=\"\u037cm\">int<\/span><\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-section-id=\"wjc0eb\" data-start=\"6939\" data-end=\"6954\">Empty slice<\/h3>\n<div class=\"relative w-full mt-4 mb-1\">\n<div class=\"\">\n<div class=\"relative\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"h-full min-h-0 min-w-0\">\n<div class=\"border border-token-border-light border-radius-3xl corner-superellipse\/1.1 rounded-3xl\">\n<div class=\"h-full w-full border-radius-3xl bg-token-bg-elevated-secondary corner-superellipse\/1.1 overflow-clip rounded-3xl lxnfua_clipPathFallback\">\n<div class=\"pointer-events-none absolute inset-x-4 top-12 bottom-4\">\n<div class=\"pointer-events-none sticky z-40 shrink-0 z-1!\">\n<div class=\"sticky bg-token-border-light\"><\/div>\n<\/div>\n<\/div>\n<div class=\"relative\">\n<div class=\"\">\n<div class=\"relative z-0 flex max-w-full\">\n<div id=\"code-block-viewer\" class=\"q9tKkq_viewer cm-editor z-10 light:cm-light dark:cm-light flex h-full w-full flex-col items-stretch \u037cd \u037cr\" dir=\"ltr\">\n<div class=\"cm-scroller\">\n<pre class=\"cm-content q9tKkq_readonly m-0\"><code><span class=\"\u037cm\">s<\/span> <span class=\"\u037cg\">:=<\/span> []<span class=\"\u037cm\">int<\/span>{}<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"\">\n<div class=\"\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"6979\" data-end=\"7026\">Both have length 0, but nil slice equals <code data-start=\"7020\" data-end=\"7025\">nil<\/code>.<\/p>\n<hr data-start=\"7028\" data-end=\"7031\" \/>\n<h2 data-section-id=\"kapkxr\" data-start=\"7033\" data-end=\"7077\">36. What are common Go design principles?<\/h2>\n<ul data-start=\"7079\" data-end=\"7175\">\n<li data-section-id=\"1nnygfh\" data-start=\"7079\" data-end=\"7091\">Simplicity<\/li>\n<li data-section-id=\"1dytcvm\" data-start=\"7092\" data-end=\"7122\">Composition over inheritance<\/li>\n<li data-section-id=\"117bsdl\" data-start=\"7123\" data-end=\"7148\">Explicit error handling<\/li>\n<li data-section-id=\"jc1fvs\" data-start=\"7149\" data-end=\"7175\">Concurrency-first design<\/li>\n<\/ul>\n<hr data-start=\"7177\" data-end=\"7180\" \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. What is Go and why is it popular? Go is an open-source programming language developed by Google. It is designed for simplicity, concurrency, fast compilation, and scalability. Key advantages: Simple syntax Fast execution Built-in concurrency (goroutines) Garbage collection Strong standard library Great for microservices and cloud systems 2. What are goroutines? Goroutines are lightweight&#8230;<\/p>\n","protected":false},"author":1,"featured_media":27,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[11,12],"class_list":["post-13","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interview","tag-go-lang","tag-interview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go Lang Interview Questions and Answers 2026 - Smita Bharat Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go Lang Interview Questions and Answers 2026 - Smita Bharat Blog\" \/>\n<meta property=\"og:description\" content=\"1. What is Go and why is it popular? Go is an open-source programming language developed by Google. It is designed for simplicity, concurrency, fast compilation, and scalability. Key advantages: Simple syntax Fast execution Built-in concurrency (goroutines) Garbage collection Strong standard library Great for microservices and cloud systems 2. What are goroutines? Goroutines are lightweight...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/\" \/>\n<meta property=\"og:site_name\" content=\"Smita Bharat Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-05-17T11:43:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-05-17T12:39:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/05\/Go-Logo_LightBlue.png\" \/>\n\t<meta property=\"og:image:width\" content=\"886\" \/>\n\t<meta property=\"og:image:height\" content=\"388\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Smita\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smita\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/\"},\"author\":{\"name\":\"Smita\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d82457aaa3ced63e3f875cb5a31ce4c\"},\"headline\":\"Go Lang Interview Questions and Answers 2026\",\"datePublished\":\"2026-05-17T11:43:34+00:00\",\"dateModified\":\"2026-05-17T12:39:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/\"},\"wordCount\":642,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/Go-Logo_LightBlue.png\",\"keywords\":[\"Go Lang\",\"Interview\"],\"articleSection\":[\"Interview\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/\",\"name\":\"Go Lang Interview Questions and Answers 2026 - Smita Bharat Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/Go-Logo_LightBlue.png\",\"datePublished\":\"2026-05-17T11:43:34+00:00\",\"dateModified\":\"2026-05-17T12:39:45+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d82457aaa3ced63e3f875cb5a31ce4c\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/#primaryimage\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/Go-Logo_LightBlue.png\",\"contentUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/Go-Logo_LightBlue.png\",\"width\":886,\"height\":388},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-lang-interview-questions-and-answers-2026\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go Lang Interview Questions and Answers 2026\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\",\"name\":\"Smita Bharat Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d82457aaa3ced63e3f875cb5a31ce4c\",\"name\":\"Smita\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c2cc9a654a17e3944ea74c7317b81fa65c28ba7d50a629a551b0c9b321308883?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c2cc9a654a17e3944ea74c7317b81fa65c28ba7d50a629a551b0c9b321308883?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c2cc9a654a17e3944ea74c7317b81fa65c28ba7d50a629a551b0c9b321308883?s=96&d=mm&r=g\",\"caption\":\"Smita\"},\"sameAs\":[\"https:\\\/\\\/smitabharat.com\\\/blog\"],\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/author\\\/smita_bharat_wp\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go Lang Interview Questions and Answers 2026 - Smita Bharat Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/","og_locale":"en_US","og_type":"article","og_title":"Go Lang Interview Questions and Answers 2026 - Smita Bharat Blog","og_description":"1. What is Go and why is it popular? Go is an open-source programming language developed by Google. It is designed for simplicity, concurrency, fast compilation, and scalability. Key advantages: Simple syntax Fast execution Built-in concurrency (goroutines) Garbage collection Strong standard library Great for microservices and cloud systems 2. What are goroutines? Goroutines are lightweight...","og_url":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/","og_site_name":"Smita Bharat Blog","article_published_time":"2026-05-17T11:43:34+00:00","article_modified_time":"2026-05-17T12:39:45+00:00","og_image":[{"width":886,"height":388,"url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/05\/Go-Logo_LightBlue.png","type":"image\/png"}],"author":"Smita","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smita","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/#article","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/"},"author":{"name":"Smita","@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/8d82457aaa3ced63e3f875cb5a31ce4c"},"headline":"Go Lang Interview Questions and Answers 2026","datePublished":"2026-05-17T11:43:34+00:00","dateModified":"2026-05-17T12:39:45+00:00","mainEntityOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/"},"wordCount":642,"commentCount":0,"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/05\/Go-Logo_LightBlue.png","keywords":["Go Lang","Interview"],"articleSection":["Interview"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/","url":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/","name":"Go Lang Interview Questions and Answers 2026 - Smita Bharat Blog","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/#primaryimage"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/05\/Go-Logo_LightBlue.png","datePublished":"2026-05-17T11:43:34+00:00","dateModified":"2026-05-17T12:39:45+00:00","author":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/8d82457aaa3ced63e3f875cb5a31ce4c"},"breadcrumb":{"@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/#primaryimage","url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/05\/Go-Logo_LightBlue.png","contentUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/05\/Go-Logo_LightBlue.png","width":886,"height":388},{"@type":"BreadcrumbList","@id":"https:\/\/smitabharat.com\/blog\/go-lang-interview-questions-and-answers-2026\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smitabharat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Go Lang Interview Questions and Answers 2026"}]},{"@type":"WebSite","@id":"https:\/\/smitabharat.com\/blog\/#website","url":"https:\/\/smitabharat.com\/blog\/","name":"Smita Bharat Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smitabharat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/8d82457aaa3ced63e3f875cb5a31ce4c","name":"Smita","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c2cc9a654a17e3944ea74c7317b81fa65c28ba7d50a629a551b0c9b321308883?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c2cc9a654a17e3944ea74c7317b81fa65c28ba7d50a629a551b0c9b321308883?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c2cc9a654a17e3944ea74c7317b81fa65c28ba7d50a629a551b0c9b321308883?s=96&d=mm&r=g","caption":"Smita"},"sameAs":["https:\/\/smitabharat.com\/blog"],"url":"https:\/\/smitabharat.com\/blog\/author\/smita_bharat_wp\/"}]}},"jetpack_featured_media_url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/05\/Go-Logo_LightBlue.png","_links":{"self":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":2,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":24,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/13\/revisions\/24"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media\/27"}],"wp:attachment":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}