Top 50+ Go Semantics Supplemental Interview Questions-Answers MCQs

Go is a general-purpose language designed with systems programming in mind. It is strongly typed and garbage-collected and has explicit support for concurrent programming. Programs are constructed from packages, whose properties allow efficient management of dependencies.

The grammar is compact and simple to parse, allowing for easy analysis by automatic tools such as integrated development environments.

Go Programming Notations

The syntax is specified using Extended Backus-Naur Form (EBNF):

Production  = production_name "=" [ Expression ] "." .
Expression  = Alternative { "|" Alternative } .
Alternative = Term { Term } .
Term        = production_name | token [ "…" token ] | Group | Option | Repetition .
Group       = "(" Expression ")" .
Option      = "[" Expression "]" .
Repetition  = "{" Expression "}" .

Productions are expressions constructed from terms and the following operators, in increasing precedence:

|   alternation
()  grouping
[]  option (0 or 1 times)
{}  repetition (0 to n times)

Lower-case production names are used to identify lexical tokens. Non-terminals are in CamelCase. Lexical tokens are enclosed in double quotes "" or back quotes ``.

The form a … b represents the set of characters from a through b as alternatives. The horizontal ellipsis  is also used elsewhere in the spec to informally denote various enumerations or code snippets that are not further specified. The character  (as opposed to the three characters ...) is not a token of the Go language.

What are Semantic Elements?

A semantic element clearly describes its meaning to both the browser and the developer.

Examples of non-semantic elements: <div> and <span> – Tells nothing about its content.

Examples of semantic elements: <form><table>, and <article> – Clearly defines its content.

Semantic Elements in HTML

Many web sites contain HTML code like: <div id=”nav”> <div class=”header”> <div id=”footer”> to indicate navigation, header, and footer.

In HTML there are some semantic elements that can be used to define different parts of a web page:  

  • <article>
  • <aside>
  • <details>
  • <figcaption>
  • <figure>
  • <footer>
  • <header>
  • <main>
  • <mark>
  • <nav>
  • <section>
  • <summary>
  • <time>
HTML Semantic Elements

HTML <section> Element

The <section> element defines a section in a document.

According to W3C’s HTML documentation: “A section is a thematic grouping of content, typically with a heading.”

Examples of where a <section> element can be used:

  • Chapters
  • Introduction
  • News items
  • Contact information

A web page could normally be split into sections for introduction, content, and contact information.


Two sections in a document:

<p>The World Wide Fund for Nature (WWF) is an international organization working on issues regarding the conservation, research and restoration of the environment, formerly named the World Wildlife Fund. WWF was founded in 1961.</p>

<h1>WWF’s Panda symbol</h1>
<p>The Panda has become the symbol of WWF. The well-known panda logo of WWF originated from a panda named Chi Chi that was transferred from the Beijing Zoo to the London Zoo in the same year of the establishment of WWF.</p>

Q.1 Which format specifier is used for string data type?

       A. %v

       B. %d

       C. %s

       D. %#v

Ans : %s

Q.2 Which package has functions to read and Write files?

       A. io/ioutil

       B. strconv

       C. scanner

       D. fmt

Ans : io/ioutil

Q.3 A Binary Tree has ______ branches.

       A. three

       B. two

       C. many

       D. exactly one

Ans : two

Q.4 Which sorting algorithm uses a pivot element and compares all other elements with the pivot?

       A. Merge Sort

       B. Quick Sort

       C. Bubble Sort

       D. Heap Sort

Ans : Quick Sort

Q.5 Linked- Lists are Sequential Data structure.

       A. True

       B. False

Ans : False

Q.6 The source code for a Go package should be inside a folder of the same name.

       A. True

       B. False

Ans : True

Q.7 Stack data structure follow which principle

       A. LILO(Last In Last Out)

       B. FCFS(First Come First Serve)

       C. LIFO(Last In First Out)

       D. FIFO(First In First Out)

Ans : LIFO(Last In First Out)

Q.8 Tree data structure is usually used to handle which type of data?

       A. Binary data

       B. Sequential data

       C. Random data

       D. Heirarchial data

Ans : Heirarchial data

Q.9 Which keyword is used to import packages in a Go program.

       A. export

       B. implements

C. import

       D. include

Ans : import

Q.10 Data structures are basically classified as ______ and ________ type.

       A. Linear,Non-Linear

       B. Sequential,Non-squential

       C. Single,Double

       D. Normal,Special

Ans : Linear,Non-Linear

Q.11 Which packages are used for Reading and writing into Files?

       A. os and io/ioutil

       B. scanner

       C. iof

       D. fmt

Ans : os and io/ioutil

Q.12 ______ is used to stop the execution of the program when an error occurs?

       A. Defer

       B. errors

       C. Panic

       D. New()

Ans : Panic

Q.13 Which keyword is used to convert functions into goroutines?

       A. go

       B. go func

       C. func

       D. routine

Ans : go

Q.14 Which go command is used to format the go source code?

       A. go format

       B. go doc

       C. go arrange

       D. go fmt

Ans : go fmt

Q.15 Which go package is used to handle os signals?

       A. io/util

       B. util

       C. os

       D. os/signal

Ans : os/signal

Q.16 What are the functions present in the errors package?

       A. New()

       B. Catch()

       C. Throw() and Catch()

       D. Throw()

Ans : New()

Q.17 The ______ keyword is used to delay the function call in a program, it is similar to the final keyword in other languages.

       A. error

B. exec

       C. defer

       D. delay

Ans : defer

Q.18 Concurrency and parallelism are the same?

       A. True

       B. False

Ans : False

Q.19 Go programming has a try…catch block?

       A. True

       B. False

Ans : False

Q.20 The ______ function is used to recover from a panic condition in a Go program.

       A. panic

       B. defer

       C. retrieve

       D. recover

Ans : recover

Q.21 Channels can be of two types ______ and _____ ?

       A. Unidirectional, bidirectional

       B. scalar,vector

       C. single,multiple

       D. complete, incomplete

Ans : Unidirectional, bidirectional

Q.22 ________ are a medium for communication between goroutines.

       A. communicators

       B. functions

       C. routers

       D. channels

Ans : channels

Q.23 The Println() and Scanln() are a part of which package?

       A. io

       B. scanner

       C. fmt

D. ioutil

Ans : fmt

Q.24 Channels have a _______ associated with them.

       A. port number

       B. function

       C. data

       D. type

Ans : type

Q.25 wait group struct types are present in which package?

       A. sync

       B. ioutil

       C. fmt

       D. main

Ans : sync

Q.26 Which function is used to create custom errors?

       A. errors.New()

       B. errors.Make()


       D. errors.Create()

Ans : errors.New()

Q.27 What is the kind of the data in the code snippet type employee struct?

       A. employee

       B. variable

       C. value

       D. struct

Ans : struct

Q.28 Which package contains the main package?

       A. util

       B. default

       C. main

       D. fmt

Ans : util

Q.29 ________ keyword in Go is similar to the final keyword in other languages.

       A. Panic

       B. prefer

       C. Refer

       D. Defer

Ans : Defer

Q.30 Which command is used to run the tests in go

       A. go build

       B. go test

       C. go run

       D. go compile

Ans : go test

Q.31 Which function of the reflect package is used to create a new value?

       A. ValueOf()

       B. Create()

       C. New()

       D. Start()

Ans : New()

Q.32 The ______ package has functions for unit testing of the codes.

       A. testing

       B. main

       C. test

       D. io/ioutil

Ans : testing

Q.33 Which sorting algorithm uses divide and conquer principle to divide the list to single elements?

       A. Bubble Sort

       B. Heap Sort

       C. Radix Sort

       D. Merge Sort

Ans : Merge Sort

Q.34 ______ is the ability to quickly switch between different tasks execution so that it seems all the tasks are running simultaneously?

       A. Concurrency

       B. premption

       C. Parallelism

       D. multi tasking

Ans : multi tasking

Q.35 ________ Tree is a binary tree which has maximum possible number of nodes.

       A. Complete binary

       B. Normal binary

       C. Full binary

       D. Skew binary

Ans : Complete binary

Q.36 Which Searching Algorithm compares the search element with the middle element of the list?

       A. Binary Search

       B. Interpolation Search

       C. Fibonacci Search

       D. Linear Search

Ans : Binary Search

Q.37 Which command is used to complie and run a Go program?

       A. go run

       B. go compile

       C. go build

       D. go install

Ans : go run

Q.38 Tree and Graph are which type of data structure?

A. Built-in

       B. Linear

       C. Abstract

       D. Non-Linear

Ans : Non-Linear

Q.39 ______ help in organizing the code, and also help in reusability of certain functions of a code in other programs.

       A. structs

       B. packages

       C. data types

       D. main function

Ans : main function

Q.40 ______ function is used to ignore incoming OS signals.

       A. decline()

       B. ignore()

       C. stop()

       D. ignored()

Ans : ignore()

Q.41 The select statement is similar to switch statement?

       A. True

       B. False

Ans : True

Q.42 ______ channels can both send and receive data

       A. Bidirectional

       B. Unidirectional

       C. Multilevel

       D. Multiple

Ans : Bidirectional

Q.43 A _______ is simlar to a thread pool it maintains a pool of goroutines that are to be executed by the program.

       A. Wait Group

       B. Stack

       C. Worker Pool

       D. Go stac

Ans : Worker Pool

Q.44 Which function directs the input signal to a channel.

       A. Receive()

       B. Direct()

       C. Notify()

       D. Send()

Ans : Send()

Q.45 Which package implements buffered input and output in Go?

       A. io/ioutil

       B. os

       C. testing

       D. bufio

Ans : bufio

Q.46 Which package handles input os signals?

       A. main

       B. os

       C. util

       D. os/signal

Ans : os/signal

Q.47 Which package handles os/external commands?

       A. os/run

       B. os/exec

       C. os/signal

       D. os/rune

Ans : os/exec

Q.48 _______ command builds and stores binary/executable file in the bin directory of GOPATH.

       A. go build

       B. go test

       C. go run

       D. go install

Ans : go install

Q.49 Wait Groups are present in which package?

       A. fmt

       B. sync

       C. async

       D. ioutil

Ans : sync

Q.50 The test file name should end with _test.go

       A. True

       B. False

Ans : True

Q.51 The fmt package is used to handle formatted input and output.

       A. True

       B. False

Ans : True

Q.52 Which of the following code snippet is the correct representation of a Node in Linked List

       A. type Node struct {
  value int
  next *Node
  prev *Node

       B. type Node struct {
   value int Value2
   string prev *Node

       C. type Node struct {
  Value int
  tail *Node

       D. type Node struct {
  next *Node
  prev *Node

Ans : type Node struct {
  value int
  next *Node
  prev *Node

Click here to read more Blogs of us

Click here to read HTML Technical Interview Questions and Answers

Click here to read more technical Q&A

About Author

After years of Technical Work, I feel like an expert when it comes to Develop wordpress website. Check out How to Create a Wordpress Website in 5 Mins, and Earn Money Online Follow me on Facebook for all the latest updates.

Leave a Comment