Saturday, December 17, 2011

Common Work Interviews Questiones

    Table Of Contents
  1. Part 1: Basics of the .net languages (C# and VB.Net) and OOP
  2. Part 2: Web development (in context of 2.0 – 4.0 and MS SQL Server 2005 & 2008)
    • Part 2.1 web basics and related technologies
    • Part 2.2 web security
    • Part 2.3 WCF and related technologies
  3. Part 3: Microsoft SQL Server 2005 & 2008

Part 1: Basics of the .net languages (C# and VB.Net) and OOP

What are the main .net data types?

Boolean ,Byte , Char , Date, Decimal , Double , Integer , Long ,Object ,Short ,Single ,String ,float , User-Defined Data Type and others.

What is the .Net framework architecture?

Of course the OS is not a part of the .Net framework! It presents at the diagram for conventionally reason.

What are the differences between struct and class?

are value types are reference types
All of the members of a struct are public by default All of the members of a class are private by default.
There is no inheritance for Structs as there is for classes. A struct cannot be inherited from another struct or class, and it cannot be the base of a class. You can have a base class and derived class, where the derived class has the ability to use protected members of the base class. For example, developer can override the protected method(s) of its base class.
When you create a struct object using the new operator, it gets created and the constructor is called.
Structs can be instantiated without using the new operator. If you do not use new operator, the fields will remain unassigned and the object cannot be used until all of the fields are initialized.
To instantiate a class you need to use the new operator or take the risk of throwing a null reference exception at run time

What is the difference between reference and value data types?

Value type holds the data within its own memory allocation. A reference type contains a pointer to another memory location that holds the data.

Mention the value and reference data types

The value types consist of two main categories: Structs, Enumerations.
Struct : falls into these categories: Numeric types , Integral types (sbyte , Byte , char ,short ,ushort,int,uint,long, ulong), Floating-point types (double float), decimal, bool , User defined Structs.
Reference types include the following: String, Object, Class types, delegates, and all arrays even if their elements are value types

What are the differences between boxing and unboxing?

Boxing: is an implicit conversion of a Value Types to the type Object or to any interface type implemented by this value type. Boxing is used to store value types in the garbage-collected heap, boxing a value type means allocating an object instance on the heap and copies the value into the new object.
Unboxing: is an explicit conversion from the type Object to a value type or from an interface type to a value type that implements the interface.
An unboxing operation consists of: 1. Checking the object instance to make sure it is a boxed value of the given value type. 2. Copying the value from the instance into the value-type variable.

What is the inheritance and polymorphism?

Inheritance: is an object oriented (OO) concept permits you to use the existing features of a class. Derived class can reuse and override (for methods) the members of the base class .The main advantage of inheritance is code reusability, which is of great help in the case of distributing class libraries.
Polymorphism: is an object oriented (OO) concept includes: overriding, overloading and composition. Polymorphism allows classes to provide different implementations of a method that can be called in the same way. Polymorphism can be of three types: 1. inheritance polymorphism, 2. interface polymorphism and 3. Polymorphism through abstract classes.

What are the access modifiers?

Access modifiers are keywords used to specify the declared accessibility of a member or a type. The four access modifiers: public, protected, internal and private.

What are the accessibility levels provide by access modifiers?

Public: Access is not restricted.
Protected: Access is limited to the containing class or types derived from the containing class.
Internal: Access is limited to the current assembly.
Protected internal: Access is limited to the current assembly or types derived from the containing class.
Private: Access is limited to the containing struct or class.

Friend access modifiers

The Friend keyword confers friend access on one or more declared programming elements. Friend elements are accessible from within the program that contains their declaration and from anywhere else in the same assembly.
The Friend keyword can be used in conjunction with the protected keyword in the same declaration. This combination confers both friend and protected access on the declared elements, so they are accessible from the same assembly, from their own class, and from any derived classes.

What is LINQ?

Language-Integrated Query (LINQ) is a set of features introduced in Visual Studio 2008 that extends powerful query capabilities to the language syntax of C# and Visual Basic. LINQ introduces standard, easily-learned patterns for querying and updating data, and the technology can be extended to support potentially any kind of data store. Visual Studio includes LINQ provider assemblies that enable the use of LINQ with .NET Framework collections, MS SQL Server databases, ADO.NET Datasets, and XML documents.

What is lambda expression?

A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.
All lambda expressions uses the lambda operator =>, which is read as "goes to". The left side of the lambda operator specifies the input parameters (if any) and the right side hold the expression or statement block.

How to create Read only property

Either Read-only keyword or implements property with implementation of the get only without set implementation


DataSet.Clone Method
Crates a new DataSet with the same schema as the current DataSet, but none of the data.
DataSet. Copy Method
Creates a new DataSet with the same schema (table schemas, relations, and constraints) and data as this DataSet.
DataSet.CaseSensative property
Gets or sets a value indicating whether string comparisons within DataTable objects are case-sensitive.

Compilation of .net languages

Microsoft’s .Net framework relies on just in time compilation (JIT) compilation for high-speed code execution. Just-in-time compilation (JIT), also known as dynamic translation, it is a method to improve the runtime performance of computer programs.

Part 2: Web development (in context of 2.0 – 4.0 and MS SQL Server 2005 & 2008)

Part 2.1 web basics and related technologies

What is n-tier application?

Multi-tier architecture (referred to as n-tier architecture) is a client–server architecture in which the presentation (UI layer), the application processing (business logic layer), and the data management (data model layer) are logically separate processes.
UI tier: user interface layer for data representation and maybe data validation, Included: user controls, web forms, web user controls integration and others.
Business logic layer: can be local classes on the web application and / or web services distributed over the WWW on different machines.
Model tier: the data base, relations and referential constrains (primary key, foreign key, check conditions and other data base constraints)

What is PostBack?

PostBack is the name given to the process of submitting an ASP.NET page to the server for processing. For example, PostBack is done if certain credentials of the page need to be checked against a database values (such as verification of username and password).

What is autopost back?

AutoPostBack property: a property of some server side controls .When this property enabled the web page will be posted back to the server, based on a certain event. For example, enabling this property for text box will call the related text changed event handler on the server when the event Text Changed is fired (user write a character, symbol or number on the text box).

Server side and client side state management

Server side state management: Cach, Session, Application and data base. On the other side, client side are: ViewState (encrypted hidden field), hidden fields, cookies (either stored at the client volatile memory –RAM technology is the commonly used - or persisted as a text file stored on the client machine)

What are the differences between ViewState and Session?

ViewState (client side state management) at run time in described as encrypted hidden field in the html page at the client side to maintain values among different user request for the same page , server side controls like text boxes have the property of ViewState(Server side state management) enabled by default. On the other hand, session represents memory locations on the web server maintains data during the request of different web pages

What is Machine.config File?

Machine.config file is used to configure the application according to a particular machine. That is, configuration done in Machine.Config file, which is affected on any application that runs on a particular machine (web server for example).

What is Web.Config?

Xml file exists at the application to configure the applications

What can be stored in web.config file?

There are number of important settings that can be stored in the configuration file. The most frequently used configurations, stored conveniently inside web.config file: Database connections (such as connectionString), Session States (such as session state time out), Error Handling, Security (such as authentication and authorization related tags).

Part 2.2 web security

Forms authentication and windows Authentication

Windows Authentication Forms Authentication
More secure way , each user needs to be registered at the domain More practical for websites , which have a serious number of users
Better for publicly published web sites Good for intranet web sites
Default authentication way Needs to be configured at the web.config file

Part 2.3 WCF and related technologies

What are XSD, XML, and XSLT?

XML (Extensible Markup Language): XML is a markup language much like HTML. But, XML was designed to carry data, not to display data like HTML. Also, XML tags are not predefined you must define your own tags.
XSD (XML Schema Definition): XSD specifies how to formally describe the elements in XML document. This description can be used to verify that each item of content in a document adheres to the description of the element in which the content is to be place
XSLT (Extensible Style sheet Language Transformations) has evolved from the early Extensible Style sheet Language (XSL). standard. XSLT specifies a language definition for XML data presentation and data transformations, where data presentation means displaying data in some format and/or medium, Presentation is about style and data transformation means parsing an input XML document into a tree of nodes, and then converting the source tree into a result tree, and Transformation is about data exchange.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write, JSON easy for machines to parse and generate.
JSON is built on two structures:
  • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
  • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

What is WCF metadata?

WCF services use metadata to describe how the client can interact with the service's endpoints (endpoint includes the ABC where A stands for address, B for binding and C for contract).The tools, such as svcutil.exe, automatically generate client metadata code for accessing the service. WCF metadata.

Part 3: Microsoft SQL Server 2005 & 2008

Part 3.1 Basics and general concepts

Can you restore a deleted object of MS SQL Server?

No you can’t, unless you have a backup

How you maintain your data base at MS SQL Server?

Automate an MS SQL Server job using MS SQL Server Agent to back up the data base periodically, you can add configuration to send a daily informational e-mail for the intended operator(s) when the backup completed.

Part 3.2 T-SQL related questions

Difference between NCHAR, CHAR, NVARCHAR

Difference between VARCHAR and NVARCHAR data types
An NVARCHAR column can store any Unicode data. A VARCHAR column is restricted to an 8-bit code page. And so, NVARCHAR provides better ability to work with universal languages such as Chinese symbols Differences between VARCHAR and CHAR data types
CHAR should be used for storing fix length character strings, unused spaces will be space/blank padded before stored on disk. And so, if this type is used to store variable length strings, it will waste a lot of disk space. On the other hand, VARCHAR return the unused space to be available memory spaces.

Difference between “TRUNCATE TABLE table1”and “DELETE * FROM table1”

“TRUNCATE TABLE table1”: MS SQL Server will NOT log this operation at the log file, this command removes all the rows at the “table1”, and the truncate command is a DDL command this means it can NOT be rolled back “DELETE * FROM table1”: MS SQL Server will log this operation at the log file, this command delete all the rows from “table1” , and the DELETE command is a DML command this means it can be rolled back.

What is stored procedure?

A stored procedure is a group of Transact-SQL statements compiled into a single execution plan.

Performance wise of using stored procedures

  • Precompiled execution. MS SQL Server compiles each stored procedure once and then reutilizes the execution plan.
  • Reduced client/server traffic. Instead of send sql query over the network to data base engine , only the stored procedure name and related parameters will be sent.
  • Efficient reuse of code and programming abstraction. Stored procedures can be used by multiple users and client programs. If you utilize them in a planned manner, you'll find the development cycle takes less time.
  • Enhanced security controls. On the MS SQL Server level you can grant users permission to execute a stored procedure independently of underlying table permissions.

Types of MS SQL Server functions

Scalar User-Defined Function: return a single value.
Inline Table-Value User-Defined Function: return a table, its structure defined at the run time.
Multi-statement Table-Value User-Defined Function: return a table, its structure defined at the function implementation .And so, this function usage provides better in performance than inline table valued function.


Edited by Omar Adnan Isaid