{"id":619,"date":"2026-09-28T09:00:00","date_gmt":"2026-09-28T03:30:00","guid":{"rendered":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/"},"modified":"2026-11-29T01:29:54","modified_gmt":"2026-11-28T19:59:54","slug":"go-tricky-output-questions-part-27","status":"publish","type":"post","link":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/","title":{"rendered":"Go Tricky Output Questions: Predict the Result (Part 27)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">These Go tricky output questions ask you to predict what a short piece of code prints, then explain why. They cover constants, overflow, strings, slices, maps, defer, closures, interfaces, channels and errors. We gathered them from public interview lists and coding rounds, then rewrote each one in our own words.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This post is questions only, so answer first and run the code second. When you need help, read <a href=\"https:\/\/smitabharat.com\/blog\/go-slices-arrays-explained\/\">Go slices and arrays<\/a>, <a href=\"https:\/\/smitabharat.com\/blog\/go-defer-panic-recover\/\">Go panic and recover with defer<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-closures-anonymous-functions\/\">Go closures<\/a>. Also, finish <a href=\"https:\/\/smitabharat.com\/blog\/go-architecture-interview-questions-part-26\/\">Part 26 on design<\/a> first, since this part is pure revision.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Use These Go Tricky Output Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Read each of these Go tricky output questions, write your guess on paper, then run the snippet in a scratch file. The goal is not to memorise answers but to explain the rule behind each result. Finally, keep a list of the ones you got wrong and revisit them before every interview.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The table below lists each section and its number of questions.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Section<\/th><th>What it tests<\/th><th>Questions<\/th><\/tr><\/thead><tbody><tr><td>Types and constants<\/td><td>Math, overflow and iota<\/td><td>15<\/td><\/tr><tr><td>Strings, slices and maps<\/td><td>Bytes, runes, append and maps<\/td><td>16<\/td><\/tr><tr><td>Functions and defer<\/td><td>Defer order, closures and recover<\/td><td>15<\/td><\/tr><tr><td>Structs and interfaces<\/td><td>Receivers, embedding and nil<\/td><td>15<\/td><\/tr><tr><td>Goroutines and channels<\/td><td>Main exit, select and closed channels<\/td><td>15<\/td><\/tr><tr><td>Errors and builtins<\/td><td>Wrapping, min, clear and copy<\/td><td>13<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-1-1024x640.png\" alt=\"Go Tricky Output Questions diagram showing six areas where Go output surprises people\" class=\"wp-image-602\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-1-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-1-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-1-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-1-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-1-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The six areas where Go output most often surprises people in interviews.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Go Tricky Output Questions on Types and Constants<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-variables-constants-data-types\/\">Go variables, constants and data types<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-operators-examples\/\">Go operators<\/a>. These Go tricky output questions test integer math, overflow and untyped constants.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>What does fmt.Println(7 \/ 2, 7.0 \/ 2, 7 % -3) print, and why?<\/li>\n\n\n<li>Predict the output of fmt.Println(-7 \/ 2, -7 % 2).<\/li>\n\n\n<li>After var x uint8 = 255 and then x++, what is the value of x?<\/li>\n\n\n<li>Given const big = 1 &lt;&lt; 62, what does fmt.Println(big &gt;&gt; 60) print?<\/li>\n\n\n<li>Why does a, b := 0.1, 0.2 followed by fmt.Println(a+b == 0.3) print false?<\/li>\n\n\n<li>Why does fmt.Println(0.1+0.2 == 0.3) print true when the line above prints false?<\/li>\n\n\n<li>What happens when you use iota outside a const block?<\/li>\n\n\n<li>In const ( A = iota * 10; B; C ), what are the values of B and C?<\/li>\n\n\n<li>In const ( X = iota; _; Y ), which value does Y get?<\/li>\n\n\n<li>What type does fmt.Printf(&#8220;%T&#8221;, &#8216;a&#8217;) print?<\/li>\n\n\n<li>Why does len(&#8220;h\u00e9llo&#8221;) return 6 instead of 5?<\/li>\n\n\n<li>After x := 5 and then x, y := 6, 7 in the same scope, what is x, and why does it compile?<\/li>\n\n\n<li>What happens when you compile fmt.Println(math.MaxInt64 + 1)?<\/li>\n\n\n<li>Scenario: when a cart total of 0.1 plus 0.2 fails an equality test, what would you change in the code?<\/li>\n\n\n<li>Scenario: when a uint8 counter shows 0 after the 256th event, what happened, and how would you fix it?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Tricky Output Questions on Strings, Slices and Maps<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-strings-examples\/\">Go strings<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-maps-examples\/\">Go maps<\/a>. Shared arrays cause most surprises here, so these Go tricky output questions watch length and capacity closely.<\/p>\n\n\n\n<ol start=\"16\" class=\"wp-block-list\">\n<li>What happens when you write s := &#8220;go&#8221; and then s[0] = &#8216;G&#8217;?<\/li>\n\n\n<li>Predict the output of fmt.Println(string(rune(65)), string(byte(97))).<\/li>\n\n\n<li>Which index values does for i := range &#8220;h\u00e9llo&#8221; produce?<\/li>\n\n\n<li>How many elements does strings.Split(&#8220;a,b,&#8221;, &#8220;,&#8221;) return, and what is the last one?<\/li>\n\n\n<li>After var s []int, what does fmt.Println(s == nil, len(s), s) print?<\/li>\n\n\n<li>Is s := []int{} equal to nil, and why does that matter for JSON?<\/li>\n\n\n<li>After a := [3]int{1, 2, 3}, b := a and b[0] = 9, what is a[0]?<\/li>\n\n\n<li>After s := []int{1, 2, 3}, t := s and t[0] = 9, what is s[0]?<\/li>\n\n\n<li>What does s := make([]int, 3) followed by s = append(s, 1) print?<\/li>\n\n\n<li>Given s := []int{1, 2, 3, 4, 5} and t := s[1:3], what are len(t) and cap(t)?<\/li>\n\n\n<li>How does the full slice expression s[1:3:3] change what a later append does?<\/li>\n\n\n<li>When you read m[&#8220;missing&#8221;] from a map[string]int, what value comes back?<\/li>\n\n\n<li>Can you write to a nil map, and what message appears if you try?<\/li>\n\n\n<li>Why does fmt.Println on a map show sorted keys, while a range loop does not?<\/li>\n\n\n<li>Scenario: when a function appends to its slice argument but the caller never sees the new item, what is happening?<\/li>\n\n\n<li>Scenario: when two slices taken from one array start changing each other, how would you separate them?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Tricky Output Questions on Functions and Defer<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-functions-beginners-guide\/\">Go functions<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-defer-panic-recover\/\">Go panic and recover with defer<\/a>. Defer and closures look simple, yet these Go tricky output questions trip up many experienced developers.<\/p>\n\n\n\n<ol start=\"32\" class=\"wp-block-list\">\n<li>In what order do three defer statements in one function run?<\/li>\n\n\n<li>When does defer fmt.Println(x) read the value of x?<\/li>\n\n\n<li>If a deferred closure reads x and x changes after the defer line, which value prints?<\/li>\n\n\n<li>With a named result n, what does return 5 give when a deferred func runs n++?<\/li>\n\n\n<li>Does a deferred func that changes a local variable affect an unnamed return value?<\/li>\n\n\n<li>Before Go 1.22, what did three closures that print the loop variable i print, and what changed after?<\/li>\n\n\n<li>A closure increments a captured counter x that starts at 0, so what do three calls return?<\/li>\n\n\n<li>What does recover return when you call it directly instead of inside a deferred function?<\/li>\n\n\n<li>What happens to pending defers when main calls os.Exit(1)?<\/li>\n\n\n<li>Can you compare two function values with ==, and what does the compiler allow?<\/li>\n\n\n<li>Inside func f(args &#8230;int), what are len(args) and args == nil when you call f()?<\/li>\n\n\n<li>What happens when you call a function variable that is nil?<\/li>\n\n\n<li>If a deferred function panics while another panic is running, what does the crash report show?<\/li>\n\n\n<li>Scenario: when a loop with defer f.Close() runs out of file handles, what went wrong?<\/li>\n\n\n<li>Scenario: when a deferred log line prints an old value of a variable, how would you print the final value?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Tricky Output Questions on Structs and Interfaces<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-interfaces-examples\/\">Go interfaces<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-methods-receivers\/\">Go methods and receivers<\/a>. These Go tricky output questions test copies, method sets and the typed nil trap.<\/p>\n\n\n\n<ol start=\"47\" class=\"wp-block-list\">\n<li>What does fmt.Println(struct{}{} == struct{}{}) print?<\/li>\n\n\n<li>What happens when you compare two structs that hold a slice field with ==?<\/li>\n\n\n<li>Why does p.Move() leave p unchanged when Move has a value receiver?<\/li>\n\n\n<li>Given var e error = (*MyErr)(nil), what does e == nil print?<\/li>\n\n\n<li>What does var i interface{} = nil followed by fmt.Println(i == nil) print?<\/li>\n\n\n<li>Why does fmt.Println(any(1) == any(1.0)) print false?<\/li>\n\n\n<li>When you compare two any values that both hold slices, what happens at run time?<\/li>\n\n\n<li>A struct embeds two types that both have a Name method, so what happens on s.Name()?<\/li>\n\n\n<li>If an outer struct defines String and also embeds a type with String, which one runs?<\/li>\n\n\n<li>Why does fmt skip a String method with a pointer receiver when you pass a value?<\/li>\n\n\n<li>Why does a String method that calls fmt.Sprintf(&#8220;%v&#8221;, t) on its own receiver overflow the stack?<\/li>\n\n\n<li>What happens when a struct holds a nil map field and you assign to it?<\/li>\n\n\n<li>How does %+v print a time.Duration that sits in an unexported field?<\/li>\n\n\n<li>Scenario: when a custom error check err != nil is true even on success, what would you look for?<\/li>\n\n\n<li>Scenario: when a log prints a pointer address instead of your String output, what is the likely cause?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Tricky Output Questions on Goroutines and Channels<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-channels-examples\/\">Go channels<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-select-statement\/\">Go select statement<\/a>. Timing makes some of these results random, so explain which parts are certain.<\/p>\n\n\n\n<ol start=\"62\" class=\"wp-block-list\">\n<li>If main starts go fmt.Println(&#8220;hi&#8221;) and returns at once, what prints?<\/li>\n\n\n<li>What happens when main sends on an unbuffered channel that nobody reads?<\/li>\n\n\n<li>After close(ch) on an empty channel of int, what does v, ok := &lt;-ch return?<\/li>\n\n\n<li>Can you close a channel twice, and what does the program print if you do?<\/li>\n\n\n<li>What does len(ch) return for a buffered channel that holds two items?<\/li>\n\n\n<li>When two select cases are ready, which one runs over many tries?<\/li>\n\n\n<li>What does a select with only a default case do?<\/li>\n\n\n<li>If nobody closes ch, what does for v := range ch do after the last value?<\/li>\n\n\n<li>What happens on a receive from a nil channel?<\/li>\n\n\n<li>Why can wg.Add inside the goroutine let Wait return too early?<\/li>\n\n\n<li>When one goroutine panics with no recover, what happens to the rest of the program?<\/li>\n\n\n<li>What does runtime.NumGoroutine usually print as the first line of main?<\/li>\n\n\n<li>Can a data race print a value that no goroutine ever wrote?<\/li>\n\n\n<li>Scenario: when a test passes alone but its output order changes with -count=10, what is the cause?<\/li>\n\n\n<li>Scenario: when a program prints fatal error: all goroutines are asleep, how would you find the stuck channel?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Errors and Built-in Functions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-error-wrapping-guide\/\">Go error wrapping<\/a>. These Go tricky output questions finish with errors and newer built-in functions.<\/p>\n\n\n\n<ol start=\"77\" class=\"wp-block-list\">\n<li>What does fmt.Println(errors.New(&#8220;x&#8221;) == errors.New(&#8220;x&#8221;)) print?<\/li>\n\n\n<li>Does errors.Is(fmt.Errorf(&#8220;wrap: %v&#8221;, io.EOF), io.EOF) return true?<\/li>\n\n\n<li>How does the answer change when the verb is %w instead of %v?<\/li>\n\n\n<li>Which case does a nil interface value match in a type switch?<\/li>\n\n\n<li>What does for i := range 3 print in Go 1.22 and later?<\/li>\n\n\n<li>What does min(3, 1, 2) return, and since which Go version?<\/li>\n\n\n<li>How does clear(m) affect a map, and how does clear(s) affect a slice?<\/li>\n\n\n<li>What does copy(dst, src) return when dst is shorter than src?<\/li>\n\n\n<li>Why does strings.TrimLeft(&#8220;aabbc&#8221;, &#8220;ab&#8221;) return a different result from strings.TrimPrefix(&#8220;aabbc&#8221;, &#8220;ab&#8221;)?<\/li>\n\n\n<li>What does fmt.Println(time.Duration(1500) * time.Millisecond) print?<\/li>\n\n\n<li>Why does fmt.Println(time.Duration(90) * time.Second) print 1m30s?<\/li>\n\n\n<li>Scenario: when a cleanup function trims too many characters from file names, which function did the code misuse?<\/li>\n\n\n<li>Scenario: when errors.Is fails after you add context to an error, what would you change?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Code Reading Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Read each program carefully and predict the output before you run it. Then explain the result in your own words.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\nfunc count() (n int) {\n    defer func() { n *= 2 }()\n    n = 3\n    return n + 1\n}\n\nfunc main() {\n    for i := 0; i &lt; 3; i++ {\n        defer fmt.Print(i, \" \")\n    }\n    x := 1\n    defer fmt.Println(\"deferred x:\", x)\n    x = 10\n    fmt.Println(\"count:\", count())\n}<\/code><\/pre>\n\n\n\n<ol start=\"90\" class=\"wp-block-list\">\n<li>What does count return, and in which order do the deferred lines print?<\/li>\n\n\n<li>Why does the deferred line show x as 1 even though x becomes 10?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The second program mixes append, shared arrays and maps of slices.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport \"fmt\"\n\nfunc main() {\n    a := []int{1, 2, 3, 4}\n    b := a[:2]\n    b = append(b, 99)\n    fmt.Println(a, b, len(b), cap(b))\n\n    c := make([]int, 0, 2)\n    c = append(c, 1, 2)\n    d := append(c, 3)\n    d[0] = 100\n    fmt.Println(c, d)\n\n    m := map[string][]int{}\n    m[\"x\"] = append(m[\"x\"], 5)\n    fmt.Println(len(m), m[\"x\"], m[\"y\"] == nil)\n}<\/code><\/pre>\n\n\n\n<ol start=\"92\" class=\"wp-block-list\">\n<li>Why does the append to b change a, but the change to d leaves c alone?<\/li>\n\n\n<li>What does the last line print, and why can you append to m[&#8220;x&#8221;] before the key exists?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Revision Table for Tricky Rules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the table below as a final check before your interview. It lists the rules behind most tricky output questions.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Rule<\/th><th>Short version<\/th><th>Classic trap<\/th><\/tr><\/thead><tbody><tr><td>Integer division<\/td><td>Truncates toward zero<\/td><td>-7 \/ 2 is -3<\/td><\/tr><tr><td>Defer arguments<\/td><td>Read at the defer line<\/td><td>Old value prints<\/td><\/tr><tr><td>Defer order<\/td><td>Last in, first out<\/td><td>Reverse print order<\/td><\/tr><tr><td>Slice append<\/td><td>Shares array if cap allows<\/td><td>Changes leak to the original<\/td><\/tr><tr><td>Typed nil<\/td><td>Interface holds a type<\/td><td>err != nil on success<\/td><\/tr><tr><td>Closed channel<\/td><td>Gives zero values forever<\/td><td>Endless loop without ok<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Also, many interviewers ask what Go really copies on assignment. The diagram below shows the difference side by side.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-2-1024x640.png\" alt=\"Go tricky output diagram comparing copied values with shared values on assignment\" class=\"wp-image-603\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-2-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-2-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-2-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-2-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-diagram-2-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Arrays, structs and numbers copy their data, while slices, maps and pointers share it.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These official pages explain the rules behind these questions.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/go.dev\/blog\/slices-intro\">Go blog: Go Slices, usage and internals<\/a><\/li>\n\n\n<li><a href=\"https:\/\/go.dev\/ref\/spec\">The Go Programming Language Specification<\/a><\/li>\n\n\n<li><a href=\"https:\/\/go.dev\/blog\/loopvar-preview\">Go blog: Fixing For Loops in Go 1.22<\/a><\/li>\n\n\n<li><a href=\"https:\/\/go.dev\/doc\/faq#nil_error\">Go FAQ: Why is my nil error value not equal to nil?<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>These Go tricky output questions cover constants, strings, slices, maps, defer, interfaces, channels and errors.<\/li>\n\n\n<li>Integer division truncates, and unsigned numbers wrap around without a panic.<\/li>\n\n\n<li>len on a string counts bytes, and range over a string walks runes.<\/li>\n\n\n<li>Defer reads its arguments at once but runs the calls last in, first out.<\/li>\n\n\n<li>An append can write into a shared array when capacity allows.<\/li>\n\n\n<li>An interface that holds a nil pointer is not nil.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By now, you have Go tricky output questions for every area that interviewers love to test. Study the rules in your own notes, then check them against the <a href=\"https:\/\/smitabharat.com\/blog\/go-interview-topics-study-guide\/\">Go interview topics study guide<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next up: <a href=\"https:\/\/smitabharat.com\/blog\/go-difference-between-questions-part-28\/\">Go difference between interview questions (Part 28)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>These Go tricky output questions ask you to predict what a short piece of code prints, then explain why. They cover constants, overflow, strings,&hellip;<\/p>\n","protected":false},"author":1,"featured_media":601,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[10],"tags":[80,95,11,101],"swapz_series":[],"class_list":["post-619","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interview","tag-advanced","tag-go-interview-questions","tag-go-lang","tag-go-tricky-questions"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go Tricky Output Questions: Predict the Result<\/title>\n<meta name=\"description\" content=\"Practise 93 Go tricky output questions on constants, strings, slices, maps, defer, closures, interfaces, channels and errors. Predict, then explain.\" \/>\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-tricky-output-questions-part-27\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go Tricky Output Questions: Predict the Result\" \/>\n<meta property=\"og:description\" content=\"Practise 93 Go tricky output questions on constants, strings, slices, maps, defer, closures, interfaces, channels and errors. Predict, then explain.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/\" \/>\n<meta property=\"og:site_name\" content=\"Smita Bharat - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-28T03:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-28T19:59:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\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=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/\"},\"author\":{\"name\":\"Smita\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"headline\":\"Go Tricky Output Questions: Predict the Result (Part 27)\",\"datePublished\":\"2026-09-28T03:30:00+00:00\",\"dateModified\":\"2026-11-28T19:59:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/\"},\"wordCount\":1990,\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-tricky-output-questions-part-27-featured.png\",\"keywords\":[\"Advanced\",\"Go Interview Questions\",\"Go Lang\",\"Go Tricky Questions\"],\"articleSection\":[\"Interview\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/\",\"name\":\"Go Tricky Output Questions: Predict the Result\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-tricky-output-questions-part-27-featured.png\",\"datePublished\":\"2026-09-28T03:30:00+00:00\",\"dateModified\":\"2026-11-28T19:59:54+00:00\",\"description\":\"Practise 93 Go tricky output questions on constants, strings, slices, maps, defer, closures, interfaces, channels and errors. Predict, then explain.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/#primaryimage\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-tricky-output-questions-part-27-featured.png\",\"contentUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-tricky-output-questions-part-27-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Go Tricky Output Questions featured image: defer, append and typed nil cards\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-tricky-output-questions-part-27\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go Tricky Output Questions: Predict the Result (Part 27)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\",\"name\":\"Smita Bharat Blog\",\"description\":\"Golang &amp; Backend Development Tutorials and Interview Questions\",\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"alternateName\":\"Smita Bharat\",\"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\",\"Organization\"],\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\",\"name\":\"Smita\",\"logo\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/smitabharat.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go Tricky Output Questions: Predict the Result","description":"Practise 93 Go tricky output questions on constants, strings, slices, maps, defer, closures, interfaces, channels and errors. Predict, then explain.","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-tricky-output-questions-part-27\/","og_locale":"en_US","og_type":"article","og_title":"Go Tricky Output Questions: Predict the Result","og_description":"Practise 93 Go tricky output questions on constants, strings, slices, maps, defer, closures, interfaces, channels and errors. Predict, then explain.","og_url":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/","og_site_name":"Smita Bharat - Blog","article_published_time":"2026-09-28T03:30:00+00:00","article_modified_time":"2026-11-28T19:59:54+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-featured.png","type":"image\/png"}],"author":"Smita","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smita","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/#article","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/"},"author":{"name":"Smita","@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"headline":"Go Tricky Output Questions: Predict the Result (Part 27)","datePublished":"2026-09-28T03:30:00+00:00","dateModified":"2026-11-28T19:59:54+00:00","mainEntityOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/"},"wordCount":1990,"publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-featured.png","keywords":["Advanced","Go Interview Questions","Go Lang","Go Tricky Questions"],"articleSection":["Interview"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/","url":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/","name":"Go Tricky Output Questions: Predict the Result","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/#primaryimage"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-featured.png","datePublished":"2026-09-28T03:30:00+00:00","dateModified":"2026-11-28T19:59:54+00:00","description":"Practise 93 Go tricky output questions on constants, strings, slices, maps, defer, closures, interfaces, channels and errors. Predict, then explain.","breadcrumb":{"@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/#primaryimage","url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-featured.png","contentUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-tricky-output-questions-part-27-featured.png","width":2400,"height":1260,"caption":"Go Tricky Output Questions featured image: defer, append and typed nil cards"},{"@type":"BreadcrumbList","@id":"https:\/\/smitabharat.com\/blog\/go-tricky-output-questions-part-27\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smitabharat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Go Tricky Output Questions: Predict the Result (Part 27)"}]},{"@type":"WebSite","@id":"https:\/\/smitabharat.com\/blog\/#website","url":"https:\/\/smitabharat.com\/blog\/","name":"Smita Bharat Blog","description":"Golang &amp; Backend Development Tutorials and Interview Questions","publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"alternateName":"Smita Bharat","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","Organization"],"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339","name":"Smita","logo":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/smitabharat.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/619","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=619"}],"version-history":[{"count":1,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/619\/revisions"}],"predecessor-version":[{"id":995,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/619\/revisions\/995"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media\/601"}],"wp:attachment":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media?parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/categories?post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/tags?post=619"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}