In a RESTful API, the _____ HTTP method is used to read a specific resource.

  • GET
  • POST
  • PUT
  • DELETE
In a RESTful API, the GET HTTP method is used to read a specific resource. This is a safe and idempotent operation, meaning it should not modify the resource and can be called multiple times without changing the resource's state. When a client sends a GET request to a resource's URL, the server responds with the representation of that resource, typically in the form of JSON or XML data.

What is the primary purpose of Protocol Buffers?

  • To compress data for storage.
  • To serialize structured data efficiently.
  • To define database schemas.
  • To encrypt data in transit.
Protocol Buffers, also known as protobuf, are a method for serializing structured data in a compact, efficient, and language-agnostic way. Its primary purpose is efficient data serialization and deserialization, making it suitable for use cases like network communication, data storage, and data interchange between different systems and languages. Protocol Buffers are not specifically designed for data compression or encryption but rather for defining a schema and serializing data in a way that allows for efficient storage and transmission.

What is the difference between a package and a module in Go?

  • A module contains only interfaces, while a package contains concrete types.
  • A module is a versioned collection of related Go packages.
  • A package contains only functions, while a module contains variables and constants.
  • A package is a collection of Go source files in the same directory.
In Go, a package is a collection of Go source files in the same directory that are used to organize code, whereas a module is a versioned collection of related Go packages with a go.mod file specifying dependencies.

How do you specify a specific version of a dependency using Go Modules?

  • Using the 'require' directive
  • Using the 'replace' directive
  • Using the 'exclude' directive
  • Using the 'import' directive
To specify a specific version of a dependency using Go Modules, you use the 'require' directive in the go.mod file. You list the module path and the desired version, ensuring that the version adheres to semantic versioning (SemVer). This allows Go Modules to fetch the correct version of the dependency when you build your project. This precise versioning is essential for ensuring consistency and predictability in your project's dependencies.