Go Mock Test



This section presents you various set of Mock Tests related to Go. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

Go Mock Test III

Q 2 - Which of the following function returns the total number of elements present in a slice?

A - size()

B - len()

C - cap()

D - None of the above.

Answer : B

Explanation

len() function returns the elements presents in the slice.

Q 3 - Which of the following function returns the capacity of slice as how many elements it can be accomodate?

A - size()

B - len()

C - cap()

D - None of the above.

Answer : C

Explanation

cap() function returns the capacity of slice as how many elements it can be accomodate.

Answer : D

Explanation

All of the above options are correct.

Q 5 - Which of the following function can be used to increase the capacity of a slice in Go?

A - append()

B - copy()

C - resize()

D - None of the above.

Answer : A

Explanation

Slice allows increasing the capacity of a slice using append() function.

Q 6 - Which of the following function can be used to copy a slice to another slice in Go?

A - append()

B - copy()

C - resize()

D - None of the above.

Answer : B

Explanation

Using copy() function, contents of a source slice are copied to destination slice.

Answer : C

Explanation

Both of the above options are correct.

Answer : C

Explanation

Both of the above options are correct.

Answer : C

Explanation

Both of the above options are correct.

Q 13 - Which of the following terminates the for loop or switch statement and transfers execution to the statement immediately following the for loop or switch in Go?

A - break

B - continue

C - goto

D - None of the above.

Answer : A

Explanation

break terminates the for loop or switch statement and transfers execution to the statement immediately following the for loop or switch.

Q 14 - Which of the following causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating in Go?

A - break

B - continue

C - goto

D - None of the above.

Answer : B

Explanation

continue causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.

Q 15 - Which of the following transfers control to the labeled statement in Go?

A - break

B - continue

C - goto

D - None of the above.

Answer : C

Explanation

goto transfers control to the labeled statement.

Answer : D

Explanation

All of the above options are correct.

Answer : D

Explanation

All of the above options are correct.

Q 19 - Which of the following method of parameter passing, copies the actual value of an argument into the formal parameter of the function?

A - call by value.

B - call by reference

C - Both of the above.

D - None of the above.

Answer : A

Explanation

Call by value − This method copies the actual value of an argument into the formal parameter of the function.

Q 20 - In which of the following method of parameter passing, changes made to the parameter inside the function have no effect on the argument?

A - call by value.

B - call by reference

C - Both of the above.

D - None of the above.

Answer : A

Explanation

Call by value − changes made to the parameter inside the function have no effect on the argument.

Q 21 - Which of the following method of parameter passing, copies the address of an argument into the formal parameter?

A - call by value.

B - call by reference

C - Both of the above.

D - None of the above.

Answer : B

Explanation

Call by reference − This method copies the address of an argument into the formal parameter.

Q 22 - In which of the following method of parameter passing, changes made to the parameter inside the function have effect on the argument?

A - call by value.

B - call by reference

C - Both of the above.

D - None of the above.

Answer : B

Explanation

Call by reference − changes made to the parameter inside the function have effect on the argument.

Q 23 - Which of the following method is the default method of parameter passing in Go?

A - call by value.

B - call by reference

C - Both of the above.

D - None of the above.

Answer : A

Explanation

By default, Go uses call by value to pass arguments.

Q 24 - Go programming language is strongly and statically typed, provides inbuilt support for garbage collection?

A - true

B - false

Answer : A

Explanation

Go programming language is strongly and statically typed, provides inbuilt support for garbage collection.

Q 25 - In Go programming language, Programs are constructed using packages, for efficient management of dependencies?

A - false

B - true

Answer : B

Explanation

Programs are constructed using packages, for efficient management of dependencies.

Answer Sheet

Question Number Answer Key
1 D
2 B
3 C
4 D
5 A
6 B
7 D
8 C
9 C
10 C
11 C
12 C
13 A
14 B
15 C
16 D
17 D
18 D
19 A
20 A
21 B
22 B
23 A
24 A
25 B
go_questions_answers.htm
Advertisements