Go Semantics Supplemental Interview Question-Answer Part – 2

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

       A. errors.New()

       B. errors.Make()

       C. errors.build()

       D. errors.Create()

Ans : errors.New()


Q.2 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.3 Which package contains the main package?

       A. util

       B. default

       C. main

       D. fmt

Ans : util


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

       A. Panic

       B. prefer

       C. Refer

       D. Defer

Ans : Defer


Q.5 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.6 Which function of the reflect package is used to create a new value?

       A. ValueOf()

       B. Create()

       C. New()

       D. Start()

Ans : New()


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

       A. testing

       B. main

       C. test

       D. io/ioutil

Ans : testing


Q.8 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.9 ______ 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.10 ________ 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.11 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.12 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.13 Tree and Graph are which type of data structure?

       A. Built-in

       B. Linear

       C. Abstract

       D. Non-Linear

Ans : Non-Linear


Q.14 ______ 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.15 ______ function is used to ignore incoming OS signals.

       A. decline()

       B. ignore()

       C. stop()

       D. ignored()

Ans : ignore()


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

       A. True

       B. False

Ans : True


Q.17 ______ channels can both send and receive data

       A. Bidirectional

       B. Unidirectional

       C. Multilevel

       D. Multiple

Ans : Bidirectional


Q.18 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.19 Which function directs the input signal to a channel.

       A. Receive()

       B. Direct()

       C. Notify()

       D. Send()

Ans : Send()


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

       A. io/ioutil

       B. os

       C. testing

       D. bufio

Ans : bufio


Q.21 Which package handles input os signals?

       A. main

       B. os

       C. util

       D. os/signal

Ans : os/signal


Q.22 Which package handles os/external commands?

       A. os/run

       B. os/exec

       C. os/signal

       D. os/rune

Ans : os/exec


Q.23 _______ 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.24 Wait Groups are present in which package?

       A. fmt

       B. sync

       C. async

       D. ioutil

Ans : sync


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

       A. True

       B. False

Ans : True


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

       A. True

       B. False

Ans : True


Q.27 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
}


Leave a Comment