Xamarin Certification Xamarin.Forms 3 — Questions and Answers
Question 1: What is the role of a DataTemplateSelector in Xamarin.Forms?
- Converts data values between types for binding
- Selects a different DataTemplate based on the bound data item at runtime (Correct answer)
- Defines the layout for a single item in a list
- Provides filtering logic for collection views
Correct answer: Selects a different DataTemplate based on the bound data item at runtime
DataTemplateSelector allows you to choose among multiple DataTemplates dynamically based on the data object being rendered.
Question 2: Which Xamarin.Forms class is the base for pages that contain a single child view?
- MasterDetailPage
- TabbedPage
- ContentPage (Correct answer)
- CarouselPage
Correct answer: ContentPage
ContentPage is the most commonly used page type and hosts a single root view through its Content property.
Question 3: What does the Padding property on a Layout control in Xamarin.Forms control?
- The space between sibling child elements
- The space between the layout boundary and its children (Correct answer)
- The minimum size of the layout
- The external margin around the layout
Correct answer: The space between the layout boundary and its children
Padding defines the inner spacing between a layout's edges and the content area where children are placed.
Question 4: In Xamarin.Forms, which navigation method pushes a page modally onto the navigation stack?
- Navigation.PushAsync
- Navigation.PushModalAsync (Correct answer)
- Navigation.InsertPageBefore
- Navigation.PopToRootAsync
Correct answer: Navigation.PushModalAsync
PushModalAsync presents a page modally, typically covering the entire screen without a navigation bar.
Question 5: Which Xamarin.Forms control is best suited for accepting multi-line text input from the user?
- Entry
- Label
- Editor (Correct answer)
- SearchBar
Correct answer: Editor
Editor is designed for multi-line text input, while Entry is limited to a single line.
Question 6: What is the purpose of the MessagingCenter in Xamarin.Forms?
- Sends push notifications to devices
- Enables loosely-coupled publish/subscribe messaging between components (Correct answer)
- Manages the navigation message stack
- Provides access to platform-specific SMS APIs
Correct answer: Enables loosely-coupled publish/subscribe messaging between components
MessagingCenter implements a publish/subscribe pattern so components can communicate without direct references to each other.
Question 7: Which property on a Grid column or row definition sets a size proportional to remaining space?
- Auto
- Absolute pixel value
- Star (*) sizing (Correct answer)
- Fill
Correct answer: Star (*) sizing
Star sizing (e.g., *, 2*) distributes remaining space proportionally among rows or columns that use it.
What is the role of a DataTemplateSelector in Xamarin.Forms?