Questions
Answer the following questions to test your knowledge of this chapter:
- Please select the false statement:
A. In Protobuf, a service is defined by the
service
keyword, while its methods are defined by therpc
keyword.B. You cannot have a Protobuf message definition without any fields.
C. A Protobuf message can have collections of objects and can use other message definitions as field types.
D. You have to specify a request object in a response object inside a gRPC method definition and you can only use a single object type in each of those.
- Which platforms can you run a .NET implementation of gRPC on?
A. Windows, Linux, and macOS
B. Windows and macOS only
C. Unix-based (macOS and Linux) only
D. Windows only
- How do you enable server-side gRPC components in .NET applications?
A. So long as you reference the
Grpc.AspNetCore
NuGet package, it will be automatically enabled for you.B. You just need to add a proto file to your project; the compiler will do everything else for you.
C. You need to define a proto element inside the project file. It can be blank or you can set its
GrpcServices
attribute to eitherServer
orBoth
.D. You need to define a proto element inside the project file and you must set its
GrpcServices
attribute toServer
. - After adding the relevant proto files to your server-side application project, what modifications do you need to make to your code?
A. You just need to override the methods from the auto-generated C# code files with your functionality.
B. You need to modify the auto-generated C# classes and add your functionality to them.
C. You need to create a new class that inherits from the auto-generated base class, add gRPC to your application services via the
ConfigureServices
method of theStartup
class, and then register the newly created class as one of the endpoints in your middleware.D. The system will generate all the required code for you. You just need to fill the methods with your logic.
- Can the .NET implementation of the .NET client call RPCs both synchronously and asynchronously?
A. It can only call methods synchronously.
B. It can only call methods asynchronously.
C. There is both a synchronous and asynchronous version of each method that's generated for the client to use.
D. All auto-generated methods are asynchronous, but you can change the implementation to make them synchronous.