www.fmsoftwares.co.in

Wednesday, 4 September 2013

SQL Server

what is stored procedure in Sql server | what are the advantages of using stored procedures in sql server ? A stored procedure is a group of sql statements that has been created and stored in the database. Stored procedure will accept input parameters so that a single procedure can be used over the network by several clients using different input data. Stored procedure will reduce network traffic and increase the performance. If we modify stored procedure all the clients will get the updated stored procedure Advantages of using stored procedures a) Stored procedure allows modular programming. You can create the procedure once, store it in the database, and call it any number of times in your program. b) Stored Procedure allows faster execution. If the operation requires a large amount of SQL code is performed repetitively, stored procedures can be faster. They are parsed and optimized when they are first executed, and a compiled version of the stored procedure remains in memory cache for later use. This means the stored procedure does not need to be reparsed and reoptimized with each use resulting in much faster execution times. c) Stored Procedure can reduce network traffic. An operation requiring hundreds of lines of Transact-SQL code can be performed through a single statement that executes the code in a procedure, rather than by sending hundreds of lines of code over the network. d) Stored procedures provide better security to your data Users can be granted permission to execute a stored procedure even if they do not have permission to execute the procedure's statements directly. In SQL we are having different types of stored procedures are there a) System Stored Procedures b) User Defined Stored procedures c) Extended Stored Procedures System Stored Procedures: System stored procedures are stored in the master database and these are starts with a sp_ prefix. These procedures can be used to perform variety of tasks to support sql server functions for external application calls in the system tables Ex: sp_helptext [StoredProcedure_Name] User Defined Stored Procedures: User Defined stored procedures are usually stored in a user database and are typically designed to complete the tasks in the user database. While coding these procedures don’t use sp_ prefix because if we use the sp_ prefix first it will check master database then it comes to user defined database Extended Stored Procedures: Extended stored procedures are the procedures that call functions from DLL files. Now a day’s extended stored procedures are depreciated for that reason it would be better to avoid using of Extended Stored procedures.

Monday, 2 September 2013

Jay

List the new features included in the .Net framework 2.0, 3.0, 3.5 & 4.0 compared to earlier versions ?

.net

What is a CLR?
CLR is an acronym of common language runtime. It converts the IL code to native code along with JIT compiler. Memory Management, Security, Assembly loading, Threading, Code Access Security are the main responsibilities of CLR.


What are the types of assembly?
-Public or Shared or Global
-Private or Application Specific
-Satellite


What is a shared assembly?
Shared assembly is the one which is installed in Global Assembly Cache (GAC). An assembly can be installed in GAC using gacutil -i AssemblyName.dll. Before using the gacutil command, that assembly should be strong named using sn.exe.


What order global.asax events are triggered?
Global.asax events are triggered in the following order:
Application_BeginRequest
Application_AuthenticateRequest
Application_AuthorizeRequest
Application_ResolveRequestCache
Application_AcquireRequestState
Application_PreRequestHandlerExecute
Application_PreSendRequestHeaders
Application_PreSendRequestContent
<<Code is executed>>
Application_PostRequestHandlerExecute
Application_ReleaseRequestState
Application_UpdateRequestCache
Application_EndRequest.


How can we format data inside Data Grid?
Using DataFormatString property.


What is the difference between “Web.config” and “Machine.Config”?
“Web.config” files apply settings to each web application, while “Machine.config” file apply settings to all ASP.NET applications in the server.


What is the use of “GLOBAL.ASAX” file?
It allows to execute ASP.NET application level events and setting application-level variables.


Which class does the remote object has to inherit?
All remote objects should inherit from System.MarshalbyRefObject.


what are two different types of remote object creation mode in .NET ?
There are two different ways in which object can be created using Remoting:-
• SAO (Server Activated Objects) also called as Well-Known call mode.
• CAO (Client Activated Objects)
SAO has two modes “Single Call” and “Singleton”. With Single Call object, the object is created with every method call thus making the object stateless. With Singleton, the object is created only once and the object is shared with all clients.
CAO are stateful as compared to SAO. In CAO, the creation request is sent from client side. Client holds a proxy to the server object created on server.


What is Marshaling?
Marshaling is used when an object is converted so that it can be sent across the network or across application domains. Unmarshaling creates an object from the marshaled data.
Two Types :
(1) Marshal By Value (MBV)
(2) Marshaling By Reference (MBR)


Is Session_End event supported in all session modes?
Session_End event occurs only in “Inproc mode”. “State Server” and “SQL SERVER” do not have Session_End event.


What are the state maintainence methods in ASP.Net?
- Hidden Fields
- View State
- Cookies
- Query Strings
- Session


What is the ideal size of a cookie?
Cookie size should not exceed 25 to 30% of the Page Size.


What are the difference between abstract class and interface?
Abstract classes are closely related to interfaces. They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented. One key difference between abstract classes and interfaces is that a class may implement an unlimited number of interfaces, but may inherit from only one abstract (or any other kind of) class. A class that is derived from an abstract class may still implement interfaces. Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed. They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code.


What is a delegate?
Delegate is a class that can hold a reference to a method or a function. Delegate class has a signature and it can only reference those methods whose signature is compliant with the class. Delegates are type-safe functions pointers or callbacks.


What is compile time and runtime polymorphism?
Method overloading is the example for compile time and method overriding is the example for runtime polymorphism.


What is the default access modifier of a class and its members?
Default Access modifier of a class is internal and default access modifier of the class members is private.


What are the drawbacks of collections in .net?
1. Performance will be low as they store each and every member as an object
2. Incorrect parsing throws runtime "Invalid Cast" exception
Examples of System.Collections: ArrayList, HashTable, Stack, Queue
Note: System.Collections.Generic came up in .NET 2.0 to overcome the drawbacks of collections.


What is Operator overloading in .NET?
It provides a way to define and use operators such as +, -, and / for user-defined classes or structs. It allows us to define/redefine the way operators work with our classes and structs. This allows programmers to make their custom types look and feel like simple types such as int and string.


What is the difference between Authentication and authorization?
Authentication is verifying the identity of a user and authorization is process where we check does this identity have access rights to the system.. Authorization is the process of allowing an authenticated user access to resources.

--------------


What are the differences between const and readonly keywords?
'const':
-cannot be static
-value is evaluated at compile time
-initialized at compile time only
'readonly':
-can't be either instance level or static
-value is evaluated at compile time
-can be initialized in declaration or by code in the constructor

What is a constructor?
-It is used to create objects
-It must have the same name as the class it is declared within
-It may be overloaded

What is the difference between Struct and Class?
Structs are value type variables and thus saved on the stack, additional overhead but faster retrieval. Another difference is that Structs cannot inherit.

What is the advantage of using "using" statement in .net?
It ensures that Dispose is called even if an exception occurs while you are calling methods on the object. It is similar to try and finally block

What is a multicast delegate?
A delegate pointing to more than one function at a time. (i.e., they are based off the System.MulticastDelegate type). A multicast delegate maintains a list of functions that will all be called when the delegate is invoked.

Do constructors have a return type?
No. Constructors can only initialize member variables, but cannot have a return type.

What is the use of operator overloading?
To allow client code to be more concise and readable than it might be with regular methods.

JavaScipt

1).What is JavaScript?
Ans:-JavaScript is a scripting language most often used for client-side web development.


2).Difference between JavaScript and Jscript?
Ans:-Both JavaScript and Jscript are almost similar. Java script was developed by Netscape. Microsoft reverse engineered Javascript and called it JScript


3).How do we add JavaScript onto a web page?
Ans:-
There are serveral way for adding javascript on a web page but there are two way with is commonly userd by developers
If your script code is very short and only for single page then following ways is best
a)You can place <script type="text/javascript"> tag inside the <head> element. 
Code:
<head>
<title>Page Title</title>
<script language="JavaScript" type="text/javascript">
   var name = "Vikas Ahlawta"
   alert(name);
</script>
</head>
b).If your script code is very large then you can make a javascript file and add its path in the following way..
Code:
<head>
<title>Page Title</title>
<script type="text/javascript" src="myjavascript.js"></script>
</head>


4).Is JavaScript case sensitive?
Ans:-Yes!
A function getElementById is not the same as getElementbyID


5).What are the types used in JavaScript? 
Ans:-String, Number, Boolean, Function, Object, Null, Undefined.


6).What are the boolean operators sported by JavaScript?
And Operator: &&
Or Operator: ||
Not Operator: !


7).What is the difference between “==” and “===”?
Ans:-
“==” checks equality only, 
“===” checks for equality as well as the type.


8).How to access the value of a textbox using JavaScript?
Ans:-
ex:-
Code:
<!DOCTYPE html>
<html>
<body>
Full name: <input type="text" id="txtFullName" name="FirstName" value="Vikas Ahlawat">
</body>
</html>

There are following way to access the value of the above textbox
var name = document.getElementById('txtFullName').value;
alert(name);
or 
we can use the old way
document.forms[0].mybutton.
var name = document.forms[0].FirstName.value;
alert(name);
Note:- this uses the "name" attribute of the element to locate it.


9).What are the way of make comment in Javascript?
Ans:-
// is used for line comments
ex:- var x=10; //comment text

/*
*/ is used for block comments
ex:-
var x= 10; /* this is
block comment example.*/


10).How you will get the CheckBox status whether it is checked or not?
Ans:-
var status = document.getElementById('checkbox1').checked; 
alert(status); 
it will return true or false


11).How to create arrays in JavaScript? 
Ans:-
There are Two way dor create array in Javascript like other languages..
a) first way to create array
Declare Array:-
Code:
var names = new Array();
Add Elements in Array:-
names[0] = "Vikas";
names[1] = "Ashish";
names[2] = "Nikhil";

b) this is second way
var names = new Array("Vikas", "Ashish", "Nikhil");


12).If an array with name as "names" contain three elements then how you will print the third element of this array?
Ans:- Print third array element document.write(names[2]); 
Note:- array index start with 0


13).How do you submit a form using Javascript? 
Ans:-Use document.forms[0].submit();


14).What does isNaN function do? 
Ans:-
It Return true if the argument is not a number.
ex:-
Code:
document.write(isNaN("Hello")+ "<br>");
document.write(isNaN("2013/06/23")+ "<br>");
document.write(isNaN(123)+ "<br>");

output will be:-
true
true
false


15).What is the use of Math Object in Javascript?
Ans:-
The math object provides you properties and methods for mathematical constants and functions.
ex:-
Code:
var x = Math.PI; // Returns PI
var y = Math.sqrt(16); // Returns the square root of 16
var z = Math.sin(90);    Returns the sine of 90

16). What do you understand by this keyword in javascript? 
Ans:-In JavaScript the this is a context-pointer and not an object pointer. It gives you the top-most context that is placed on the stack. The following gives two different results (in the browser, where by-default the window object is the 0-level context):

Code:
var obj = { outerWidth : 20 };

function say() {
    alert(this.outerWidth);
}
say();//will alert window.outerWidth
say.apply(obj);//will alert obj.outerWidth


17).What does "1"+2+4 evaluate to? 
Ans:-Since 1 is a string, everything is a string, so the result is 124. 


18).What does 3+4+"7" evaluate to?
Ans:-Since 3 and 4 are integers, this is number arithmetic, since 7 is a string, it’s concatenation, so 77 is the result.


19).How do you change the style/class on any element using javascript?
Ans:-
Code:
document.getElementById(“myText”).style.fontSize = “10";
-or-
document.getElementById(“myText”).className = “anyclass”;


20).Does javascript support foreach loop?
Ans:- Yes, See example here http://jsfiddle.net/gpDWk/ 


21).What looping structures are there in JavaScript? 
Ans:-for, while, do-while loops


22).what is an object in JavaScript, give an example?
Ans:-
An object is just a container for a collection of named values

// Create the man object
Code:
var man = new Object();
man.name = 'Jay Mallick';
man.living = true;
man.age = 27;


23).How you will add function as a property in a JavaScript object? Give example.
Ans:-
Code:
var man = new Object();
man.name = 'Jay Mallick';
man.living = true;
man.age = 27;

man.getName = function() { return man.name;}
console.log(man.getName()); // Logs 'Jay Mallick'.


24).What is the similarity between 1st and 2nd statement?
1st:- var myString = new String('male'); // An object.
2nd:- var myStringLiteral = 'male'; // Primitive string value, not an object.
Ans:- Both will call String() constructor function
you can confirm it by run the following statement
console.log(myString.constructor, myStringLiteral.constructor);


25).What will be the output of the following statements?
Code:
var myString = 'Jay' // Create a primitive string object.
var myStringCopy = myString; // Copy its value into a new variable.
var myString = null; // Manipulate the value
console.log(myString, myStringCopy);
Ans:- // Logs 'null Jay'


26).Consider the following statements and tell what would be the output of the logs statements?
var price1 = 10;
var price2 = 10;
var price3 = new Number('10'); // A complex numeric object because new was used.
console.log(price1 === price2); 
console.log(price1 === price3);
Ans:-
console.log(price1 === price2); // Logs true.
console.log(price1 === price3); /* Logs false because price3 contains a complex number object and price 1
is a primitive value. */


27).What would be the output of the following statements?
var object1 = { same: 'same' };
var object2 = { same: 'same' };
console.log(object1 === object2);
Ans:- // Logs false, JavaScipt does not care that they are identical and of the same object type.
When comparing complex objects, they are equal only when they reference the same
object (i.e. have the same address). Two variables containing identical objects are not
equal to each other since they do not actually point at the same object.


28).What would be the output of the following statements?
Code:
var object1 = { same: 'same' };
var object2 = object1;
console.log(object1 === object2);
Ans:- // Logs true


29).What is this?
var myArray = [[[]]];
Ans:- Three dimantional array


30).Name any two JavaScript functions which are used for convert nonnumeric values into numbers?
Ans:-
Number()
parseInt()
parseFloat()
Code:
var n1 = Number(“Hello world!”); //NaN
var n2 = Number(“”);             //0
var n3 = Number(“000010”);       //10
var n4 = Number(true);           //1
var n5 = Number(NaN);            //NaN

Friday, 30 August 2013

Asp.net

Make a list of all templates of the Repeater control. The Repeater control contains the following templates: ItemTemplate AlternatingltemTemplate SeparatorTemplate HeaderTemplate FooterTemplate

MVC

The MVC model defines web ?