Here are GoLang questions helpful for interviews and writing code for smart contracts in the blockchain environment. The short name for Go Programming Language isĀ Golang.
Essential GoLang Questions
Q.1) Who was first designed Golang?
The Go programming language began as an internal Google project in 2007. The original design was by Robert Griesemer and Unix luminaries Rob Pike and Ken Thompson.
Q.2) How old was GoLag?
Introduced in 2008. This is open source language. The main contributor is Google.
Q.3) What is the primary specialty of Golang?
The specialty is Lightening Compilation speed. In a fraction of seconds, you can compile very big programs.
You can also build huge applications quickly using Golang. One other advantage is speedy execution or processing.
Q.4) Can we develop Web applications using Golang?
Yes, you can develop web applications using Google’s App Engine.
Q.5) Compared to C++ and Java Language where Golang differs?
Due to short Syntax and simple to understand style is the main difference between C++ and Java.
Q.6) What is the difference between Smart Pointers and Garbage Collector?
Garbage Collector: In computer science, garbage collection (GC) is a form of automatic memory management.
The garbage collector, or just collector, attempts to reclaim garbage or memory occupied by objects that are no longer in use by the program.
Garbage collection was invented by John McCarthy around 1959 to simplify manual memory management in Lisp.
Smart Pointers: Smart pointers typically keep track of the memory they point to, and may also be used to manage other resources, such as network connections and file handles.
Smart pointers were first popularized in the programming language C++ during the first half of the 1990s as a rebuttal to criticisms of C++’s lack of automatic garbage collection.
Q.7) What is CSP in Golang?
In Golang CSP is Communication Sequential Processing. You can run multiple Golang programs parallel so that it will not have any locking problem.
Q.8) How many goroutines can you create using Golang?
You can create any number. The processing of these routines completely loads balanced. You already know that a routine means a program or a process.
Q.9) What are the basic built-in Collection types?
Those are Slices and Maps.
Q.10) Will golang support pointers?
Yes, it will support
Q.11) How to install Golang on Ubuntu?
Steps you need to install Golang on Ubuntu
$sudo wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz
$sudo tar -xvf go1.12.1.linux-amd64.tar.gz
Next step is where to install..
$sudo mv go /usr/local
The above directory I have selected to install Golang.
You need to set environment for $GOPATH, $GOROOT, and $PAT
$export $GOROOT=/usr/local/go
$export $GOPATH=$HOME/projects/proj1
In the above path I can run my projects, so I have given. You can give path here of your own.
$export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
Next step is install..
$sudo apt install golang-go
How to check go is installed..
$go version
go version go1.6.2 linux/amd64
References