SharePoint and .Net Interview questions and answers [Tech Mahindra]

SharePoint and .Net Interview questions and answers
SharePoint deveopment training course

In this blog, we will discuss SharePoint interview questions and answers which is very common and all developer must know it. I faced the same while I took an interview in Tech Mahindra. They also asked questions from Asp.Net and C#.Net.

If you are a fresher or having experience and looking out for jobs, then you can choose SharePoint as your professional career. Check out the full SharePoint Development Training Course for more information.

1: What is a SPSite and SPWeb object, and what is the difference between each of the objects?

Answer SPSite:– The SPSite object represents a collection of sites, i.e. Site Collection, a top-level site, and all its sub sites.- It is used to get a subsite of a Site Collection. It is represented within a SPSiteCollection object that consists of the collection of all site collections in the Web application. It contains the various subsites and the information regarding them.

SPWeb:– The SPWeb object represents an instance of a SharePoint Web, and the SPWeb object contains things like the actual content. It represents a SharePoint Foundation website. SPWeb object automatically adds the new SPWeb object to an internal list. It contains things like the actual content.

SharePoint and .Net Interview questions and answers
SharePoint and .Net Interview questions and answers

2: What is JSlink with example in SharePoint?

Answer: JSLink is a new approach combining JavaScript, HTML and CSS elements to customize the look of a SharePoint list view, list forms, and can control the rendering of fields. JSLink was introduced with SharePoint 2013. 

You can follow below link for more details.

3: Do you have knowledge in SharePoint Apps (Provider & SharePoint Hosted) in SharePoint Online ?

Answer: Microsoft has deprecated the use of custom managed code within the sandboxed solution in SharePoint 2013 and introduced SharePoint App model as a replacement. The app model decouples the SharePoint core product from app run-time which gives the ability to the user to run the code from any environment. 

There are two types of Apps, we can develop:

You can follow below image for more details.

SharePoint and .Net Interview questions and answers
SharePoint and .Net Interview questions and answers

4: What is the difference between Site Definition and Site Template? 

Answer: A site definition defines a unique SharePoint site. Site definition is a combination of multiple files like .xml, .aspx, .ascx, and .master page, .gif , .doc etc and are stored in C:\ProgramFiles\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\SiteTemplates directory. But Site Templates are created from an existing site and are stored in the Content database in the Sandboxed Solution gallery.

Read few SharePoint site definition and site templates tutorials:

5:  Define Display template/Item Template in SharePoint

Answer: Display Templates are used with CSWP to format/style search result generated by a CSWP search query. Display Templates control which managed property is shown in the search results and how they appear in the Web Part.

Each Display Template has two files: an HTML version of the Display Template that you can edit in your HTML editor, and a .js file that is for SharePoint use and should never be modified. CSWP uses a combination of two Display Templates, Control Templates, and Item Templates to render results.

Item Template provides HTML that determines how each item in the result set is displayed. For example, the Item Display Template might provide the HTML for a list item that contains a picture, three lines of text that are mapped to different managed properties associated with the item. The Item Display Template is rendered one time for each item in the result set. So, if the result set contains ten items, the Item Display Template creates its section of HTML ten times.

6:  What is Content Search web part ?

Answer: When visitors browse to a page that contains a CSWP Web Part automatically issues a query. The search results are displayed within the CSWP. In most cases, visitors won’t even know that search technology is being used to display the content they’re viewing. To them, it’ll look and feel like any other web page. By configuring a query in a CSWP, you can define which content visitors will see when they browse to a page that contains a CSWP.

By default, the query in the CSWP is configured to show the three most recently changed items on the site. By configuring the query, you can change the number of items that are shown in the CSWP and which content is shown.

For example, you can configure the query so that the CSWP will show nine list items from a particular list, or the last six documents the visitor created in a document library. Top of Page.

Add a Content Search Web Part Make sure that you’re a member of the Designers SharePoint group on the site where you want to add the Web Part. Go to the page where you want to add the Web Part. From Settings Small Settings gear that took the place of Site Settings. , select Edit page. In the Zone where you want to add the Web Part, select Add a Web Part. In the Categories list, select Content Rollup. In the Parts list, select Content Search > Add.

7: What is the structure of the InfoPath form data? 

Answer: An InfoPath form template is actually a CAB File containing different component files. Below is a list of files which forms part of an InfoPath template..xsf file: A manifest file that describes the basic definition of other form files..xsl file: Defines the transformation for data into different views..xsd file: Defines the data source schema..dll file: Carries the custom logic built into .NET or COM..htm and other resource files: Custom HTML resource files and other resources for the form.

When a form template is uploaded using Administrative deployment, the template is stored in the content database of the site. Office Forms Services provide a server-runtime environment for InfoPath Forms Services.

While running on the browser, all rules, validations, and calculations are executed in the browser using a client-side script. All business logic is executed on the server. So when a browser requests business logic execution, a postback is executed using low-cost XMLHTTP. FormsServer.aspx is an Infopath Forms Services page that accesses the form’s data from the content database and renders it to the client.


8: What is meant by OData in SharePoint 2013 ? 

Answer:  The Open Data Protocol (OData) lets you access a data source, such as a database, by browsing to a specially constructed URL. This allows for a simplified approach for connecting to and working with data sources that are hosted within an organization. OData is a protocol that uses HTTP, Atom, and JavaScript Object Notation (JSON) to enable developers to write applications that communicate with an ever-growing number of data sources.

Microsoft supports the creation of this standard as a way to enable the exchange of data between applications and data stores that can be accessed from the web. 

9: What is the use of Sandbox Solution? 

Answer: Sandboxed solutions, which are hosted in the SharePoint user code solution worker process (SPUCWorkerProcess.exe), run code that can only affect the site collection of the solution. Because sandboxed solutions do not run in the IIS worker process, neither the IIS application pool nor the IIS server must restart.

Visual Studio attaches the debugger to the SPUCWorkerProcess process that the SPUserCodeV4 service in SharePoint automatically triggers and controls. It is not necessary for the SPUCWorkerProcess process to recycle to load the latest version of the solution. 

10: Difference between Close() and Dispose() Method in SharePoint ?

Answer:  The basic difference between Close() and Dispose() is when a Close() method is called, the connection will be temporarily closed and can be opened once again. Whereas Dispose() method permanently close and removes connection object from memory and the resource no longer exists for any further processing.

Example:

try  
{  
string constring = "Server=(local);Database=my; User Id=sa; Password=sa";  
SqlConnection sqlcon = new SqlConnection(constring);  
 sqlcon.Open();   // here connection is open  
  
// some code here which will be execute  
}  
catch  
{  
     // code  will be execute when  error occurred in try block  
}  
finally  
{  
 sqlcon.Close();                // close the connection  
sqlcon.Dispose();         // desroy the  connection object  
}  


 11: Difference between list and library in SharePoint? 

Answer:  Lists: Can have attachments Have major versions only Do not have Check-in/Check-out features.

Libraries: Can not have attachments (files are directly in the library)Have both minor (draft) and major (published) versioning Have Check-in/Check-Out Publishing Libraries can use Page Layouts Have Unique Document Ids out of the box.

Read: Different between SharePoint list and Document library

12: What is the difference between Syncronous & Asyncronous events? 

Answer: An asynchronous event occurs after an action has taken place, and an asynchronous event occurs before an action has taken place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding. Read List of SharePoint Event Model in SharePoint Server 2010.

13. How is SharePoint Portal Server different from the Site Server?

Web site creation for information sharing and document collaboration is treated as services by SharePoint Portal Server.

SharePoint server services are key information worker infrastructure that provides additional functionality to the MS Office system applications.

Site Server: Manages websites with multiple technologies Content management, product management, order processing, advertisement serving are some of the functionality.

14: How many ways you can pass parameters to a method in c#.net? 

Answer: We can categorize method parameters in various parts. Some of them are Named Parameters (C# 4.0 and above)Ref Parameter (Passing Value Types by Reference)Out ParametersDefault Parameters or Optional Arguments (C# 4.0 and above)Dynamic parameter (dynamic keyword).Value parameter or Passing Value Types by Value (normal C# method param are valued parameter)Params (params).

15: Can you return multiple values from a function in C#? 

Answer :  No, you can’t return multiple values from a function in C#.

16: What is the difference between ref and out parameters in c# ? 

Answer: Ref Parameters vs. Out Parameters in C#Though both ref and out parameters are used to pass arguments through a method, they aren’t used in exactly the same way.

Ref keywords are used to pass an argument as a reference, meaning that when the value of that parameter changes after being passed through the method, the new value is reflected in the calling method. An argument passed using the ref keyword must be defined in the calling method before getting passed to the called method.

Out keywords similar to ref keywords in that, they are used to pass an argument, but they differ in that arguments passed using out keywords can be passed without any value to be assigned to it. An argument passed using the out keyword must be defined in the called method before being returning to the calling method.

17: Which class acts as a base class for all the data types in .net? 

Answer: The Object Type is the ultimate base class for all data types in C# Common Type System (CTS). The object is an alias for System.Object class. The object types can be assigned values of any other types, value types, reference types, predefined or user-defined types. However, before assigning values, it needs type conversion. 

18: What is the difference between dynamic type variables and object type variables?

Answer Dynamic: It is a run time variable and not require boxing and unboxing. You can assign any value to dynamic and also can change value type stored in the same. All errors on dynamic can be discovered at run time only. We can also say that dynamic is a run-time object which can hold any type of data. 

Object: Each object in C# is derived from object type, either directly or indirectly. It is compiled time variable and require boxing and unboxing for conversion and it makes it slow. You can change value type to reference type and vice versa. 

19: What is a sealed class in C#?  

Answer : Sealed class is used to define the inheritance level of a class.

 20: What is the difference between static polymorphism and dynamic polymorphism? 

 Answer: Polymorphism means many forms (ability to take more than one form).

In Polymorphism poly means “multiple” and morph means “forms” so polymorphism means many forms. In polymorphism, we will declare methods with the same name and different parameters in the same class or methods with the same name and the same parameters in different classes. Polymorphism has the ability to provide a different implementation of methods that are implemented with the same name.

In Polymorphism we have 2 different types those are-

Run Time Polymorphism: Run time polymorphism also called as late binding or method overriding or dynamic polymorphism. Run time polymorphism or method overriding means same method names with same signatures. In this run time polymorphism or method overriding we can override a method in base class by creating a similar function in a derived class, this can be achieved by using inheritance principle and using “virtual & override” keywords.

Compile Time Polymorphism (Called as Early Binding or Overloading or static binding)- Run Time Polymorphism (Called as Late Binding or Overriding or dynamic binding)

Compile Time Polymorphism: Compile time polymorphism means we will declare methods with the same name but different signatures because of this we will perform different tasks with the same method name. This compile-time polymorphism also called as early binding or method overloading.

Method Overloading or compile time polymorphism means same method names with different signatures (different parameters).

Hope this SharePoint and .Net interview questions will help you to prepare for SharePoint interview.

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About Rajkiran Swain

Rajkiran is currently working as a SharePoint Consultant in QATAR . Rajkiran having 6 + years of experience in Microsoft Technologies such as SharePoint 2019/2016/2013/2010, MOSS 2007,WSS 3.0, Migration, Asp.Net, C#.Net, Sql Server, Ajax, jQuery etc.He is C#Corner MVP (2 Times).

View all posts by Rajkiran Swain →