InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Why We Need Mmvm? |
|
Answer» MVVM facilitates a clear SEPARATION of the development of the UI from the development of the business logic or back END logic KNOWN as the model (also known as the data model to distinguish it from the view model). The view model of MVVM is a value converter. MVVM was DESIGNED to make use of data binding functions in WPF to better facilitate the separation of view layer development from the rest of the PATTERN by removing virtually all GUI code (“code-behind”) from the view layer. MVVM facilitates a clear separation of the development of the UI from the development of the business logic or back end logic known as the model (also known as the data model to distinguish it from the view model). The view model of MVVM is a value converter. MVVM was designed to make use of data binding functions in WPF to better facilitate the separation of view layer development from the rest of the pattern by removing virtually all GUI code (“code-behind”) from the view layer. |
|
| 2. |
What Is Inotifypropertychanged? |
|
Answer» The INotifyPropertyChanged interface is used to notify clients, TYPICALLY binding clients, that a property value has changed.For EXAMPLE, consider a STOCK object with a property called StockCount.
The INotifyPropertyChanged interface is used to notify clients, typically binding clients, that a property value has changed.For example, consider a Stock object with a property called StockCount. |
|
| 3. |
What Are Advantages Of Mvvm Over Mvc? |
Answer»
|
|
| 4. |
What Is Icommand? |
|
Answer» ICommand defines a command The ICommand TYPE exposes the following MEMBERS.
ICommand defines a command The ICommand type exposes the following members. |
|
| 5. |
What Is An Event? |
|
Answer» An event is a programming construct that reacts to a CHANGE in state, notifying any endpoints that have registered for notification. Primarily, events are used to inform a user input VIA the mouse and keyboard, but their usefulness is not limited to that. Whenever a state change is detected, perhaps when an object has been loaded or INITIALIZED, an event can be fired to ALERT any interested third parties. An event is a programming construct that reacts to a change in state, notifying any endpoints that have registered for notification. Primarily, events are used to inform a user input via the mouse and keyboard, but their usefulness is not limited to that. Whenever a state change is detected, perhaps when an object has been loaded or initialized, an event can be fired to alert any interested third parties. |
|
| 6. |
What Is Dependency Injection / Ioc Containers? |
|
Answer» Inversion of Control (IOC) and dependency injection are TWO design patterns that are closely related and the container is BASICALLY a chunk of INFRASTRUCTURE code that does both of these patterns for you. IoC pattern is about DELEGATING responsibility for construction and the dependency injection pattern is about providing dependencies to an object that's already been constructed. Inversion of Control (IoC) and dependency injection are two design patterns that are closely related and the container is basically a chunk of infrastructure code that does both of these patterns for you. IoC pattern is about delegating responsibility for construction and the dependency injection pattern is about providing dependencies to an object that's already been constructed. |
|
| 7. |
In How Many Ways Can You Express Validation? |
|
Answer» You can use the following ways of expressing VALIDATION that are supported by WPF DATA binding:
You can use the following ways of expressing validation that are supported by WPF data binding: |
|
| 8. |
What Is Validation In Mvvm? |
|
Answer» When your application starts accepting data input from end USERS you need to CONSIDER VALIDATING that input. To make sure it CONFORMS to your overall requirements. When your application starts accepting data input from end users you need to consider validating that input. To make sure it conforms to your overall requirements. |
|
| 9. |
Does Each And Every Piece Of Child Content That You Separate Into Its Own Xaml File Necessarily Needs To Be An Mvvm View? |
|
Answer» No, if the chunk of content just PROVIDES the structure to render something to the screen and does not support any input or manipulation by the user for that content. It may not need a SEPARATE ViewModel, but it COULD just be a chunk XAML that renders BASED on properties exposed by the parents ViewModel. No, if the chunk of content just provides the structure to render something to the screen and does not support any input or manipulation by the user for that content. It may not need a separate ViewModel, but it could just be a chunk XAML that renders based on properties exposed by the parents ViewModel. |
|
| 10. |
What Is Delegate Command? |
|
Answer» In between the invoker and the receiver you have an obstruction layer that does not ALLOW the invoker and the receiver to explicitly know about each other. This is typically represented as an interface abstraction EXPOSED to the invoker and a CONCRETE implementation of that interface is CAPABLE of calling the receiver. In between the invoker and the receiver you have an obstruction layer that does not allow the invoker and the receiver to explicitly know about each other. This is typically represented as an interface abstraction exposed to the invoker and a concrete implementation of that interface is capable of calling the receiver. |
|
| 11. |
What Are The Responsibilities Of Invoker And Receiver In Command Pattern? |
|
Answer» There are two main actors, the invoker and the receiver in Command pattern. Invoker : Invoker is a piece of code which can EXECUTE some imperative logic. Typically, it is a UI element that the user interacts with in the CONTEXT of a UI framework. But it COULD just be ANOTHER chunk of logic code somewhere else in the application. Receiver : Receiver is the logic that is intended for execution when the invoker fires. In the context of MVVM, the receiver is typically a method in your ViewModel that needs to be CALLED. There are two main actors, the invoker and the receiver in Command pattern. Invoker : Invoker is a piece of code which can execute some imperative logic. Typically, it is a UI element that the user interacts with in the context of a UI framework. But it could just be another chunk of logic code somewhere else in the application. Receiver : Receiver is the logic that is intended for execution when the invoker fires. In the context of MVVM, the receiver is typically a method in your ViewModel that needs to be called. |
|
| 12. |
How Viewmodel First Construction Approach Leverages The Capabilities Of Implicit Data Templates In Wpf? |
|
Answer» IMPLICIT data templates can automatically select an appropriate template from the current resource DICTIONARY for an element that uses data binding. They do this based on the TYPE of the data object which is rendered by data binding. FIRST you need to have some element that is binding to a data object. Implicit data templates can automatically select an appropriate template from the current resource dictionary for an element that uses data binding. They do this based on the type of the data object which is rendered by data binding. First you need to have some element that is binding to a data object. |
|
| 13. |
In How Many Ways Can You Bind Data? |
|
Answer» Data BINDINGS can EITHER be OneWay or TWOWAY to FLOW data BACK and forth between the View and ViewModel. Data bindings can either be OneWay or TwoWay to flow data back and forth between the View and ViewModel. |
|
| 14. |
What Is The Key Feature That Differentiates Mvvm From Other Ui Separation Patterns Like Mvc And Mvp? |
|
Answer» Data binding is the key FEATURE that DIFFERENTIATES MVVM from other UI separation patterns LIKE MVC and MVP. Data binding is the key feature that differentiates MVVM from other UI separation patterns like MVC and MVP. |
|
| 15. |
What Is The Main Reason Of Constructing Viewmodel In Code-behind? |
|
Answer» The main reason of CONSTRUCTING VIEWMODEL in code-behind INSTEAD of XAML is that the view model constructor takes parameters, but XAML parsing can only construct elements if defined in default constructor. The main reason of constructing ViewModel in code-behind instead of XAML is that the view model constructor takes parameters, but XAML parsing can only construct elements if defined in default constructor. |
|
| 16. |
What Is The View First Construction In Code-behind? |
|
Answer» Another way is that you can do view first construction by simply constructing the view model yourself in the CODE BEHIND of your View by setting the DataContext property there with the instance. Typically, the DataContext property is set in the constructor method of view, but you could ALSO DEFER the construction until the Load event of the view fires. using System.Windows.Controls; Another way is that you can do view first construction by simply constructing the view model yourself in the code behind of your View by setting the DataContext property there with the instance. Typically, the DataContext property is set in the constructor method of view, but you could also defer the construction until the Load event of the view fires. using System.Windows.Controls; |
|
| 17. |
What Is View First Construction In Xaml? |
|
Answer» One way is to simply add your ViewModel as a NESTED ELEMENT in the setter for the DataContext PROPERTY as shown in the following code. <UserControl.DataContext> One way is to simply add your ViewModel as a nested element in the setter for the DataContext property as shown in the following code. <UserControl.DataContext> |
|
| 18. |
How Many Ways Are Used To Construct Views? |
|
Answer» There are two ways to construct views. You can USE any ONE of them. There are two ways to construct views. You can use any one of them. |
|
| 19. |
What Are The Responsibilities Of Viewmodel? |
|
Answer» ViewModel is the main point of MVVM application. The primary responsibility of ViewModel is to provide data to the view, so that view can put that data on the screen.
ViewModel is the main point of MVVM application. The primary responsibility of ViewModel is to provide data to the view, so that view can put that data on the screen. |
|
| 20. |
What Are The Responsibilities Of View? |
|
Answer» The main purpose and responsibilities of views is to define the structure of what the user sees on the SCREEN. The structure CONTAINS static and dynamic parts. • Static parts are the XAML hierarchy that defines the controls and layout of controls that a view is composed of. The main purpose and responsibilities of views is to define the structure of what the user sees on the screen. The structure contains static and dynamic parts. • Static parts are the XAML hierarchy that defines the controls and layout of controls that a view is composed of. |
|
| 21. |
Which In Wpf Means Data Binding? |
|
Answer» The LAST responsibility is validation which is optional, but you can embed the validation information on the model OBJECTS by USING the WPF data binding validation features VIA INTERFACES like INotifyDataErrorInfo/IDataErrorInfo. The last responsibility is validation which is optional, but you can embed the validation information on the model objects by using the WPF data binding validation features via interfaces like INotifyDataErrorInfo/IDataErrorInfo. |
|
| 22. |
What Are The Responsibilities Of Model? |
|
Answer» In general, model is the simplest one to understand. It is the client side data model that supports the views in the APPLICATION.
In general, model is the simplest one to understand. It is the client side data model that supports the views in the application. |
|
| 23. |
What Are The Disadvantages Of Mvvm? |
| Answer» | |
| 24. |
What Are The Benefits Of Mvvm? |
|
Answer» The key BENEFIT is allowing true separation between the View and Model beyond achieving separation and the efficiency that you gain from having that. What it means in real TERMS is that when your model needs to change, it can be changed EASILY without the view needing to and vice-versa. There are three key things that flow out of applying MVVM:
The key benefit is allowing true separation between the View and Model beyond achieving separation and the efficiency that you gain from having that. What it means in real terms is that when your model needs to change, it can be changed easily without the view needing to and vice-versa. There are three key things that flow out of applying MVVM: |
|
| 25. |
What Are The Logical Layers Of Mvvm? |
| Answer» | |
| 26. |
What Is Mvvm? |
|
Answer» The Model, View, VIEWMODEL (MVVM pattern) is all about guiding you in how to organize and structure your code to write MAINTAINABLE, testable and EXTENSIBLE applications. The Model, View, ViewModel (MVVM pattern) is all about guiding you in how to organize and structure your code to write maintainable, testable and extensible applications. |
|