Loading...
QUIZ

Certification Test

 
Que No. 1 ) What does the 'select' statement in Go primarily relate to?

A.) Selecting elements from an array
B.) Selecting a specific case from a switch statement
C.) Coordinating communication among Goroutines
D.) Selecting elements from a slice


Que No. 2 ) What is the purpose of the 'panic' and 'recover' functions in Go?

A.) To handle HTTP requests
B.) To generate runtime errors
C.) To recover from runtime panics and errors
D.) To recover from disk failures


Que No. 3 ) In Go, which package is commonly used for reading and writing files?

A.) io
B.) file
C.) fs
D.) os


Que No. 4 ) How do you define a function that takes a variable number of arguments in Go?

A.) func myFunc(args ...int)
B.) func myFunc(args int...)
C.) func myFunc(args int[])
D.) func myFunc(...int args)


Que No. 5 ) What is the purpose of the 'defer' keyword in Go's 'panic' and 'recover' mechanism?

A.) To prevent panics from occurring
B.) To recover from panics and handle cleanup tasks
C.) To create panics intentionally
D.) To hide runtime errors


Que No. 6 ) Which data structure is used to implement a Last-In-First-Out (LIFO) stack in Go?

A.) Queue
B.) Array
C.) Slice
D.) Stack


Que No. 7 ) In Go, how do you import a package from a remote repository like GitHub?

A.) go get github.com/package-name
B.) import github.com/package-name
C.) package github.com/package-name
D.) include github.com/package-name


Que No. 8 ) What is the purpose of the 'range' keyword in Go?

A.) To iterate over the elements of an array, slice, or map
B.) To create Goroutines
C.) To declare new variables
D.) To define custom data types


Que No. 9 ) How do you exit a Goroutine in Go?

A.) Using the 'break' keyword
B.) Using the 'return' keyword
C.) Using the 'exit' function
D.) Goroutines exit automatically when the function is done


Que No. 10 ) What is the purpose of Go's 'defer' statement when used with a file operation?

A.) To cancel the file operation
B.) To pause the program until the file operation is complete
C.) To ensure that the file is closed after the function exits
D.) To make the file operation asynchronous