exam questions

Exam AI-102 All Questions

View all questions & answers for the AI-102 exam

Exam AI-102 topic 5 question 10 discussion

Actual exam question from Microsoft's AI-102
Question #: 10
Topic #: 5
[All AI-102 Questions]

HOTSPOT -
You are building a chatbot by using the Microsoft Bot Framework SDK.
You use an object named UserProfile to store user profile information and an object named ConversationData to store information related to a conversation.
You create the following state accessors to store both objects in state. var userStateAccessors = _userState.CreateProperty<UserProfile>(nameof(UserProfile)); var conversationStateAccessors = _conversationState.CreateProperty<ConversationData>(nameof(ConversationData));
The state storage mechanism is set to Memory Storage.
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: Yes -
You create property accessors using the CreateProperty method that provides a handle to the BotState object. Each state property accessor allows you to get or set the value of the associated state property.

Box 2: Yes -

Box 3: No -
Before you exit the turn handler, you use the state management objects' SaveChangesAsync() method to write all state changes back to storage.
Reference:
https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-state

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
zellck
Highly Voted 1 year, 10 months ago
YYN is the answer. https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-concept-state?view=azure-bot-service-4.0#state-property-accessors State property accessors are used to actually read or write one of your state properties, and provide get, set, and delete methods for accessing your state properties from within a turn. To create an accessor, you must provide the property name, which usually takes place when you're initializing your bot. Then, you can use that accessor to get and manipulate that property of your bot's state. The accessors allow the SDK to get state from the underlying storage, and update the bot's state cache for you. The state cache is a local cache maintained by your bot that stores the state object for you, allowing read and write operations without accessing the underlying storage. If it isn't already in the cache, calling the accessor's get method retrieves state and also places it in the cache. Once retrieved, the state property can be manipulated just like a local variable.
upvoted 15 times
zellck
1 year, 10 months ago
https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-concept-state?view=azure-bot-service-4.0#storage-layer The Bot Framework SDK includes some implementations for the storage layer: - Memory storage implements in-memory storage for testing purposes. In-memory data storage is intended for local testing only as this storage is volatile and temporary. The data is cleared each time the bot is restarted.
upvoted 3 times
rdemontis
1 year, 5 months ago
thanks for explanation
upvoted 1 times
...
...
...
Voxo
Highly Voted 3 years, 5 months ago
Looks correct
upvoted 11 times
...
syupwsh
Most Recent 2 months, 2 weeks ago
In order from top to bottom Yes is CORRECT. First, we need to know that the bot is stateless by nature. Once launched, our bot might not execute on the same machine or in the same process for different users. To control its behavior and retain responses to earlier queries, your bot might need to save the context of a conversation. We can add a state to our bot using the Bot Framework SDK's state and storage features. Bots preserve and manage their state through the usage of storage objects and state management. Yes is CORRECT because the Bot Framework SDK allows the bot to create and maintain objects like ConversationData in the underlying in-memory storage during the bot's runtime. In-memory storage is used to store and access state properties such as ConversationData and UserProfile through state accessors. While this storage is volatile and cleared when the bot restarts, it functions as the underlying storage layer during the active session. No is CORRECT. When the Bot Framework we defined is terminated it will lose all access to previous conversational data as the data stored in memory is temporary and disappears when the Bot Framework runtime terminates.
upvoted 1 times
...
3fbc31b
5 months, 1 week ago
Save some time and ignore Bot Framework. It's no longer on the AI-102 exam.
upvoted 3 times
...
HaraTadahisa
10 months, 1 week ago
My answer is that Yes Yes No
upvoted 1 times
...
takaimomoGcup
10 months, 2 weeks ago
This is the same question as topic 5 No.52.
upvoted 1 times
...
varinder82
1 year, 1 month ago
Final Answer YYN
upvoted 2 times
...
Mehe323
1 year, 1 month ago
The first two are YES, the last is NO. "Memory storage The Bot Framework SDK allows you to store user inputs using in-memory storage. Since in-memory storage is cleared each time the bot is restarted, it's best suited for testing purposes and isn't intended for production use. Persistent storage types, such as database storage, are best for production bots." https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-storage?view=azure-bot-service-4.0&tabs=csharp
upvoted 1 times
...
sl_mslconsulting
1 year, 6 months ago
Ok seems everyone get this wrong. The answer are N, N, N. CreateProperty method provides a handle to the BotState object. BotState is part of the cache. Nothing will save to the storage layer unless you explicitly do so in the code. The storage layer is in memory in this case as a result nothing will be persisted once the bot is destroyed.
upvoted 2 times
dimsok
1 year, 3 months ago
you are right, but i think since you dont the full code to check, save is implied
upvoted 1 times
...
...
kail85
1 year, 10 months ago
Yes, No, No
upvoted 1 times
...
kail85
1 year, 10 months ago
First one is Yes. The code provided creates state accessors for both UserProfile and ConversationData objects. These state accessors are used to store and retrieve the respective objects in the underlying state storage mechanism, which in this case is Memory Storage. When you use the state accessors to set or get the UserProfile object, the Microsoft Bot Framework SDK will create and maintain the UserProfile object in the Memory Storage, allowing you to persist user profile information across multiple turns in the conversation.
upvoted 1 times
...
flutterb
2 years, 5 months ago
Answer is : No No No If the user profile and conversation states are committed to memory, then they are in fact stored in cache memory and not on the underlying storage layer (disk). Hence, the user profile and conversation data will get deleted once the session runtime is over.
upvoted 4 times
ninjapunk
2 years, 4 months ago
Wrong. The first two answers are true. As per the documentation, the BotState Class "defines a state management object and automates the reading and writing of associated state properties to a storage layer." CreateProperty is a method of the BotState Class, which "creates a named state property within the scope of a BotState and returns an accessor for the property." Reference: https://learn.microsoft.com/en-us/dotnet/api/microsoft.bot.builder.botstate?view=botbuilder-dotnet-stable
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago