Thursday, 31 October 2013

WPF INTERVIEW QUESTIONS - MANOHAR GOUD 9866550012



Question :

What the first class that is loaded by any new WPF Application project?

Answer :

App. App.xaml and App.xaml.cs.

Question :

What is a DependencyProperty?

Answer :

Represents a property that can be set through methods such as, styling, data binding, animation, and inheritance.

Question :

What tool should you use sketch a mock of your WPF application?

Answer :

SketchFlow

Question :

What are common Localization/Globalization practices for Localizing/Globalizing WPF?

Answer :

1) Use Resources.resx
2) Use BAML
3) Use a ResourceDictionary to manage localizable strings.

Question :

What is the difference between X:name and x:key?

Answer :

X:name idetifies a UIElment in XAML Tree
X:Key identifies objects in resources section, can be accessed by resourceDictionary

Question :

What are the Resources, Styles and Triggers?

Answer :

Style - element containing setter elements.
Triggers - used to change the look and feel of the controls dynamically.
Resources - Styles and Triggers are stored in the resources
Static Resources - resources are searched at load time
Dynamic Resources - If the resource changes while the program is running

Question :

What is Property Invalidation?

Answer :

Its used to update the custom control whenever the property changes.Adding property invalidation callbacks to a custom control is as easy as adding a PropertyChangedCallback object to a PropertyMetadata object and add this PropertyMetadata object to Register() or RegisterAttached() methods.



Question :

What is the purpose of AccessText?

Answer :

AccessText enables you to specify displayed text with an embedded keyboard shortcut used to access the corresponding control. Simply precede the desired letter of the text with an underscore.

Question :

What are the types of Inlines that can be used in a TextBlock?

Answer :

Span
Bold
Italic
Underline
Hyperlink
Run
LineBreak
InlineUIContainer
Figure
Floater

Question :

What is the most common format for declaring a data binding in markup?

Answer :

Markup extensions are the most common means of declaring a data binding. They are identified by the use of curly brackets ({}).The less common format is XAML.

Question :

Is x:Static the same as a data binding?

Answer :

x:Static is another markup extension that is different from the data binding markup extension. It is used to retrieve data from static value members on classes.

Question :

How many ways are there to deploy WPF applications, and what are they?

Answer :

There are three ways to deploy WPF applications :
as a simple XAML file
an XBAP
or a standard executable.

Question :

How do navigation applications differ from standard WPF applications?

Answer :

Navigation applications are based on a web browser metaphor. They use pages instead of windows, and they include a forward and back button by default.

Question :

What type of elements can be hosted in a ToolBar?

Answer :

A ToolBar can host any type of .NET class.

Question :

What is the simplest and most common way to componentize a complex UI?

Answer :

The easiest way to break up a complex UI is to create separate UserControls for related parts and reference them from the original UI.

Question :

What class is used to save and load the content of a RichTextBox?

Answer :

To save or load the content of a RichTextBox, use the TextRange class.

Question :

What are the types of binding in WPF?

Answer :

There are two types of binding in WPF :
Key Binding
Mouse Binding

Question :

What is the difference between key binding and mouse binding?

Answer :

KeyBinding allows you to define gestures for commands that consist of a keystroke possibly combined with one or more modifiers, whereas MouseBinding allows you to define gestures for the mouse that can also be optionally combined with modifiers on the keyboard.

Question :

What type is used to render WPF output to a bitmap?

Answer :

Use RenderTargetBitmap to render WPF visuals to a bitmap.

Question :

What is the base class for all renderable types in WPF?

Answer :

All elements that are renderable must inherit from Visual.

Question :

What is a repository?

Answer :

A repository is a type of class that hides the actual data storage mechanism from the rest of the application.


Question :

What are the types sibling libraries in WPF?

Answer :

There are three types of sibling libraries of WPF are :
WCF
WF
CardSpace

Question :

What is the difference between WCF and WF?

Answer :

Windows Communication Foundation is focused on messaging. This API greatly simplifies all sorts of networking and communication tasks. It covers everything from web services to remoting to P2P and more.
A powerful library for building workflow enabled applications. It utilizes a markup language for declaring workflows in an application,and thus prevents workflow from becoming hard-coded. It also makes it very easy for developers to create custom workflow tasks.

Question :

What is XAML?

Answer :

XAML (pronounced as Zammel) is a declarative XML-based language by which you can define object and properties in XML. XAML document is loaded by a XAML parser. XAML parser instantiates objects and set there properties. XAML describes objects, properties and there relation in between them. Using XAML, you can create any kind of objects that means graphical or non-graphical.

Question :

What is the benefit of using a markup language for designing a user interface?

Answer :

Using a markup language such as XAML, or even HTML, is beneficial because it provides a common medium for both designers and developers. Additionally, the markup language allows for a declarative approach for building applications, which is often easier to construct and maintain.

Question :

What are the types of binding modes?

Answer :

There are three different binding modes :
one–way
two–way
one–way–to–source

Question :

What is the difference between a XAML file and a code-behind file?

Answer :

The XAML file contains the XAML markup, whereas the code-behind file is associated with a XAML file and contains code (such as C# or VB).

Question :

Which files are automatically added to a new WPF Application project?

Answer :

App.xaml and Window1.xaml, along with their associated code-behind files. The former represents the application as a whole, whereas the latter represents the primary window of the application.

Question :

What is the purpose of the x:Name attribute in XAML?

Answer :

The x:Name attribute allows you to uniquely identify an instance of an object defined in XAML. The value of the x:Name attribute can be referenced in the associated C# or VB code.

Question :

What is a feature of XAML that is available when it is compiled rather than interpreted?

Answer :

When your XAML is compiled, you can embed procedural code such as C# or VB. For more information about this, look up the markup extension x:Code.

Question :

What is an attached property?

Answer :

An attached property is a property that is declared by one control and attached to another. It allows the inclusion of additional information with a control for later use by an external source.

Question :

What kind of documents are supported in WPF?

Answer :

There are two kind of major document supported in
WPF Fixed format documents
Flow format document.

Question :

What is the difference between fixed format documents and flow format documents?

Answer :

Fixed format documents look like PDF format. They display content regardless of screen size and resolution. But Flow format document adjust depending on screen size and resolution.

Question :

What is the difference between a Panel and a Decorator?

Answer :

A Panel has a collection of Children that it arranges according to various rules, based on the type of panel.
A Decorator, on the other hand, has only one Child to which it applies some additional set of behavior.

Question :

What is the feature of silverlight 4?

Answer :

Silverlight 4 is the current version at the time of writing and it introduced a number of new features, including :
Support for Google’s Chrome web browser
Access to the user’s web cam and microphone
Mousewheel input
Enhancements to existing controls, such as the DataGrid
New controls, such as the RichTextBox
Enhanced data binding support
Managed Extensibility Framework support
WCF RIA services

Question :

What are the types of common file dialogs that WPF supports?

Answer :

The common file dialogs that WPF supports include SaveFileDialog, OpenFileDialog, and PrintDialog. WPF does not presently have a common dialog for folder selection, font selection, or print preview.

Question :

What is the name of the FrameworkElement most commonly used to work with media in WPF?

Answer :

MediaElement is used to play back a variety of audio and video formats.

Question :

What are two common properties on all the Shape classes?

Answer :

There are more than a dozen properties on the base class System.Windows.Shapes.Shape.
Fill
Stroke
StrokeDashArray
StrokeDashCap
StrokeEndLineCap
StrokeLineJoin
StrokeMiterLimit
StrokeStartLineCap
StrokeThickness

Question :

What are the different types of brushes that WPF offers?

Answer :

There are six different types of brushes
SolidColorBrush
LinearGradientBrush
RadialGradientBrush
DrawingBrush
VisualBrush
ImageBrush

Question :

What are the four channels of a WPF Color object?

Answer :

There are four channels of a WPF color objects are :
Alpha
Red
Green
Blue

Question :

What are the types of bitmap effects?

Answer :

The built-in bitmap effects are :
DropShadowBitmapEffect
OuterGlowBitmapEffect
BlurBitmapEffect
EmbossBitmapEffect
BevelBitmapEffect

Question :

What are the two types of transforms present on FrameworkElement?

Answer :

The two transforms that are present on FrameworkElement are RenderTransform and LayoutTransform.

Question :

What is Windows Workflow Foundation?

Answer :

WWF is a programming model for building workflow-enabled applications on windows. System.Workflow namespace has all the necessary modules to develop any type of workflow.

Question :

What is a Workflow?

Answer :

A Workflow is a set of activities, which is stored as model and they depict a process.Workflow is run by the Workflow runtime engine.

Question :

What Is ObservableCollection ?

Answer :

ObservableCollection is a collection that allows code outside the collection be aware of when changes to the collection (add, move, remove) occur. It is used heavily in WPF and Silverlight but its use is not limited to there. Code can add event handlers to see when the collection has changed and then react through the event handler to do some additional processing. This may be changing a UI or performing some other operation.

An observable collection works essentially like a regular collection except that it implements the interfaces: INotifyCollectionChanged, INotifyPropertyChanged



Properties
NameDescription
CountGets the number of elements actually contained in the Collection. (Inherited from Collection.)
ItemGets or sets the element at the specified index. (Inherited from Collection.)
ItemsGets a IList wrapper around the Collection. (Inherited from Collection.)


Methods
NameDescription
AddAdds an object to the end of the Collection. (Inherited from Collection.)
ClearRemoves all elements from the Collection. (Inherited from Collection.)
ClearItemsRemoves all items from the collection. (Overrides Collection.ClearItems().)
ContainsDetermines whether an element is in the Collection. (Inherited from Collection.)
InsertInserts an element into the Collection at the specified index. (Inherited from Collection.)
RemoveRemoves the first occurrence of a specific object from the Collection. (Inherited from Collection.)
RemoveAtRemoves the element at the specified index of the Collection. (Inherited from Collection.)
ToStringReturns a string that represents the current object. (Inherited from Object.)

Question :

What Is List ?

Answer :

Represents a strongly typed list of objects that can be accessed by index. Provides methods to search, sort, and manipulate lists.

Arrays do not dynamically resize. The List type does. With List, you do not need to manage the size on your own. This type is ideal for linear collections not accessed by keys. It provides many methods and properties.



Properties
NameDescription
CapacityGets or sets the total number of elements the internal data structure can hold without resizing.
CountGets the number of elements actually contained in the List.
ItemGets or sets the element at the specified index.


Methods
NameDescription
AddAdds an object to the end of the List.
AddRangeAdds the elements of the specified collection to the end of the List.
AsReadOnlyReturns a read-only IList wrapper for the current collection.
ClearRemoves all elements from the List.
ContainsDetermines whether an element is in the List.
FindSearches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List.
FindAllRetrieves all the elements that match the conditions defined by the specified predicate.
ForEachPerforms the specified action on each element of the List.
IndexOf(T)Searches for the specified object and returns the zero-based index of the first occurrence within the entire List.
InsertInserts an element into the List at the specified index.
InsertRangeInserts the elements of a collection into the List at the specified index.
RemoveRemoves the first occurrence of a specific object from the List.
RemoveAllRemoves all the elements that match the conditions defined by the specified predicate.
RemoveAtRemoves the element at the specified index of the List.
RemoveRangeRemoves a range of elements from the List.
Sort()Sorts the elements in the entire List using the default comparer.
ToStringReturns a string that represents the current object. (Inherited from Object.)

Question :

What Is IEnumerable Collection ?

Answer :

Exposes an enumerator, which supports a simple iteration over a non-generic collection.



Methods
NameDescription
GetEnumeratorReturns an enumerator that iterates through a collection.


ObservableCollectionList
ObservableCollection is a generic dynamic data collection.It represents a strongly typed list of objects that can be accessed by index.
Its provides notifications (using an interface "INotifyCollectionChanged") when items get added, removed, or when the whole collection is refreshed.In the sample application, the values in the list are added, removed and changed during runtime in the code behind. The changes in the list will not be updated to the UI
Manupulation not allowed in ObservableCollectionA list provides methods to search, sort, and manipulate lists.

IEnumerableList
IEnumerable is an interfase, any class that subscribe to this needs to comply with it.List is a class that defines a generic collection
Enumerable describes behaviorList is an implementation of that behavior
IEnumerable is an interface - you can't create an IEnumerable, but rather must create some class that implements IEnumerable.List, on the other hand, is a concrete class. It implements IEnumerable directly.
IEnumerable basically only supports iterating over the results contained in the collectionList is more specific, and allows you to:
* Find out how many items are in the collection without iterating through all of them
* Easily access an item in a specific position in the list
* Add or remove items from the list
IEnumerable can move forward only over a collection, it can’t move backward and between the items.List is used to access an element in a specific position/index in a list.
IEnumerable doesn't support add or remove items from the list.List is useful when you want to Add or remove items from the list.
IEnumerable supports deferred execution.List supports deferred execution.
IEnumerable supports further filtering.List doesn't support further filtering.

IEnumerableObservableCollection
IEnumerable is simply an interface and any number of classes could be behind the actual implementation it.ObservableCollection is a generic dynamic data collection.
We don't really bind the IEnumerable, since that is an interface, but you are binding some collection/list that implements IEnumerable.ObservableCollection also implements IEnumerable so should be able to safely use that as the ItemSource instead.
IEnumerable is an interface - you can't create an IEnumerable, but rather must create some class that implements IEnumerable.ObservableCollection, on the other hand, is a concrete class. It implements IEnumerable directly.
IEnumerable basically only supports iterating over the results contained in the collectionObservableCollection is more specific, and allows you to:
* Find out how many items are in the collection without iterating through all of them
* Easily access an item in a specific position in the Collection
* Add or remove items from the Collection
IEnumerable can move forward only over a collection, it can’t move backward and between the items.ObservableCollection is used to access an element in a specific position/index in a list.
IEnumerable doesn't support add or remove items from the list.ObservableCollection is useful when you want to Add or remove items from the list.
IEnumerable supports deferred execution.ObservableCollection supports deferred execution.
IEnumerable supports further filtering.ObservableCollection doesn't support further filtering.



No comments:

Post a Comment