- Go Tutorial
- Go - Home
- Go - Overview
- Go - Environment Setup
- Go - Program Structure
- Go - Basic Syntax
- Go - Data Types
- Go - Variables
- Go - Constants
- Go - Operators
- Go - Decision Making
- Go - Loops
- Go - Functions
- Go - Scope Rules
- Go - Strings
- Go - Arrays
- Go - Pointers
- Go - Structures
- Go - Slice
- Go - Range
- Go - Maps
- Go - Recursion
- Go - Type Casting
- Go - Interfaces
- Go - Error Handling
- Go Useful Resources
- Go - Questions and Answers
- Go - Quick Guide
- Go - Useful Resources
- Go - Discussion
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.
Go Mock Test II
Q 1 - Which of the following is true about select statement in Go?
B - The type for a case must be the a communication channel operation.
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following is true about switch statement in Go?
Answer : C
Explanation
Both of the above options are correct.
Q 3 - Which of the following is true about expression switch statement in Go?
Answer : D
Explanation
All of the above options are correct.
Q 4 - Which of the following is true about type switch statement in Go?
A - The expression used in a switch statement must have an variable of interface{} type.
Answer : D
Explanation
All of the above options are correct.
Q 5 - Which of the following is true about for loop statement in Go?
A - if condition is available, then for loop executes as long as condition is true.
B - if range is available, then for loop executes for each item in the range.
Answer : C
Explanation
Both of the above options are correct.
Q 6 - Which of the following is true about break statement in Go?
B - It can be used to terminate a case in the switch statement.
Answer : C
Explanation
Both of the above options are correct.
Q 7 - Which of the following is true about break statement in Go?
Answer : A
Explanation
If you are using nested loops (i.e., one loop inside another loop), the break statement will stop the execution of the innermost loop and start executing the next line of code after the block.
Q 8 - Which of the following is true about continue statement in Go?
A - continue forces the next iteration of the loop to take place, skipping any code in between.
Answer : C
Explanation
Both of the above options are correct.
Q 9 - Which of the following is true about functions in Go?
Answer : C
Explanation
Both of the above options are correct.
Answer : A
Explanation
A Go function can return multiple values.
Q 11 - Which of the following is true about call by value method of parameter passing in Go?
A - This method copies the actual value of an argument into the formal parameter of the function.
B - In this case, changes made to the parameter inside the function have no effect on the argument.
Answer : C
Explanation
Both of the above options are correct.
Q 12 - Which of the following is true about call by reference method of parameter passing in Go?
A - This method copies the address of an argument into the formal parameter.
B - Inside the function, the address is used to access the actual argument used in the call.
Answer : D
Explanation
All of the above options are correct.
Answer : A
Explanation
Functions can be created on the fly and can be used as values.
Answer : A
Explanation
Yes! function clousures are supported in Go. Functions closure are anonymous functions and can be used in dynamic programming.
Answer : A
Explanation
Yes! Method are special functions with a receiver.
Q 16 - Which of the following is true about local variables in Go?
A - Variables that are declared inside a function or block are called local variables.
B - They can be used only by statements that are inside that function or block of code.
C - Local variables are not known to functions outside their own.
Answer : D
Explanation
All of the above options are correct.
Q 17 - Which of the following is true about global variables in Go?
A - Global variables are defined outside of a function, usually on top of the program.
B - The global variables will hold their value throughout the lifetime of your program.
C - A global variable is available for use throughout your entire program after its declaration.
Answer : D
Explanation
All of the above options are correct.
Q 18 - Which of the following is true about formal parameters in Go?
A - Function parameters, formal parameters, are treated as local variables with-in that function.
Answer : C
Explanation
Both of the above options are correct.
Q 19 - Which of the following is the default value of a local variable in Go?
Answer : B
Explanation
Default value of a local variable is 0 type value or nil.
Q 20 - Which of the following is the default value of a global variable in Go?
Answer : B
Explanation
Default value of a global variable is 0 type value or nil.
Q 21 - Which of the following is correct about nil pointer in Go?
B - Nil value assignment is done at the time of variable declaration.
Answer : D
Explanation
All of the above options are correct.
Answer : A
Explanation
Yes! Go allows you to have pointer on a pointer and so on.
Q 23 - Which of the following is correct about structures in Go?
B - Structures are used to represent a record
C - To define a structure, you must use type and struct statements.
Answer : D
Explanation
All of the above options are correct.
Q 24 - Which of the following is correct about structures in Go?
A - To access any member of a structure, we use the member access operator (.).
B - You would use struct keyword to define variables of structure type.
Answer : D
Explanation
All of the above options are correct.
Q 25 - Which of the following is correct about slice in Go?
A - Go Slice is an abstraction over Go Array.
B - It provides many utility functions required on Array and is widely used in Go programming.
Answer : D
Explanation
All of the above options are correct.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | D |
2 | C |
3 | D |
4 | D |
5 | C |
6 | C |
7 | A |
8 | C |
9 | C |
10 | A |
11 | C |
12 | D |
13 | A |
14 | A |
15 | A |
16 | D |
17 | D |
18 | C |
19 | B |
20 | B |
21 | D |
22 | A |
23 | D |
24 | D |
25 | D |