Does C# support multiple-inheritance?
No.
Who is a protected class-level variable available to?
It is available to any sub-class (a class inheriting this class).
Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.
Describe the accessibility modifier “protected internal”.
It is available to classes that are within the same assembly and derived from the specified base class.
What’s the top .NET class that everything is derived from?
System.Object.
What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.
What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
What’s the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.
Can you store multiple data types in System.Array?
No.
What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.
How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.
What’s the .NET collection class that allows an element to be accessed using a unique key?
HashTable.
What class is underneath the SortedList class?
A sorted HashTable.
Will the finally block get executed if an exception has not occurred?
Yes.
What’s the C# syntax to catch any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
Can multiple catch blocks be executed for a single try statement?
No. Once the proper catch block processed, control is transferred to the finally block (if there are any).
Explain the three services model commonly know as a three-tier application.
Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).
Thursday, September 11, 2008
C# Interview Questions
Sunday, June 1, 2008
Transaction and Locks
· What is a “Database Transactions “?
· What is ACID?
· What is “Begin Trans”, “Commit Tran”, “Rollback Tran” and “Save Tran”?
· What are “Checkpoint’s” in SQL Server?
· What are “Implicit Transactions”?
· Is it good to use “Implicit Transactions”?
· What is Concurrency?
· How can we solve concurrency problems?
· What kind of problems occurs if we do not implement proper locking strategy?
· What are “Dirty reads”?
· What are “Unrepeatable reads”?
· What are “Phantom rows”?
· What are “Lost Updates”?
· What are different levels of granularity of locking resources?
· What are different types of Locks in SQL Server?
· What are different Isolation levels in SQL Server?
· What are different types of Isolation levels in SQL Server?
· If you are using COM+, what “Isolation” level is set by default?
· What are “Lock” hints?
· What is a “Deadlock”?
· What are the steps you can take to avoid “Deadlocks”?
· How can I know what locks are running on which resource?
Database Optimization
· What are indexes?
· What are B-Trees?
· I have a table which has lot of inserts, is it a good database design to create
indexes on that table?
· What are “Table Scan’s” and “Index Scan’s”?
· What are the two types of indexes and explain them in detail?
· What is “FillFactor” concept in indexes?
· What is the best value for “FillFactor”?
· What are “Index statistics”?
· How can we see statistics of an index?
· How do you reorganize your index, once you find the problem?
· What is Fragmentation?
· How can we measure Fragmentation?
· How can we remove the Fragmented spaces?
· What are the criteria you will look in to while selecting an index?
· What is “Index Tuning Wizard”?
· What is an Execution plan?
· How do you see the SQL plan in textual format?
· What is Nested join, Hash join and Merge join in SQL Query plan?
· What joins are good in what situations?
· What is RAID and how does it work?
Chapter 13: Transaction and Locks
Replication Questions
· Whats the best way to update data between SQL Servers?
· What are the scenarios you will need multiple databases with schema?
· How will you plan your replication?
· What are publisher, distributor and subscriber in “Replication”?
· What is “Push” and “Pull” subscription?
· Can a publication support push and pull at one time?
· What are different models / types of replication?
· What is Snapshot replication?
· What are the advantages and disadvantages of using Snapshot replication?
· What type of data will qualify for “Snapshot replication”?
· What is the actual location where the distributor runs?
· Can you explain in detail how exactly “Snapshot Replication” works?
· What is merge replication?
· How does merge replication works?
· What are advantages and disadvantages of Merge replication?
· What is conflict resolution in Merge replication?
· What is a transactional replication?
· Can you explain in detail how transactional replication works?
· What are data type concerns during replications?
Data Warehousing / Data Mining Questions
- What is “Data Warehousing”?
· What are Data Marts?
· What are Fact tables and Dimension Tables?
· What is Snow Flake Schema design in database?
· What is ETL process in Data warehousing?
· How can we do ETL process in SQL Server?
· What is “Data mining”?
· Compare “Data mining” and “Data Warehousing”?
· (What is BCP?
· How can we import and export using BCP utility?
· During BCP we need to change the field position or eliminate some fields how
can we achieve this?
· What is Bulk Insert?
· What is DTS?
· Can you brief about the Data warehouse project you worked on?
· What is an OLTP (Online Transaction Processing) System?
· What is an OLAP (On- line Analytical processing) system?
· What is Conceptual, Logical and Physical model?
· What is Data purging?
· What is Analysis Services?
· What are CUBES?
· What are the primary ways to store data in OLAP?
· What is META DATA information in Data warehousing projects?
· What is multi-dimensional analysis?
· What is MDX?
· How did you plan your Data warehouse project?
· What are different deliverables according to phases?
· Can you explain how analysis service works?
· What are the different problems that “Data mining” can solve?
· What are different stages of “Data mining”?
· What is Discrete and Continuous data in Data mining world?
· What is MODEL is Data mining world?
· How are models actually derived?
· What is a Decision Tree Algorithm?
· Can decision tree be implemented using SQL?
· What is Naïve Bayes Algorithm?
· Explain clustering algorithm?
· Explain in detail Neural Networks?
· What is Back propagation in Neural Networks?
· What is Time Series algorithm in data mining?
· Explain Association algorithm in Data mining?
· What is Sequence clustering algorithm?
· What are algorithms provided by Microsoft in SQL Server?
· How does data mining and data warehousing work together?
· What is XMLA?
· What is Discover and Execute in XMLA?
Saturday, April 26, 2008
ASP.Net Interview Questions 4
What is a nested master page? How do you create them?
A Nested master page is a master page associated with another master page. To create a nested master page, set the MasterPageFile attribute of the @Master directive to the name of the .master file of the base master page.
What are Themes?
Themes are a collection of CSS files, .skin files, and images. They are text based style definitions and are very similar to CSS, in that they provide a common look and feel throughout the website.
What are skins?
A theme contains one or more skin files. A skin is simply a text file with a .skin extension and contains definition of styles applied to server controls in an ASP.NET page. For eg:
Defines a skin that will be applied to all buttons throughout to give it a consistent look and feel.
What is the difference between Skins and Css files?
Css is applied to HTML controls whereas skins are applied to server controls.
What is a User Control?
User controls are reusable controls, similar to web pages. They cannot be accessed directly.
Explain briefly the steps in creating a user control?
· Create a file with .ascx extension and place the @Control directive at top of the page.
· Included the user control in a Web Forms page using a @Register directive
What is a Custom Control?
Custom controls are compiled components that run on the server and that encapsulate user-interface and other related functionality into reusable packages. They can include all the design-time features of standard ASP.NET server controls, including full support for Visual Studio design features such as the Properties window, the visual designer, and the Toolbox.
What are the differences between user and custom controls?
User controls are easier to create in comparison to custom controls, however user controls can be less convenient to use in advanced scenarios.
User controls have limited support for consumers who use a visual design tool whereas custom controls have full visual design tool support for consumers.
A separate copy of the user control is required in each application that uses it whereas only a single copy of the custom control is required, in the global assembly cache, which makes maintenance easier.
A user control cannot be added to the Toolbox in Visual Studio whereas custom controls can be added to the Toolbox in Visual Studio.
User controls are good for static layout whereas custom controls are good for dynamic layout.
Where do you store your connection string information?
The connection string can be stored in configuration files (web.config).
ASP.Net Interview Questions 3
Explain the ASP.NET Page Directives?
Page directives configure the runtime environment that will execute the page. The complete list of directives is as follows:
@ Assembly - Links an assembly to the current page or user control declaratively.
@ Control - Defines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls).
@ Implements - Indicates that a page or user control implements a specified .NET Framework interface declaratively.
@ Import - Imports a namespace into a page or user control explicitly.
@ Master - Identifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included only in .master files.
@ MasterType - Defines the class or virtual path used to type the Master property of a page.
@ OutputCache - Controls the output caching policies of a page or user control declaratively.
@ Page - Defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files.
@ PreviousPageType - Creates a strongly typed reference to the source page from the target of a cross-page posting.
@ Reference - Links a page, user control, or COM control to the current page or user control declaratively.
@ Register - Associates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control.
This list has been taken from here.
Explain the Validation Controls used in ASP.NET 2.0?
Validation controls allows you to validate a control against a set of rules. There are 6 different validation controls used in ASP.NET 2.0.
RequiredFieldValidator – Checks if the control is not empty when the form is submitted.
CompareValidator – Compares the value of one control to another using a comparison operator (equal, less than, greater than etc).
RangeValidator – Checks whether a value falls within a given range of number, date or string.
RegularExpressionValidator – Confirms that the value of a control matches a pattern defined by a regular expression. Eg: Email validation.
CustomValidator – Calls your own custom validation logic to perform validations that cannot be handled by the built in validators.
ValidationSummary – Show a summary of errors raised by each control on the page on a specific spot or in a message box.
How do you indentify that the page is post back?
By checking the IsPostBack property. If IsPostBack is True, the page has been posted back.
What are Master Pages?
Master pages is a template that is used to create web pages with a consistent layout throughout your application. Master Pages contains content placeholders to hold page specific content. When a page is requested, the contents of a Master page are merged with the content page, thereby giving a consistent layout.
How is a Master Page different from an ASP.NET page?
The MasterPage has a @Master top directive and contains ContentPlaceHolder server controls. It is quiet similar to an ASP.NET page.
How do you attach an exisiting page to a Master page?
By using the MasterPageFile attribute in the @Page directive and removing some markup.
How do you set the title of an ASP.NET page that is attached to a Master Page?
By using the Title property of the @Page directive in the content page. Eg:
<@Page MasterPageFile="Sample.master" Title="I hold content" %>
ASP.Net Interview Questions 2
What is ASP.NET?
Microsoft ASP.NET is a server side technology that enables programmers to build dynamic Web sites, web applications, and XML Web services. It is a part of the .NET based environment and is built on the Common Language Runtime (CLR) . So programmers can write ASP.NET code using any .NET compatible language.
What are the differences between ASP.NET 1.1 and ASP.NET 2.0?
A comparison chart containing the differences between ASP.NET 1.1 and ASP.NET 2.0 can be found over here.
Which is the latest version of ASP.NET? What were the previous versions released?
The latest version of ASP.NET is 2.0. There have been 3 versions of ASP.NET released as of date. They are as follows :
ASP.NET 1.0 – Released on January 16, 2002.
ASP.NET 1.1 – Released on April 24, 2003.
ASP.NET 2.0 – Released on November 7, 2005.
Additionally, ASP.NET 3.5 is tentatively to be released by the end of the 2007.
Explain the Event Life cycle of ASP.NET 2.0?
The events occur in the following sequence. Its best to turn on tracing() and track the flow of events :
PreInit – This event represents the entry point of the page life cycle. If you need to change the Master page or theme programmatically, then this would be the event to do so. Dynamic controls are created in this event.
Init – Each control in the control collection is initialized.
Init Complete* - Page is initialized and the process is completed.
PreLoad* - This event is called before the loading of the page is completed.
Load – This event is raised for the Page and then all child controls. The controls properties and view state can be accessed at this stage. This event indicates that the controls have been fully loaded.
LoadComplete* - This event signals indicates that the page has been loaded in the memory. It also marks the beginning of the rendering stage.
PreRender – If you need to make any final updates to the contents of the controls or the page, then use this event. It first fires for the page and then for all the controls.
PreRenderComplete* - Is called to explicitly state that the PreRender phase is completed.
SaveStateComplete* - In this event, the current state of the control is completely saved to the ViewState.
Unload – This event is typically used for closing files and database connections. At times, it is also used for logging some wrap-up tasks.
The events marked with * have been introduced in ASP.NET 2.0.
You have created an ASP.NET Application. How will you run it?
With ASP.NET 2.0, Visual Studio comes with an inbuilt ASP.NET Development Server to test your pages. It functions as a local Web server. The only limitation is that remote machines cannot access pages running on this local server. The second option is to deploy a Web application to a computer running IIS version 5 or 6 or 7.
Explain the AutoPostBack feature in ASP.NET?
AutoPostBack allows a control to automatically postback when an event is fired. For eg: If we have a Button control and want the event to be posted to the server for processing, we can set AutoPostBack = True on the button.
How do you disable AutoPostBack?
Hence the AutoPostBack can be disabled on an ASP.NET page by disabling AutoPostBack on all the controls of a page. AutoPostBack is caused by a control on the page.
What are the different code models available in ASP.NET 2.0?
There are 2 code models available in ASP.NET 2.0. One is the single-file page and the other one is the code behind page.
Which base class does the web form inherit from?
Page class in the System.Web.UI namespace.
ASP.Net Interview Questions 1
What is XHTML? Are ASP.NET Pages compliant with XHTML?
In simple words, XHTML is a stricter and cleaner version of HTML. XHTML stands for EXtensible Hypertext Markup Language and is a W3C Recommendation.
Yes, ASP.NET 2.0 Pages are XHTML compliant. However the freedom has been given to the user to include the appropriate document type declaration.
More info can be found at http://msdn2.microsoft.com/en-us/library/exc57y7e.aspx
Can I deploy the application without deploying the source code on the server?
Yes. You can obfuscate your code by using a new precompilation process called ‘precompilation for deployment’. You can use the aspnet_compiler.exe to precompile a site. This process builds each page in your web application into a single application DLL and some placeholder files. These files can then be deployed to the server.
You can also accomplish the same task using Visual Studio 2005 by using the Build->Publish menu.
Does ViewState affect performance? What is the ideal size of a ViewState? How can you compress a viewstate?
Viewstate stores the state of controls in HTML hidden fields. At times, this information can grow in size. This does affect the overall responsiveness of the page, thereby affecting performance. The ideal size of a viewstate should be not more than 25-30% of the page size.
Viewstate can be compressed to almost 50% of its size. .NET also provides the GZipStream or DeflateStream to compress viewstate.


