📜 questionsBank.title ⁉️
GoLang Proficiency Evaluation: Core Concepts & Application Mastery
questionsBank.legalText
💡 questionsBank.answeredQuestions
1.What is the output of the following Go code snippet when executed? \npackage main\nimport \"fmt\"\nfunc main() {\nvar x int = 42\nif x := 10; x < 20 {\nfmt.Println(x * 2)\n} else {\nfmt.Println(x)\n}\n}
- 1.20 ✓
- 2.42
- 3.20
- 4.Compiling error
2.Which Go features ensure efficient memory management and garbage collection?
- 1.Manual memory management
- 2.Automatic garbage collection
- 3.Pointer arithmetic
- 4.Compile-time type checking
3.In Go, what is the purpose of a goroutine?
- 1.To run functions concurrently ✓
- 2.To manage memory resources
- 3.To provide interface implementations
- 4.To compile Go code
4.When would you use a buffered channel in Go?
- 1.To prevent data races
- 2.When you need to control the timing of the sender/receiver operations ✓
- 3.To execute functions in parallel
- 4.When you need high-frequency data updates
5.How does the Go scheduler optimize goroutine execution?
- 1.By using priority levels
- 2.By binding goroutines to specific CPUs
- 3.Through preemption and fairness techniques
- 4.By using non-blocking asynchronous operations ✓
6.What is the primary difference between a slice and an array in Go?
- 1.Slices can hold different data types, arrays cannot
- 2.Arrays are resizable, slices are not
- 3.Slices are dynamically-sized, arrays have a fixed size ✓
- 4.Arrays can be passed by reference, slices by value
7.Which statement is true about Go interfaces?
- 1.They cannot contain methods
- 2.A type can implement part of an interface and still be considered as implementing the whole interface
- 3.Interfaces can store any type of value using dynamic typing
- 4.A type implements an interface by implementing its methods ✓
8.What is a common pitfall when using maps in Go that can lead to runtime errors?
- 1.Accessing a map value using an int index instead of a string
- 2.Assigning a map to another map without copying it
- 3.Concurrent writing to a map from multiple goroutines ✓
- 4.Using a floating-point number as a map key
9.How does Go handle nil pointer dereferencing?
- 1.It returns zero value silently
- 2.The program exits with a segmentation fault
- 3.The Go runtime recovers and retries execution
- 4.It panics and may be recovered with a defer function ✓
10.Which of the following Go structures supports field inheritance-like behavior?
- 1.Classes
- 2.Struct embedding ✓
- 3.Interfaces
- 4.Function closures
questionsBank.page 1 questionsBank.of 3