Friday, January 7, 2011

SharePoint Interview Questions -5

What does AllowUnsafeUpdates do ?

If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting theAllowUnsafeUpdates property. C#:
1
2
3
4
5
6
7
8
9
10
using(SPSite mySite = new SPSite("yourserver"))
{ using(SPWeb myWeb = mySite.OpenWeb())
{
myWeb.AllowUnsafeUpdates = true;
SPList interviewList = myWeb.Lists["listtoinsert"];
SPListItem newItem = interviewList.Items.Add();
newItem["interview"] = "interview";
newItem.Update();
}
}


- What does RunWithElevatedPrivileges do?

Assume that you have a Web Part in which you want to display information obtained through the Windows SharePoint Services object model, such as the name of the current site collection owner, usage statistics, or auditing information. These are examples of calls into the object model that require site-administration privileges. Your Web Part experiences an access-denied error if it attempts to obtain this information when the current user is not a site administrator. The request is initiated by a nonprivileged user. you can still successfully make these calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class. C#:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
SPSite siteColl = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite ElevatedsiteColl = new SPSite(siteColl.ID))
{
using (SPWeb ElevatedSite = ElevatedsiteColl.OpenWeb(site.ID))
{
string SiteCollectionOwner = ElevatedsiteColl.Owner.Name;
string Visits = ElevatedsiteColl.Usage.Visits.ToString();
string RootAuditEntries = ElevatedSite.RootFolder.Audit.GetEntries().Count.ToString();
}
}
});


- What is a SharePoint Feature? What files are used to define a feature?

A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances.
Scopes include
  • Farm
  • WebApplication
  • Site (site collection)
  • Web (site)
Features have their own receiver architecture, which allow you to trap events such as when a feature is
  • installing
  • uninstalling
  • activated
  • deactivated
The element types that can be defined by a feature include
  • menu commands
  • link commands
  • page templates
  • page instances
  • list definitions
  • list instances
  • event handlers
  • workflows
The two files that are used to define a feature are
  • feature.xml
  • manifest file(elements.xml)
The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality.
Common stsadm commands associated with feature are
  • stsadm -o installfeature
  • stsadm -o uninstallfeature
  • stsadm -o activatefeature
  • stsadm -o deactivatefeature


- What are content types ?

A content type is a flexible and reusable WSS type definition that defines the columns and behavior for an item in a list or a document in a document library.
For example,
-you can create a content type for a customer presentation document with a unique set of columns, an event handler, and its own document template.
-You can create a second content type for a customer proposal document with a different set of columns, a workflow, and a different document template.
Then you can attach both the contenttypes to a document library, which allows you to capture metadata based on the contenttype selected during creation of the document.

Content type can be created by the following
  • from the rootweb of a site collection, go to Site Action > Site Settings > Galleries > Site content types
  • using a feature


5. Workflow can be applied to what all elements of SharePoint ?

While workflow associations are often created directly on lists and document libraries, a workflow association can also be created on a content type that exists within the Content Type Gallery for the current site or content types defined within a list.
In short, it can be applied ...
  • At the level of a list (or document library)
  • At the level of a content type defined at site scope
  • At the level of a site ( Sharepoint 2010 )


- What are the ways to initiate the workflow ?

  • Automatic (on item added or item deleted)
  • Manual (standard WSS UI interface)
  • Manual (Custom UI Interface)
  • Programatically through custom code


7. What are the types of input forms that can be created for a workflow ?

You can create four different types of input forms including an association form, an initiation form, a modification form, and a task edit form. Note that these forms are optional when you create a workflow template.


8. What are ways to create input forms for workflow ?

Two different approaches can be used to develop custom input forms for a WSS workflow template.
  • You can create your forms by using custom application pages, which are standard .aspx pages deployed to run out of the _layouts directory. ( disadv: lot of code required when compared to Infopath approach)
  • using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)


9. What is the difference between method activity and event activity in WF ?

A method activity is one that performs an action, such as creating or updating a task. An event activity is one that runs in response to an action occurring.


10. What does SPWeb.EnsureUser method do?

Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site. e.g SPUser usr = myWeb.EnsureUser("mmangaldas");


11. While creating a Webpart, which is the ideal location to Initialize my new controls ?

Override the CreateChildControls method to include your new controls. To make sure that the new controls are initialized.. call 'EnsureChildControls' in the webparts Render method. You can control the exact Rendering of your controls by calling the .Render method in the webparts Render method.


12. How to query from multiple lists ?

Use SPSiteDataQuery to fetch data from multiple lists.


13.How Does SharePoint work?

The browser sends a DAV packet to IIS asking to perform a document check in. PKMDASL.DLL, an ISAPI DLL, parses the packet and sees that it has the proprietary INVOKE command. Because of the existence of this command, the packet is passed off to msdmserv.exe, who in turn processes the packet and uses EXOLEDB to access the WSS, perform the operation and send the results back to the user in the form of XML.


14. What is the difference between Syncronous & Asyncronous events?

Syncronous calls ending with 'ing' E.g. ItemDeleting Event Handler code execute BEFORE action is committed WSS waits for code to return Option to cancel and return error code
Asyncronous calls ending with 'ed' E.g. ItemDeleted Event Handler code executes AFTER action is committed WSS does not wait for code to return Executed in its own Worker thread.


15. What is ServerUpdate() ?

Any changes in the list, i.e. new addition or modification of an item.. the operation is complete by calling the Update method.But if a List is set to maintain versions .. and you are editing an item, but don't want to save it as a new version, then use the SystemUpdate method instead and pass in 'false' as the parameter.


16. What is query.ViewAttributes OR How can you force SPQuery to return results from all the folders of the list?

If you use SPQuery on any SPlist .. it will bring back results from the current folder only. If you want to get results from all the folders in the list.. then you need to specify the scope of the query by the use of ViewAttributes..
e.g. query.ViewAttributes = "Scope=\"Recursive\"";

SharePoint Interview Questions -4

Que 6: How would you define configurable properties in a webpart?
Ans 6: Here is a simple example of creating a property that can be configured by the users. Notice how each attribute is separated by commas (,).

[code:c#]
[Browsable(false),Category("Miscellaneous"),
DefaultValue(defaultText),
WebPartStorage(Storage.Personal),
FriendlyName("Text"),Description("Text Property")]
public string Text
{
get
{
return text;
}

set
{
text = value;
}
}
[/code]

Que 7: What is a feature scope and where is it defined?
Ans 7: A feature scope restricts the use of feature to different heiarchy available in SharePoint object model. The scope is defined in the feature.xml file. Here are the different levels of scope available.

a) Web: This restrict the use of feature to the scope of a site e.g HR site feature cannot be used in Accounting Site.
b) Site: This restricts the use of feature to a specific Site Collection.
c) WebApplication: This restrict the use of feature to the scope of web application.
d) Farm: This is the highest level available. A feature defined with the scope of Farm is available to all the web application, site collections and websites defined in the Farm.

Que 8: What is a Site Definition? How can you create a new Site Definition?
Ans 8: A site definition is a collection of files that defines the structure & layout of site templates. Confused? Well, don't be. A site definition comprised of a webtemp.xml file which in turn defined the order of various site templates available in that site definition. Site definition file also include a separate directory structure that includes all the other core files required. The webtemp.xml file is stored in%COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML location and directory that contains all the core files is %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions \12\TEMPLATE\SiteTemplates.

Steps for creating a custom Site Definition.

Step 1.Create a copy of existing site Definition structure by navigating to %COMMONPROGRAMFILES%\\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates. Rename the file as NewLOB (short form for New line of business).

Step 2. Navigate to %COMMONPROGRAMFILES%\\Microsoft Shared\web server extensions\12\TEMPLATE\1033and copy the STS directory and paste it in the same strucutre and rename it as NewLOB.

Step 3. Create webTemp.xml file to register the site definition created in step 1&2.

Step 4. Reset IIS.

Thats it. Now, new site definition is available for use for the new line of business group.

Que 9: Explain the concept of feature Stapling?
Ans 9: In order to follow the best practices set forth by Microsoft, we should not modify the out-of-box site definiton file. So how would you achieve the customized needs of the business without having to create a brand new Site Definition files and structure? The answer is Feature Stapling. Feature stapling is a feature developed to staple (or read attach) another feature to one or more out-of-box site definition (technically speaking, it can include your custom site definition also). Here is an example of feature stapling that staples feature to different STS's.

[code:xml]
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<FeatureSiteTemplateAssociation Id="00BFE171-1B17-4F72-28CB-1171C0140130"TemplateName="STS#0" />
<FeatureSiteTemplateAssociation Id="00BFE171-1B17-4F72-28CB-1171C0140130"TemplateName="STS#1" />
<FeatureSiteTemplateAssociation Id="00BFE171-1B17-4F72-28CB-1171C0140130"TemplateName="STS#2" />
Elements>
[/code]

Que 10: What is the role of IFilter in SharePoint?
Ans 10: IFilter is a component installed on the server (Indexing and WFEs) to index documents that with file format associated with IFilter. Out-of-box WSS supports IFilter for Word, Excel, Text, HTML, PPT, OneNote & xps. If a company stores a lot of pdf documents, the a custom IFilter install is required to enable indexing and search to support pdf formats. PDF's IFilter is freely available and can be downloaded from Adobe's website. However for tiff files, there are no free IFilter available (atleast not to my knowledge).

SharePoint Interview Questions -3

Que:1 Explain the concept of ghosting/unghosting?
Ans:1 First of all, with the release of WSS 3.0, Microsoft has renamed the concept of ghosting/unghosting as uncustomized/customized pages, but since it kind a makes look interviewer cool asking scary question, lot of people still use old term i.e. ghosting/unghosting. Anyway, In order to answer this question, we should dive into inner workings of SharePoint and how it renders site pages. For e.g. there is only 1 default.aspx page that is on the file server. But if you browse through SharePoint designer you would see multiple instances of the same file (each residing in the root of every site). Thats actually an illusion :-). If default.master is left uncustomized, then there is only 1 copy of that file which is served to all the sites in a site collection. If we chose to customize the default.master page to the needs of a particular department (eg. HR needs to have a different Navigation menu with different layout), the file is now stored in content database and served straight with the parser. This file now is only specific to the HR department sites. Now the real question is why is customizing site pages bad? Well, you can imagine if a file is ghosted (uncustomized), then the same file gets rendered to meet the needs of several hundreds of sites. But if you cutomize it and if all the deparment start to customize their site pages, then you ar e bound to have performance issues because now instead of leveraging caching etc now each request goes to the database and pages are served using the database content which adds another layer and in-turn some latency.
Here is an image on how a page looks like in SharePoint designer if it is customized. Notice, that now the tooltip also says that "Page is customized" instead of Unghosted (or whatever).


Que:2 Explain the heirarchy of SharePoint Object Model?
Ans:2 A farm is the highest entity in SharePoint object model which typically consists of a database server, an Application server (if running MOSS), and atleast 2 web front end servers. A web application is the highest level in SharePoint which is nothing but a web site in IIS 6.0. A web application can have multiple site collection and each site collection can have 1 to n web sites. Here is a picture that sums up the hiearchy of SharePoint object model.


Que:3 What are different ways in which a SharePoint workflows can be kicked off (out of box)?
Ans:3 A SharePoint workflow can be started a) manually b) automatically when a new item is inserted c) automatically when an existing item is changed.


Que:4 What are Site Pages? And how are they different from application pages?
Ans:4 Yet another commonly misunderstood phenomenon. Sites Pages are typically the pages that supports user customization. For e.g default.aspx is a site page which a developer can modify using SharePoint designer. What this also means is that now the page is customized state which will force the application to grab the file from content db and this will negatively impact performance if not administered correctly. On the other hand, an application page actually serves several website. Even-though there is just one version of the file in the physical file location, through creative use of URL re-writing (a product of .net 2.0 framework), the url appends _layout folder to each site, making it seem like copies of the same file. You can also have custom application pages and store them on physicaly drive but I will caution you to read the best practices before you venture into this.

Que:5 What are site columns? How are they beneficial?
Ans:5 Site columns allows you to create a lookup columns in one location and share the column with any custom lists that would need it. A good example where you would like to create a site column is company locations. Now every list that you create under a site collection, it will have access to this site column, which will allow to re-use the same colum site wide. In future, if your company opens new offices, then you only need to add the new location in the site column which will automatically update the all the list using that site column.

Que:6 Describe the process of adding custom web-part available to SharePoint?
Ans:6 This question is important to understand the developer's grasp on the steps required to make this happen because it really is not as easy as copying .dwp file to the file server and you are done. Nonetheless, here are the steps to make your webpart avaiable to SharePoint. a) Strongly name the assembly and sign it with snk file. Create a key/pair file using sn.exe utility. b) In the assemblyInfo.cs file add the line [assembly: AssemblyKeyFile("..\\..\\.snk")]. c) If you want the webpart to be available to all the web applcation on a server, then you will have to put the .dll file into GAC. If the need is just to enable for a certain website, then you can only copy the .dll file into the bin directly of that particular site. d) Copy the .dwp file into the wpcatalog folder and update the SafeControls section of the web.config file to include the new webpart location. Alternatively, you can also install webpart by creating a webpart package and manifest.xml & MakeCab utility. Once the cab file is created, simply run the following line.

SharePoint Interview Questions -2

What are the responsibilities of a SharePoint Architect?

What base class do custom Field Controls inherit from?

What is session and cookies?

What is the difference between session & cookies?

What is impersonation and when would you use impersonation?

What are Class Resources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?

What are content types?

What is a SharePoint Feature? What files are used to define a feature?

How to create links to the mapped network drives?

Can SharePoint compare two document versions?

Explain a basic back-up Startegy for a Portal?

What is the difference between method activity and event activity in WorkFlow?

What is the concept of virtual path provider?

What does RunWithElevatedPrivileges do?

What is the relationship between Microsoft SharePoint Portal Server and Microsoft Windows Services?

What is Windows SharePoint Services?

What is a SharePoint site definition?

What does a SPWebApplication object represent?

What is the use of SQL Server in share point?

What is the concept of safemodeparser in ASP.NET?

What is the main advantage of using site collections?

What is a Field Control?

What are the various Sharepoint 2003 and Exchange integration points?

What is the WebPartManager sealed class? What is its purpose?

What is an ancestral type and what does it have to do with content types?

How does WSS actually work?

What is the concept of Site pages and Application pages?

What is the Main difference between Windows SharePoint Services and MOSS?

SharePoint Interview Questions -1

• What is the relationship between Microsoft SharePoint Portal Server and Microsoft Windows Services?
Microsoft SharePoint Products and Technologies (including SharePoint Portal Server and Windows SharePoint Services) deliver highly scalable collaboration solutions with flexible deployment and management tools. Windows SharePoint Services provides sites for team collaboration, while Share Point Portal Server connects these sites, people, and business processes-facilitating knowledge sharing and smart organizations. SharePoint Portal Server also extends the capabilities of Windows SharePoint Services by providing organizational and management tools for SharePoint sites, and by enabling teams to publish information to the entire organization.

• What is a SharePoint Feature? What files are used to define a feature?
A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances, scope of which are defined as
1. Farm level 2. Web Application level 3. Site level 4. Web level
Features have their own receiver architecture, which allow you to trap events such as when a feature is
Installing, Uninstalling, Activated, or Deactivated.

The element types that can be defined by a feature include
menu commands, link commands, page templates, page instances, list definitions, list instances,
event handlers, and workflows.

The two files that are used to define a feature are the feature.xml and manifest file(elements.xml). The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality.


• Workflow can be applied to what all elements of SharePoint ?
Workflow associations are often created directly on lists and libraries, a workflow association can also be created on a content type that exists within the Content Type Gallery for the current site or content types defined within a list. In short, it can be applied ...
At the level of a list/library
At the level of a content type defined at site scope
At the level of a content type defined at list scope

• What are the types of input forms that can be created for a workflow ?
You can create four different types of input forms including
1. An association form
2. An initiation form
3. A modification form
4. A task edit form.

Note that these forms are optional when you create a workflow template.

• What are ways to create input forms for workflow ?
Two
1. You can create your forms by using custom application pages, which are standard .aspx pages deployed to run out of the _layouts directory. ( disadv: lot of code required when compared to Infopath approach)
2. Using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)

• What is the difference between method activity and event activity in WorkFlow ?
A method activity is one that performs an action, such as creating or updating a task. An event activity is one that runs in response to an action occurring.

• What are content types?
A content type is a flexible and reusable WSS type definition (or we can a template) that defines the columns and behavior for an item in a list or a document in a document library. For example, you can create a content type for a leave approval document with a unique set of columns, an event handler, and its own document template and attach it with a document library/libraries.
• Can a content type have receivers associated with it?
Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.

• What two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?
There is generally the main content type file that holds things like the content type ID, name, group, description, and version. There is also the ContentType.Fields file which contains the fields to include in the content type that has the ID, Type, Name, DisplayName, StaticName, Hidden, Required, and Sealed elements. They are related by the FieldRefs element in the main content type file.

• What is an ancestral type and what does it have to do with content types?
An ancestral type is the base type that the content type is deriving from, such as Document (0x0101). The ancestral type will define the metadata fields that are included with the custom content type.

• Can a list definition be derived from a custom content type?
Yes, a list definition can derive from a content type which can be seen in the schema.XML of the list definition in the element.

• When creating a list definition, how can you create an instance of the list?
You can create a new instance of a list by creating an instance.XML file

• What is a Field Control?
Field controls are simple ASP.NET 2.0 server controls that provide the basic field functionality of SharePoint. They provide basic general functionality such as displaying or editing list data as it appears on SharePoint list pages.

• What base class do custom Field Controls inherit from?
This varies. Generally, custom field controls inherit from the Microsoft.SharePoint.WebControls.BaseFieldControl namespace, but you can inherit from the default field controls.

• Can multiple SharePoint installs point to the same DB?
Multiple SharePoint installs can use the same database server. Not literally the same database on that server. That server must be SQL Server 2000 or SQL Server 2005. It cannot be Oracle or another vendor.

• How to create links to the mapped network drives?
Creating links to mapped drives in WSS v3 or MOSS 2007 can be done via
the new content type for .lnk files.

• While creating a Web part, which is the ideal location to Initialize my new controls?
Override the CreateChildControls method to include your new controls. You can control the exact rendering of your controls by calling the .Render method in the web parts Render method.

• What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?
There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the
SharePoint WebPart Base class
or the
ASP.NET 2.0 WebPart base class.
When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure

• What are the differences between the two base classes and what are the inherit benefits of using one over another?
The difference is the Microsoft.SharePoint.WebPartPages.WebPart base class is meant for backward compatibility with previous versions of SharePoint. The benefit of using the SharePoint WebPart base class is it supported:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure
ASP.NET 2.0 WebParts are generally considered better to use because SharePoint is built upon the ASP.NET 2.0 web architecture. Inheriting from the ASP.NET 2.0 base class offers you features that inherit to ASP.NET 2.0, such as embedding resources as opposed to use ClassResources for deployment of said types.

• What is the WebPartManager sealed class? What is its purpose?
The WebPartManager sealed class is responsible for managing everything occurring on a WebPart page, such as the WebParts (controls), events, and misc. functionality that will occur in WebPartZones. For example, the WebPartManager is responsible for the functionality that is provided when you are working with moving a WebPart from WebPartZone to WebPartZone. It is known as the “the central class of the Web Part Control Set.”

• What does AllowUnsafeUpdates do ?
If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting the AllowUnsafeUpdates property.

• What does RunWithElevatedPrivileges do?
There are certain object model calls model that require site-administration privileges. To bypass access-denied error, we use RunWithElevatedPrivileges property when request is initiated by a nonprivileged user. We can successfully make calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.
• What does SPWeb.EnsureUser method do?
Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site.
e.g SPUser usr = myWeb.EnsureUser("hitenders");

• What is a SPSite and SPWeb object, and what is the difference between each of the objects?
The SPSite object represents a collection of sites (site collection [a top level site and all its subsites]). The SPWeb object represents an instance SharePoint Web, and SPWeb object contains things like the actual content. A SPSite object contains the various subsites and the information regarding them.

• What does a SPWebApplication object represent?
The SPWebApplication objects represents a SharePoint Web Application, which essentially is an IIS virtual server. Using the class you can instigate high level operations, such as getting all the features of an entire Web Application instance, or doing high level creation operations like creating new Web Applications through code.

• Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?
Yes, since this is a Web Application level setting. You would iterate through each SPWebApplication in the SPWebApplication collection, and then use the appropriate property calls (OutboundMailServiceInstance) in order to return settings regarding the mail service such as the SMTP address.

• How do you return SharePoint List items using SharePoint web services?
In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc.
Side Question: I got asked how I built queries with the lists.asmx web service. In order to build queries with this service, one of the parameters that the GetListItems method exposes is the option to build a CAML query. There are other ways to do this as well, but that was how I answered it.

• When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?
In order to specify explicit credentials with a Web Service, you generally instantiate the web service, and then using the credentials properties of the Web Service object you use the System.Net.NetworkCredential class to specify the username, password, and domain that you wish to pass when making the web service call and operations.

• What is CAML, and why would you use it?
CAML stands for Collaborative Application Markup Language. CAML is an XML based language which provides data constructs that build up the SharePoint fields, view, and is used for table definition during site provisioning. CAML is responsible for rending data and the resulting HTML that is output to the user in SharePoint. CAML can be used for a variety of circumstances, overall is used to query, build and customize SharePoint based sites. A general use would be building a CAML query in a SharePoint WebPart in order to retrieve values from a SharePoint list.

• What is impersonation, and when would you use impersonation?
Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.

• What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?
WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

• Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?
Properties are important because WebParts allow levels of personalization for each user. WebPart properties make it possible for a user to interact, adjust, and increase overall experience value with the programmatic assets that you develop without having the need to use an external editor or right any code. A very simple example of exploiting a property would be something like allowing the user to change the text on the WebPart design interface so that they can display whatever string of text they desire.
Each custom property that you have must have the appropriate get and set accessor methods.

• What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?
ClassResources are used when inheriting from the SharePoint.WebPart.WebPartPages.WebPart base class, and are defined in the SharePoint solution file as things that should be stored in the wpresources directory on the server. It is a helpful directory to use in order to deploy custom images. In ASP.NET 2.0, typically things such as images are referenced by embedding them as resources within an assembly. The good part about ClassResources is they can help to eliminate recompiles to change small interface adjustments or alterations to external JavaScript files.

• What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?
A SharePoint solution file is essentially a .cabinet file with all a developers ustom componets suffixed with a .wsp extension that aids in deployment. The big difference with SharePoint solution files is is that a solution:
allows deployment to all WFE’s in a farm
is highly manageable from the interface allowing deployment, retraction, and versioning
Can package all types of assets like site definitions, feature definitions (and associated components), Webparts, etc.
Can provide Code Access Security provisioning to avoid GAC deployments
And much more..

• What is a .ddf file and what does it have to do with SharePoint Solution creation?
A .ddf file is a data directive file and is used when building the SharePoint solution bundle specifying the source files and their destination locations. The important thing for someone to understand is that the .ddf file will be passed as a parameter to the MAKECAB utility to orchestrate construction of the SharePoint solution file.

• What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?
The solution Manifest.XML file.

• What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?
SharePoint solution files can add in order to handle code access security deployment issues. This is done in the element in the SharePoint solution manifest.XML, which makes it easier to get assemblies the appropriate permissions in order to operate in the bin directory of the web application.

• What are event receivers?
Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.

• When would you use an event receiver?
Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.

• What base class do event receivers inherit from?
Event receivers either inherit from the SPListEventReciever base class or the SPItemEventReciever base class, both which derive from the abstract base class SPEventReceiverBase.

• If I wanted to not allow people to delete documents from a document library, how would I go about it?
You would on the ItemDeleting event set: properties.Cancel= true.

• What is the difference between an asynchronous and synchronous event receivers?
An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding

Tuesday, November 23, 2010

Architect Level Interview Questions

We're interviewing for Architects at work. There are stacks of sample tests around the web for programmer level roles, but not a lot for architect level roles. So we devised our own.

We tell the applicants that these questions should be answered in bullet list / note form. We don't need essays because we are going to talk about some of the issues in the interview.

  • What in your opinion is the worst part of Java development? How would you fix it?
  • What advice would you give a server side web developer wanting to ensure that new code was secure from external attacks?
  • Do you think Component based frameworks are better than Action/Request based web frameworks?
  • What recent technology trends are important to enterprise web development?
  • What do you think of Struts?
  • What's the difference between final, finally and finalize?
  • Rank the following attributes in order of importance when designing new code. If you have time, please add a sentence to each explaining it's position:
    • performance
    • maintainability
    • correctness
    • ease of use
    • ease of learning
  • Some performance tweaks serve only to make source code hard to read, without really making a significant difference, others are vital to a system returning results in a finite time. When in the development process should you consider performance issues?
  • A customer has asked you to write a toUpper function. The only requirement you have is:
    • It must return 'A' when given an input of 'a'.
    What questions do you need to ask to flesh out the requirements?

Software Architect Interview Questions - HR

The software architect is one of the reputed jobs. Let me tell you that it is a very highly paid job as well. The information architect is also a kind of software architect. If you want to make sure that you are selected for this post then you will definitely have to make sure that you prepare hard for the interview. This is a senior job and there will be no written test for this.

Some of the interview questions are as follows:

1. Tell us about yourself ?

I am XYZ. I am placed at XYZ InfoTech. It is now more than two years since I am working in this firm.

2. What to you know about our company?
It is among the top companies engaged in providing the total IT solutions to various sets of clients.

3. Why are you changing your job?
This is because I feel that I have better chances of strengthening my career in your company. If you are confident enough then you can also say that you find their proposal better. Hence you will not like to waste this golden opportunity.

4. Who is role model?

My role model is Bill Gates.

5. Why?
This is because, he never accepts the defeat. He fights through all corners unless and until he taste the victory.

6. What do you know about the software architect?
I have been working as a project manager for the past three years. During this time I have seen many projects being completed under my guidance. It is quite sure that you I will definitely excel as a software architect. Let me tell you one more thing that software architect is a next step to the project manager. They are the expert who guides the whole software team with his invaluable ideas.

7. Why do you want to become a software architect?

This is because this is my dream since my childhood. I have always dreamed of reaching the top position in software development. Hence this is a major landmark in my career.

8. What will you do if you are not selected?

I will continue my previous job and wait for some better opportunities.

9. What will you do if you have to sit back at home for one month?
At first I will definitely not allow to let this happen. However if it does happen then I will get myself busy in job hunting so that I am able to find one job soon.

Software architect interview questions

1----------------
We usually present them with a problem, and ask them to solve it by diagramming out their solution and talking through it with us. The problem is usually something like a massive report-generation job queue that must support scalability issues, error handling, logging, multiple threads from multiple computers accessing a common database, persistence (and computers going down), alerting users when the job is done, etc. Getting responses to all of these tells us how experienced the person is.


2----------------

In my opinion there is nothing better than a concrete problem. The one that I would like best has many variations and is also appropriate for a senior developer. Namely present some vague requirements for a small application and ask for a table layout for that application. You are looking at everything from what questions they ask you, to how good their solution is, to how they deal with your throwing in unexpected requirements.

This gets you down to a concrete design issue very quickly. While it seems database specific it is not, because a table layout is fairly easily translated to a set of classes - it is the same design skill. No matter what solution they come up with you'll be able to introduce requirements they haven't thought of. Particularly since they are working on the board. It is open-ended, so you can drill as far as you want and then move on.

An example of an application you might ask about is the following. "My boss is a big fantasy baseball fan. He wants us to build a reporting application so he can track statistics on various players. It will be your job to layout the tables we will report off of, and generate the canned reports. I'll take care of getting the data into that format. Let's start with the tables you want to use."

If you think this problem is too simple, try solving it with several friends critiquing you. You'll be surprised with how many issues they can come up with. Everything from, "What happens if my data load fails in the middle? Will your schema let me re-run it?" to "Players get traded from year to year." to (if you're nasty) complications that can come when players change their names.


3----------------

  1. When should you use interfaces and when abstract classes?
  2. Inheritance or Composition?
  3. Give him a task to model the classes for a simple system like "Managing the neighborhood video rental store". Goal: See how he thinks and does he applies randmoly some design patterns. Then review the design and if you don't throw away more than 50% of the classes he designed, then he is good :)

4-------------------
What's the difference between Interface oriented, Object oriented, and Aspect oriented design/programming? What problems are they each suited for? When have you used them?

5--------------------

Next week, I'm interviewing another architect, so I've gone over my list of "things to ask an architect candidate" for another time to see if I'd change anything. Not much popped out, but I thought I'd share some exercises that I ask architecture candidates to run through.

Note: I care more about experience than book learning, but I care very much that you know the actual names for things. In other words, book learning does matter. If you never got around to reading any of those 'patterns' books, don't bother to show up. You wouldn't be considered a qualified medical intern if you referred to the Biceps Brachii as the 'upper arm muscle' and I won't consider you an architect if you can't tell that I'm using a Strategy pattern in my case study.

The things that a systems architect must do to survive an interview with me:

  • Demonstrate the ability to work on a project team with developers productively
  • Describe a time when you created a vision for a systems architecture, communicate it, and others made it come into existence
  • Tell me how you know when it is time to review code for compliance and when you are better off getting out of a developer's hair
  • Be able to guide and direct the team in the art and science of visual modeling (it's not enough to know... you must also teach).
  • Detect the gaps in the early design artifacts of a project and determine what risks are going unmanaged.
  • Be able to convince me that you understand, in your bones, the concepts of coupling, abstraction, and encapsulation.
  • Be able to describe at least five GoF patterns in fine detail. Be able to describe at least five messaging patterns in fine detail.
  • Pick a single system quality attribute that should be paramount in a particular situation, and then explain why.

Some exercises to run folks through:

A. James is an IT architect working with a team of 5 developers and 5 testers on a new system. He has a situation with his development team. He presented the high-level design for their new system at a dev meeting and the team listened politely. Then, after reviewing his diagrams, some of the members of the dev team concluded that he has created a great deal of complexity in one area that they think is overkill. James hears about it from the project manager three days later. He feels pretty strongly that the complexity is called for. Evaluate the situation. What dynamics are at play? James comes to you for advice: what do you tell him?

B. Let's say that you have 10 systems in an infrastructure. One of them provides the list of all customers, while another provides the list of all orders. You want to keep the systems as decoupled as possible but they need to share data in real time. What mechanisms do you put in place to keep the systems independent, yet fully integrated? Describe the steps you would follow to replace the system that holds orders.

C. Draw the architecture of one of your most complex systems on the white board. Now:

  • What made you partition the system in this way?
  • What data entities are mastered by your system? Which components are responsible for actually writing the key data about each entity?
  • What changes do you predict the business will want in the next 2-5 years in this system? How will the architecture cope with those changes?
  • What system quality attributes did you consider most paramount when designing this system? What attributes did you sacrifice?

D. The architectural council has invited you to join. They perform periodic reviews on major projects. You attend and a project comes before the council that has not been reviewed before. It is a medium-sized project for your company (your company will perform between three and six projects of this size each year on average). It consumes data from other systems in real time, creates transactions in other systems, and produces data for reporting. The following artifacts are provided. What additional information do you ask for? What risks are you concerned about?

  • Logical Data Model showing every data entity in the system's database
  • Deployment Diagram
  • Class-level architectural diagram illustrating the use of design patterns

E. You review the code of a junior developer, and you see a call where the developer is passing a structure. The structure contains 25 different values as parameters to the method being called. The structure is used only to pass parameters to this one method call. You ask why the call needs so many parameters, and it turns out that it is used in about eight different places in the code, and each one has a slightly different need, so the routine will look to see what parameters are passed to decide what to do. The code for the method is complex, and contains many examples of code like this:

if (paramx != null)
do_something_specific(paramx);

What patterns do you discuss with your junior developer? What options do you consider? Do you advise the developer to change the code? Why?

F. Pick one of the following practice areas and describe the ideas and concerns that led to this area of software development practice, what the practice entails, the benefits that can be achieved, and the negative consequences that may be observed by teams engaged in the practice. Note: I may pick one for you... be prepared to be asked about any of them. (If you were to ask: "why this particular list?" I'd turn that around and ask you why I picked this list... )

  • Service Oriented Architecture
  • Test Driven Development
  • Aspect Oriented Programming
  • Dependency Injection / Inversion of Control
  • Software Factories

G. Mary is a fellow architect with a problem and she has come to you for advice. She is producing an impact analysis on a system we will call "Charlie". The Charlie system gets an hourly feed of data from another system called "Bravo." The Bravo system is scheduled to be replaced by an altogether new system called "Romeo" that will organize the data in a completely different way. Unfortunately, this will radically affect the data feed from Bravo to Charlie. Not only will it vanish, but any feed from Romeo will be structured and organized in a completely different manner than it was before. Mary needs to develop a roadmap to allow this change to occur. What advice do you give her?

http://blogs.msdn.com/b/nickmalik/archive/2007/01/29/systems-architecture-interview-questions.aspx


6-------------

I think this is a good one: "What do you feel every software and/or systems architect must know?"

That will let you figure out if the candidate has the same views on what is important that what you think is important in your organization.


7--------------

Two favourites from our interview pack.

  1. Imagine you have a webserver that serves from a local disk. Currently it handles 600 requests per second. What would you expect to happen if you switched to a NAS solution such as NFS?
  2. One of the interactive features of our website is a polling system. Basically a page can have a set of radio buttons against a set of choices, and a submit button. Clicking the submit button submits the selected user choice to the server, and presents a page of results. How would you approach the design of your back end system? What if a database couldn’t be used in the design?

8----------------

What design patterns have you used in building the systems you've designed and how well did they work out? Which design patterns do you find to be the most useful? Of the design patterns you know, which was the most complicated to learn?

What kind of infrastructure have you gotten into the trenches and really gotten to know well? Here expect a laundry list of any kind of environmental setting but this may be important as if the person will be designing web applications and all they have ever done in embedded systems, you may have an initial hurdle of how well does this person know about web stuff.