Go Semantics Supplemental Interview Question-Answer Part – 1

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


Leave a Comment