Quiz
go part2 khan
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (36)
1What is the index number of the last element of an array with 29 elements?
- A29
- B28
- C27
- D0
- E1
2What's the output of following code?
package main
import "fmt"
func main()\{
c \:\= [...]int\{\}
fmt.Println(len(c))
\}- A0
- B1
- C3
- Dcompile error
3Go supports type inheritance.
- ATrue
- BFalse
4In Go language, variables of different types can be declared in one statement.
- ATrue
- BFalse
5A slice is an abstraction over __________.
- Aarray
- Bvariable
- Cstructure
- Dinterface
6If a slice is declared with no inputs, then by default, it is initialized as nil. Its length and capacity are _________.
- A0
- B1
- C-1
- DInf
7One can increase the capacity of a slice using the ___________ function.
- Aappend()
- Bcopy()
- Cincrease()
- Dadd()
8Given a key and a value, you can store the value in a ________ object.
- AMap
- BArray
- CStructure
- DData
9You must use _________ function to create a map.
- Amake
- Bcreate
- Cadd
- Ddo
10__________ function is used to delete an entry from a map.
- Adelete()
- Berase()
- Cclean()
- Dremove()
11What's the output of following code?
package main
import "fmt"
func main() \{
oddSlc \:\= []int\{1,3,5,7\}
evenSlc \:\= []int\{2,4,6,8\}
copy(evenSlc, oddSlc[2\:])
fmt.Println("evenSlc \= ", evenSlc)
\}- AevenSlc \= [5 7 6 8]
- BevenSlc \= [1 3 2 4]
- CevenSlc \= [2 4 6 8]
- DevenSlc \= [2 4 5 7]
12_____________ is the process of repeating items in a self-similar way.
- ARecursion
- BFunction
- CRegression
- DIteration
13______________ is a way to convert a variable from one data type to another data type.
- AType casting
- BParsing
- CExchange operator
- DData type
14Go programming provides another data type called ______________ which represents a set of method signatures.
- Ainterfaces
- Bstructures
- Cmethods
- Dfunctions
15They are _____________ types and consists of the two predefined constants\: (a) true (b) false
- Aboolean
- Barithmetic
- Cstring
- Dderived
16They are ____________ types and they represents a) integer types or b) floating point values throughout the program.
- Aarithmetic
- Bboolean
- Cderived
- Dstring
17_________ types include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types f) Slice types g) Interface types h) Map types i) Channel Types
- ADerived
- BString
- CArithmetic
- DBoolean
18Increment operator in GO\:
- A++
- B+
- C>>
- D--
- E-
19Decrement operator in Go\:
- A++
- B+
- C--
- D-
- E>>
20It executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
- Afor
- Bselect
- Cswitch
- Drecursion
21A(n) ____________ is a variable whose value is the address of another variable, i.e., direct address of the memory location.
- Apointer
- Breference
- Carray
- Dfunction
22Which of the following is initial value (zero value) for interfaces, slice, pointers, maps, channels and functions?</
- A0
- Btrue
- Cnil
- Dfalse
23The __________ function returns the elements presents in the slice
- Alen()
- Bcap()
- Cmake()
- Dsize()
24_______ function returns the capacity of the slice (i.e., how many elements it can be accommodate).
- Acap()
- Blen()
- Csize()
- Dmake()
25The _________ keyword is used in for loop to iterate over items of an array, slice, channel or map.
- Arange
- Bsize
- Ccapacity
- Dlength
26A(n) ___________ is a collection of fields.
- Astruct
- Barray
- Cinterface
- Dslice
27A(n) __________ is a function with a special receiver argument.
- Amethod
- Binterface
- Cvariable
- Dstructure
28A type __________ provides access to an interface value's underlying concrete value.
- Aassertion
- Bcasting
- Crecursion
- Dderiving
29For loop as a while loop in Go\:
- Asum \:\= 0
for i \:\= 0; i < 10; i++ \{
sum +\= i
\} - Bsum \:\= 1
for ; sum < 1000; \{
sum +\= sum
\} - Csum \:\= 1
for sum < 1000 \{
sum +\= sum
\} - DNone of the above
- Asum \:\= 0
30Comments in GO program is written by using
- A//
- B--
- C<!-->
- D<>
31The variables that can be used only within the function in which it is declared is called as
- Alocal
- Bglobal
- Cboth of them
- Dnone of them
32Variables declared outside a block are called _____
- Aglobal
- Blocal
- Cexternal
- Duniversial
33The variables declared in a statement block or listed in a function header's parameterlist are considered _____ variables
- Alocal
- Bglobal
- Creference
- Dvalue
34What is the output of following code?
package main
import "fmt"
func main() \{
switch day\:\=4; day\{
case 1\:
fmt.Println("Monday")
case 2\:
fmt.Println("Tuesday")
case 3\:
fmt.Println("Wednesday")
case 4\:
fmt.Println("Thursday")
case 5\:
fmt.Println("Friday")
case 6\:
fmt.Println("Saturday")
case 7\:
fmt.Println("Sunday")
default\:
fmt.Println("Invalid")
\}- AMonday
- BThursday
- CTuesday
- DFriday
- EWednesday
- FSaturday
- GSunday
35______________ statement is used to skip over the execution part of the loop on a certain condition.
- AContinue
- BBreak
- CGoto
- DFlow
36Which of the following is the proper declaration of a pointer?
- Avar p *int
- Bint *p
- Cp*
- Dvar &p int
Information
- Description
- Quiz on go part2 khan, created by Khamit Zhussip on 23/05/2019.
- Author
- Khamit Zhussip
- Language
- English
- Views
- 16
- Rating
- No ratings yet Rate this quiz