Sunday, May 27, 2012

SharePoint Interview Questions and Answers: Basics

My next series of posts will be related to SharePoint Interview questions and answers. This will help most of you guys. What I am gonna do is - Simply take any topic in SharePoint and provide the list of questions and answers asked by the interviewer. I have some good amount of experience in interviewing the people, cause in my career many time I was on the interviewer's chair than interviewee.

Lets start with the SharePoint Basics:

1. What is Ghosting?
- page ghosting is an optimization used with site pages in which a single page template can be used to process multiple page instances across many different site. A page template, such as default.aspx, is compiled into an assembly dynamic-link library (DLL) and loaded into memory just once per Web application. When a user customizes a site page by using the SharePoint Designer and then saves those changes, a customized version of the page definition is stored in the content database.

2. SPVirtualPathProvider
- WSS stores storing customized versions of .aspx files and .master files inside the content database and retrieving them on demand when they are needed to process an incoming page request.
SPVirtualPathProvider is able to retrieve an ASP.NET page file from the content database, such as default.aspx, and then pass it along to the ASP.NET page parser.

3. Difference between Site pages and Application pages.
- Pages that support user customization are known as site pages. home page (default.aspx) is a site page. It supports user customization by using tools such as the SharePoint Designer.
Application page does not support customization. The standard Site Settings page (settings.aspx) is a good example of an application page. It can be accessed from any site, yet it does not support customization.
Application pages are deployed as physical files on the file system of the front-end Web server in a directory at the following path:
SharePoint 2007: c:\program files\common files\microsoft shared\
web server extensions\12\TEMPLATE\LAYOUTS {12 hive}
SharePoint 2010: c:\program files\common files\microsoft shared\
web server extensions\14\TEMPLATE\LAYOUTS 
{14 hive}
4. Why SafeControls entry required in web.config in SharePoint
- It determines what controls a user might place on a customized page. For example, imagine a scenario in which a site administrator tries to mount an attack by adding a server-side control to a site page and parameterizing it in a certain way. Safe mode allows the farm administrator to determine which controls can be used in pages that are processed in safe mode.

5. What are the Featutes?
- Features provide a mechanism for defining site elements and adding them to a target site or site collection through a process known as feature activation. 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. A feature consists of a directory created within a special WSS system directory:

c:\program files\common files\microsoft shared\web server extensions\12\TEMPLATE\Features
The directory for a feature contains one or more XML-based files that contain Collaborative Application Markup Language (CAML). Each feature directory contains a manifest file named feature.xml that defines the high-level attributes of the feature, such as its Id, Title, Description, Version, Scope, Hidden and ImageUrl. It also contains one or more additional XML files (elements.xml) that define the actual elements that make up the feature.
Feature Scopes:
The Scope defines the context in which the feature can be activated and deactivated. The feature we are creating has a scope equal to Web, which means it can be activated and deactivated within the context of the site. If you assign a Scope value of Site, your feature will then be activated and deactivated within the scope of a site collection. The two other possible scopes for defining a feature are WebApplication scope and Farm scope.
Feature EventReceivers:
Create a class that inherits from the SPFeatureReceiver class. As you can see, you handle events by overriding virtual methods in the base class such as FeatureActivated and FeatureDeactivating. There are also two other event handlers that fire when a feature is FeatureInstalled or FeatureUninstalled

6. What is site column?
- A site column is a reusable column definition that can be used across multiple lists. A site column defines the name for a column, its underlying field type, and other characteristics such as the default value, formatting, and validation. Advantage is that you can update the site column in a single place and have that update affect all the lists where the site column has been used.

7. What is Content Type?
- 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.
You can also existing list columns to the list content types on the list. Also when you add columns directly to a list, and that list contains multiple content types, you can specify whether you want the new column to be referenced in all the content types on that list.

8. SharePoint Lists.
- At the heart of the core WSS architecture is the infrastructure for defining list types and provisioning list instances to store content. Document libraries, which play a vital role in creating WSS business solutions.
Following are the List Types. I have highlited some list types, which are majorly used in SharePoint Development:
List Type
Document library
Used for collaborating on documents with support for versioning, check-in and check-out, and workflow. Includes support for deep integration with Microsoft Office.
Form library
Used to store XML documents and forms for use with Microsoft Office InfoPath.
Wiki page library
Used for collaborative Web pages based on wiki pages, which are dynamically generated and collaboratively edited Web pages.
Picture library
A specialized document library enhanced for use with pictures. Includes support for slide shows, thumbnails, and simple editing through Microsoft Office Picture Manager.
Used for simple sharing of timely news with support for expiration.
A list for tracking people and contact information, with support for integration into Microsoft Office Outlook and other WSS-compatible contacts applications.
A simple list for threaded discussions with support for approval and managing discussion threads.
A list for managing hyperlinks.
A list for tracking upcoming events and deadlines. Includes support for integration and synchronization with Office Outlook.
A list of activity-based items that can integrate with workflow.
Project tasks
An enhanced tasks list with support for Gannt chart rendering and integration with Microsoft Office Project.
Issue tracking
A list for tracking issues and resolution, with support for prioritization.
Custom list
An empty list definition for extending with custom columns, or created using Microsoft Office Excel spreadsheets.

SharePoint Object model code to access any list:
SPList list = null;
using (SPSite site = new SPSite("http://siteurl"))
      using (SPWeb web = site.OpenWeb())
string listName = "SampleList";
list = web.Lists[listName];
// list = web.GetList("/Lists/ SampleList"); This method is // useful, as no code change required when the list Title // changes.

SPListItem newItem = list.Items.Add();
newItem ["Title"] = "First Item";
// You can use newItem.SystemUpdate(); if you don’t want  // update modified date and version.

To get specific results within a list, you can use the SPQuery object as follows: 
query.ViewFields = @"<FieldRef Name='Title'/><FieldRef Name='Expires'/>";query.Query =@"<Where><Lt><FieldRef Name='Expires' /><Value Type='DateTime'><Today /></Value></Lt></Where>";
SPList list = site.Lists["SampleList"];
SPListItemCollection items = list.GetItems(query); 
SPSiteDataQuery class can return items from many different lists through an entire site collection. hence queries run with the SPSiteDataQuery class are sometimes referred to as cross-site queries.
I have added some of the question which might help you guys...
I will update same post with more useful question and answers immediately...


  1. IT seem you gave lot of Interview questions :P

  2. please upload sharepoint 2010 interview questions

  3. We are waiting for the next set of questions :D :D

    1. Sorry guys, I will definitely add new post as soon as i get some time...

  4. When wud u get time to post the nex one?

  5. Awesome work.Just wanted to drop a comment and say I am new to your blog and really like what I am reading.Thanks for the share