Tuesday, July 31, 2007

vb.net questions

§ VB.Net Question & Answers

1. CLR?
Common Language Runtime, It can understand only one language code i.e., intermediate language code (IL Code). IL code is similar to assembly language syntax. It is very complex to developer to write IL code to avoid this complexity Microsoft is providing set of high-level languages support under .Net framework.
IL code, it support set of types, Types supported by CLR-àCTS
CLR is platform dependent.
IL code is platform independent.
2. CTS?
Common Type System,
Ordinary Types:- Byte, Int16,Uint16,Int32,Uint32.
User defined type:- Structure, class, interface.
Pointer Type
3. CLS?
CLS (common language specification), It is a subset of CTS
No user defined Types
No pointer types
Any company can develop high level language compiler towards .Net environment the compiler should produce IL code with minimum support of CLS
4. High Level Languages?
VB.NET, C#. NET, VC++. NET, VJ#.NET-à all language compilers has been designed by Microsoft.
Third party .NET language compilers COBOL.NET, PASCAL.NET, FORTRAN.NET
Nearly 25 languages support is provided by .NET framework.
In the market different applications are exiting based on different languages, this application can be migrated to .Net framework if the similar language is present under .Net framework. This will improve market for .Net framework
5. VB.Net?
· It is not case sensitive.
· It will reach CLS standards.
· File extension will be .VB
· Compiler for VB.Net is VBC.exe
· VB.Net is object oriented programming
6. Application Development?
VB.Net-----> Application
Module M1
Sub Main ()
---
---
End sub
End Module

Class Demo
Public shared Sub Main ()
---
---
End sub
End Module

· Module is similar to class by default methods will be shared.
· VB.Net is purely object oriented programming language ( As without class or module we can’t make a application)

7. ILDASM Utility?
ILDASM (Intermediate Language De-Assembler),
Ex:- E:- \vbnet56\First.vb [notepad]
Module M1
Suh main()
System.console.writeline(“First VB App”)
End sub
End Module

-compilation-

E:-\vbnet56>vbc first.vb [It will produce first.exe]
-Execution-
E:-\first
O/p-à First VB App
Note:- Exe is containing IL code.
8. Base class Libraries?
(Framework class libraries)
(.Net Framework API)
· System.Dll (All basic Classes)
· System.Windows.Forms.Dll (for GUI programming all classes)
· System.Data.Dll (ADO.Net) (For Database Connectivity)
· System.web.Dll (web based App) (ASP.Net)à All Classes for ASP.
The Libraries, which comes with .Net framework installation, are called as base class libraries. These will be around 64 libraries developed by micro soft using c# language.
These libraries will be common to all the .Net languages.
9. Namespace?
Namespace can be defined as a logical container for collection of user defined types. This will support arranging classes in the hierarchical representation. This will make accessing faster & naming collusion can be avoided.
The Collusion at the namespace level can be avoided by providing root namespace as company name.
Note:- The root namespace for base class libraries will be system (System)
Importing Namespace:- To avoid repetition of namespace or namespace.classname
· Imports Namespace1,Namespace2
· Imports Namespace.classname
· Imports Alias=Namespace,
· Imports PF=peers.First (for example)
XF=xyz.first
Imports are a request to compiler so the performance of the application will not be affected.

10. Data Types supported by VB.Net?
VB 6.0 -à Ordinary Type à Basic Data Types-àByte, Integer
-à Object Type---à Class
In VB.Net only object type is supported i.e., everything is considered as an object type.
VB.Net-à object Type-à Value TypeàObject will be stored on stack memory.
-àReference Typeà Objects will be stored on heap memory.
11. What is Stack Memory?
*Stack memory as faster access for only small amount of data.
Stack Memory:- The memory will be allocated by the compiler.
It does not support dynamic allocation & destruction.
It does not support hierarchical representation of data i.e., inheritance.
12. Heap Memory?
It supports dynamic allocation & destruction of memory. It supports hierarchical representation of data i.e. inheritance.
13. Data Types, CLR Specific, Language Specific?
DataTypes-àCLR specific Type-àCTS\CLS-àint16,int32
àLanguage Specific type-----------à short,integer
Language specific[VB.Net] types
· Byte -----à 1 Byte ---à0 to 255
· Short -----à 2 Bytes ---àNumeric Data without (.) decimal point
· Integer -----à 4 Bytes
· Long -----à 8 Bytes
· Single -----à 4 Bytes ---à 7 Decimal
· Double -----à 8 Bytes ---à 15 Decimal
· Decimal----à 16Bytes ---à 32 Decimal (5 to 7 will support Numeric data with decimal points.)
· Boolean----à True/False
· Date -----à 8 Bytes (Format – mm\dd\yy Range – 01\01\0001 to 12\31\9999)
· Char ----à 2 Bytes ---à 0 to 65535 English Alphabets à 0-255 ASCII – Format
Above 1 to 10 are value types

Note:- .Net framework supports different cultures when the language is other than English it requires no. more than 255. This is called as Unicode format.
It can represent any language character.
· String Data Type-à It can represent up to 2 billion characters.
· Object Data type-à 4 Bytes It can represent any kind / type of Data.
Above two are Reference Type.
Note:- Vb.Net is not supporting by VB 6.0.
Vb.Net is supporting two new data types short & char.
Ex: Dim A as Byte=200
VB 6.0 -à Not supported
VB.Net-à Supported
Dim A,B as Byte
VB 6.0 à Aàvariant, BàByte
VB.Netà AàByte,BàByte

14. What is the difference in declaring a variable with Dim and Private?
Dim & private are similar. Dim does not support constant variable declaration where as private will support constant variable declaration i.e.,
Dim const PI as single=3.14 ----à Not supported
Private const PI as single=3.14 ---à allowed
15. Option Explicit ONOFF?
ON à Variable declaration is mandatory.
OFFà Variable declaration is not mandatory.
Note:- The variable without declaration is provided with object data type. The storage of the data will be taken on the heap memory.
16. What is Boxing & UnBoxing?
When the value type data is represented as a reference type on the heap memory then it is called as Boxing.
When the reference type is converted into value type then it is called as UnBoxing.
When the application performs Boxing & UnBoxing it requires more processing type. This will affect the performance of the application.
The variable without declaration is recommended for marinating reference type data. This will not affect the performance of the application
17. What is Type Casting?
Converting one type of data into another type is called type casting.
VB 6.0-à It supports type casting conversion function.
· C Byte (expression) ex: C Byte(“100”) -à O/p -à 100 Byte
C Byte(“100.55)-àO/p à101
· C Int (expression) -à To Integer
· C Lng(‘’)-à Converting to Long
VB.Net-à It supports conversion functions of VB 6.0. this required for migration projects i.e., converting VB 6.0 application into VB.Net application.
It supports C Type function, this will implement type casting for the basic data types & user defined types.
C type(variable, type)
Ex: Sum.vb
Res=Ctype(A,short)+B
18. Array?
It can be defined as collection of similar data under one name.
Each element can be identified with a unique index:
Array is considered as a reference type where the storage will be heap memory/
Types:
There are three types of Array
1. Single Dimension Array.(Only one row with n no. of columns)
2. Multidimensional Array.
3. Jagged Array
Note: In VB 6.0 Lower bound can be any number. In Vb.Net it is fixed to zero(0). Only
A.length-à o/p—3 (to see the number of element in array)

Array Class:-
--à Methods
1. Sort (Array) ---Ascending order
2. Reverse (Array)----Descending order
3. Copy (Source Array, DestArray,N)
4. Clear (Array, Index,N)
Dynamic Array:-
When the size of the array is defined at run time then it is called as dynamic array. This can be implemented using (Redim) reading statement (Redim)
Multidimensional Array:-
In multi dimensional array all the rows will have same no. of columns.
Jagged Array:-
This will support different no. of columns for different rows. This can be called as array of array.
19. Visual Studio.Net?
VS.Net is a designer application provided by the Microsoft towards .Net Framework application development. This will reduce lot of burden on the developer & makes the application development much faster.
IDEL(Integrated Development Environment)
It is a collection of windows.
VS.Net will provide a common IDE for all the .Net languages.
· .Net 1.0 -à VS.Net2002
· .Net 1.1 -à VS.Net2003
· .Net 2.0 -à VS.Net2005

VS.Net 2003:
VB.NET,VC#.NET, VC++.NET, VJ#.NET, Crystal Report Designer.
Application center Test [ACT]--àTesting Tool
VS.Net:
Application --à Solution file[.sln]
VB.Net Project will produce exe.
Note: A solution file will act as a logical container for collection of projects belonging to different .Net languages.
VB.Net Projects:-
· Console Application à To develop CUI(DOS based) based Application.
· GUI Application i.e, Windows Application To develop GUI Application.
· Class Libraryà To Develop DLL file
· Windows Control Libraryà To create user defined control
· ASP.Net Web Application ASP.Net

20. Sub Programs?
A unit of code identified by a particular name is called as sub program.
Advantages:-
· Reusability
· Better Maintenance
· Debugging will become easier.
VB.Net supports two types of sub programs.
i) Sub procedure
ii) Function
Sub Procedure :- To perform a task. It doesn’t return value directly to the calling environment.
Syntax:-
PrivatePublic sub(ByValByRef as ,….)
-----
-----
Exit sub
End sub
Function :- It returns value directly to the calling environment.
ex:
Private sub Demo(ByVal a ---,ByRef b ---)
a=a+5
b=b+5
End sub

Calling Evn
A1=10
B1=20
Call Demo(A1,B1)
A1à10
B1à25
Note:-
1. If it is ByVal changes to the formal parameter will not be reflected on actual parameters.
2. If it is ByRef changes to the formal parameter will hbe refleted on actual parameter.
3. In VB 6.0 default is ByRef . But in Vb.Net it s ByVal



Note:-
1. In VB 6.0 it is not mandatory to initialize optional parameter. But in VB.Net it is mandatory.
2. The Optional parameters should be right most in the parameters declaration.



Note:- To hold the window console Read has to be taken.
Note:-
Optional Parameters: - It may or may not receive value from calling environment.

21. Problems with structured programming?
1) It does not provide security for data.
2) It does not provide proper reusability.\
3) It is not applicable for distributed application development where object-to-object communication is required.
These problems have been overcome by introducing object oriented programming.
22. Object Oriented Programming?
Set of rules or principles
· Data Encapsulation
· Data Abstraction
· Inheritance
· Polymorphism
These rules should be followed to be oops language.
Data Encapsulation:- Binding data with related subprograms as a one unit is called as data encapsulation.
Data Abstraction:- Data abstraction is a concept of providing set of interfaces to the user without presenting complexity of execution.
Inheritance:- Acquiring properties of one entity into another entity is called as inheritance. This provides reusability.
Polymorphism:- Poly + Morphism ---à many + forms
Many forms of a single object is called as polymorphism
OOP--à 2 types
· Object Based S/Wà No Inheritance support.
· Object Oriented S/Wà Inheritance Supported
1. VB 4.0 à Data Encapsulation, Abstaction àSo Object based software
2. VB 5.0 àData Encapsulation, Abstraction, Interface & Interface Inheritance à partially object oriented.
3. VB 6.0 à same as VB 5.0
4. VB.Net is a object oriented software.
VB.Net is supporting data Encapsulation in two ways.
· Structure
· Class

23. Difference Between Structure and Class?
Structure
Class
It is a value type where the object will be maintained on the stack memory.
It is a reference type where object will be maintained on the heap memory.
It does not support Inheritance.
It supports Inheritance.
Accessing will be faster so it will improve the performance.
Accessing will be slow. It doesn’t provide better performance.
All members are by default public.
All members are by default private.

Note:-
When there is a small amount of data without inheritance then go with structure. All the data types except string and object are internally structures.
A Class can be defined as logical representation of data with related sub programs.


24. Object?
Object can be defined as a physical representation of data based on class. This can be called as instance of class.
Dim obj as New
New àIt allocates memory based on class data.
25. Constructor?
· Constructor name should be “new”
· Constructor should be sub procedure
· Constructor can be overloaded.
· Constructor can’t be called explicitly using object variable.
· Runtime will include a default constructor into the class.
This will not be included by runtime when the developer including constructor with parameters.
Constructor:-
Dim A as Byte=100
Dim obj as new Emp(100,500) àrequires constructor
A constructor can be defined as sub program of the class, which will be called implicitly when the object of the class is created.
The purpose of constructor is to initialize object data.

26. Method Overloading?
When the sub program is provided with more than one signature then it is called as method overloading.
The signature will depend on 2 things
1. Number of parameters.
2. Data types of parameters.
Ex:-
Sum(a as Byte, b as Byte)
Sum(a as Byte, b as Byte, c as Byte)
Sum ( s1 as string, s2 as string)
Sum ( a --,b---,c optional ---=0)
27. Method Overriding?
When the derived class is providing the same method name of the base class with the same signature then it is called as method overriding. This concept is called as virtual function concept.
Note:-
· In Java by default all the functions are virtual.
· In VB.Net by default all the functions are not virtual i.e., not overridable.


28. Shared Data?
The data attached to the class is called as shared data.
The memory allocation will take place only single time throughout the application execution.
This memory will be common to all the objects.
29. Shared Method?
The method attached to the class is called as “shared method”. This method can access only shared data.
30. Shared Constructor?
The shared constructor will be executed only once for the application execution.
This is required for initialization-shared data.
Class Oracle
Public shared con as OLEDB Connection shared sub new()
Con=new OLEDB Connection(“---“)
Con.open
End sub
End class

Dim obj1 as new oracle
àShared constructor will be executed
àOrdinary constructor will be executed
Dim obj2 as new Oracle
Ordinary constructor will be executed

31. Type of Inheritance?
1. Simple or single level inheritance [c1](base class) à[c2](Derived class.
2. Multi Level Inheritance [c1]à[c2]à[c3]
3. Hierarchical Inheritance (only one base class)
4. Multiple Inheritance
5. Hybrid Inheritance (more than one base class)
Note:-
VB.Net does not support more than one base class for the derived class it is avoided purposefully by the Microsoft to have a proper designing of classes.
32. Method Overloading, with Inheritance?
When the derived class is providing the different signature, then it is called as method overloading with inheritance.
This is not supported in C++ but it is supported by Java.
Class base
--
public sub accept(a1)
---
end class
class derived : inherits base
---
public overloads sub accept(a1,b2)
---
end class
33. MyBase Keyword?
MyBae is a reference to the base class object present within derived class.
This will be created by the runtime. This is required in two cases.
1. To call base class constructor from derived class constructor.
2. To call base class method from derived class method towards method overriding.
In terms of Java it is called super keyword.
34. MustOverride Method & MustInherit class?
When the method is defined without any functionality then it is called as must override method.
In C++ it is called as pure virtual function. In Java it is called as Abstrafct Method.
When the class does not support object creation then it is called as must – inherit class.
Java--à It is called as Abstract Class.
The class should be declared as a must inherit. If it is containing must override method.
Note:-
The derived class should provide functionality for must override method of the base class.
If it is not providing functionality then it should be declared as must inherit class.


35. Polymorphism?
1. Static polymorphism (compile time)
It is implemented through method overloading.
2. Dynamic Polymorphism (Run Time)
The base class variable can maintain a reference to derived class object this variable can access the methods inherited from base class.
When it comes to must override method the functionality will be loaded dynamical at run time based on derived class object.
This implementation is called class object.
This will consume less amount of memory resources.
The advantage of abstract method & abstract class is dynamic polymorphism implementation.

36. Not Inheritable class(sealed class)?
Syntax:- NotInheritable class
----
End class
The class which can not act as a … is called as NotInheritable
This provides security for the class.
In terms of Java it is called as Final Class.
37. Interface?
An Interface can be defined as collection of methods without any functionality i.e., prototypes of methods. This provides security for class.
Syntax:-
Interface
Sub 9….)
Function (….) as
End interface.
1. The methods within the interface does not support access specifier by default it will be public.
2. The class, which implements interface, should provide functionality for all the methods of interface.
3. An object can’t be created for the interface. The variable of the interface can reference class object, which is implementing interface.
Interface is similar to must inherit class.
Interface will support multiple inheritance where as must inherit class does not support multiple inheritance so it is strongly recommended to approach with interface when the method does not have functionality.
Note:-
1. One interface cannot implement another interface.
2. One interface can inherit another Interface.
38. GUI Programming?
When it comes to SDK Programming the developer has to write the code for designing part & logic part.
This will be more burdens on the developer & requires more time for application development.
To overcome these problems Microsoft has introduced VB1.0 in the year 1991.
*.Net
System.windows.forms.dll
System.windows.forms
(Namespace)
Form class:-
It will act as a container for collection of controls.
39. Even Driven programming?
ControlàObject
It can identify set of Actions (events)
The action identified by the object is called as an event.
When the action takes place with the object then it s called as event occurrence.
The sub procedure attached in a particular action is called as event procedure.
When the software supports code execution based on the actions then its is called as event driven programming.
Button Control:- To perform Action -àclick[event]
40. Debugging and Error Handling?
Application àErrorsà3types
· Syntax Error
· Runtime Error
· Logical Error
Syntax Error:- When the developer is not following syntax of the language then it leads to syntax error.
Runtime Error:- When the statement can not be processed by the run-time, then it leads to runtime error.
Logical Error:- When the output of the application is not matching to the developer exception, then it is called as logical error.
It is very dangerous in application. This logical error can be called as BUG.

Debugging is a process of identifying logical errors within the application. This goes with line-by-line execution.

VB.Net is providing following options to implement Debugging.
1. Step Into:- It will execute one line and cursor will be taken to next line.
2. Step Over:- It will skip sub-program for the debugging process.(Line by line execution)
3. Step Out:- It will stop debugging process.
4. Toggle Break Point:- It will stop normal execution at a particular line & control will enter into debugging process.

41. SQL Server?
· It is more compatible with Microsoft products.
· It provides better performance compared to oracle
· It is more user friendly, compared to oracle
· Problem with SQL-Serve is it can be installed only on Windows environment
It will maintain Databases, A database will maintain collection schema objects i.e., tables, views
SQL Server.Net will implement native protocol programming of SQL Server, This provides faster communication. This will improve the performance of the application.
According to Microsoft testing it will provide 60 to 70% performance gain over OLEDB.Net. It is applicable towards SQL Server 7.0 & later versions.
42. SQL Connection?
Dim Con as new SQLConnection (“userid=sa;password=;Database=Company56 or Intial catalogue=company56 data source=
Con.open()
Con.close()
For Windows Based Authentication :
Dim Con as new SQLConnection
..
..

43. Error Handling?
ApplicationàRuntimeà By Default it will be handled by Runtime.
· It will provide technical message
· Abnormal termination: To over come this problems developer will provide solution for error, this is called as error handling. It can be classified into two types
1) Unstructured Error handling
2) Structured error handling
Unstructured Error Handling:- Before .Net framework different languages of the Microsoft will support different approach for error handling this is called as unstructured error handling.
This does not support cross language error handling
This problem has been overcome under .Net framework by supporting structured error handling called exception handling.
VB.Net supports unstructured error handling. Unstructured error handling is required for migration projects.
44. Exception Handling?
Exception à Trapable Error à Error, which can be handled by the developer.
In .Net Framework all the errors information will be maintained in the form of classe4s called exception classes. This will be common to all the .Net languages. This will support cross language error handling.
Exception Classà
· OverFlow Exception
· Invalid cast Exception
· FileNotFound Exception
Syntax:-
Try
---
Catch
--
End Try
1. A Try block an have any no. of catch blocks which are mutually excvlusive i.e., only one catch block will be executed.
2. Multiple Try Blocks are supported.
3. Nested TryBlock is supported
Note:
1. Exception manager will verify with the catch blocks. If there is no catch block it will terminate the application & technical msg will be provided to the end user.
2. catch block with exception class can handle any type of exception because base class variable can be reference derived class object. Accept
---
Try
---
Catch ovf as
Catch e1 as Exception
Masgbox(e1.message)
It will display built in messages.
Catch block with exception class can be taken as 1st catch block, the control will not reach to followed by catch blocks.
Finally Block:-
Try
---
catch
-- (on error)
Finally
-- (other error or No error)
End Try
Finally block will be executed before the control comes out of try-bock.
This is required to release resources i.e., closing Database connection clsing File stream..
A try block will support only one finally block

45. User Defined Exception?
InvoideAppàTransactionàQOH<100àErroràIdentified by Developer
The error idenfied by the developer w.r.t an application is called as user defined exception.
The developer has to perform 3 things
1. Creating Exception class:- Class My Exception Inherits Exception sub new(str as string)
Mybase.new(str)
End sub
End Class
2. Throwing the Exception:-
Throw new MyException(“error message”)àIt will provide object to exception manager.
3. Handling Exception:- Handling exception with catch block

46. What is ADO?
ADOàRecordSet
· It supports Bi Directional Navigation
· It supports manipulations
· It doesn’t support constraints.
· It doesn’t support purely disconnected implementation.
· If supports Dynamic cursors.
· It will maintain data in ADTG format i.e., Active Data table gram format.
· It is a binary standard towards windows operating system so it does not support cross platform transmission.
47. What is ADO.Net?
ADO.NetàDataSet
· It supports bi-directional navigation
· It supports manipulations
· It supports constraints
· It supports purely disconnected implementation
· It does not support dynamic cursor.
· It will maintain data in XML based implementation. It is platform independent. It supports cross platform transmission.
48. Dataset?
Dataset can be defined as inmemory database for the client application process this will maintain collection of tables called as datatables.
Dataset is purely disconnected with XML storage.
49. Data Adapter?
DataAdapter will act as a mediator between dataset & database server. DataAdapter will maintain collection of command object. Data adapter will perform 2 things
· It will read data from database into dataset
· It wil update datast manipulations with database server.
Dim DA as new SQLDataAdapter(select * from emp”, con)
Dim DS as new Dataset
DS.fill(DS,”emp”)

Fill Method:-
Fill method will perform 3 things
1. It will establish connection
2. It will send select statement to the database sever using datareader. It will read record by record into dataset memory.
3. It will close the connection.
DS.Tables(“emp”).Row(0).Item(2)
DS.Tables(“emp”)Rows.Count
It will give total records.
50. Data Binding?
When address of the memory location is provided to the control, then it is called as data binding.
That control is called as bounded control.
Data Binding will reduce manual coding for the developer this makes developer job easier & application development faster.
Data Binding is applicable for windows application & ASP.Net web application . For other application we have to go through manual coding.ADO àsupports Data Binding.
Set t1.datasource=rc
T1.datafield=”empno”
a. The recordset column data will be given to text property of the textbox this can’t be changed.
b. A textbox can’t be related with more than one column of the recordset. These problems has been overcome within ADO.Net databinding.

Each windows form will maintain binding context object, a binding context object will manage collection of currency manager objets.
Currency manager will act as a pointer to dataset table. This will support manipulations & navigations with dataset table.
According to the record pointer bounded controls will be refreshed.
51. DataAdpter Wizard?
a. DataAdapter wizard can be used with windows application & ASP.Net web application.
b. It will create objects local to form.
DataAdapter will not be configured with delete command & update command if the back-end table is not having primary key column
52. DataGrid?
To display multiple records in a tabular format.

DataGrid will support all the manipulations; these manipulations
will be reflected on the dataset table through the currency manager.
Sorting with Data Grid:- When user clicks on the column header it will perform sorting in the ascending order. It it is second click it will perform sorting in descending order.
If red only property is true data grid does not support manipulations.
53. Data view?
Dataview can be defined as a virtual table based on , dataset tables this will support all the manipulations which will be reflected on dataset table & vice-versa.
Dataview will support following.
· Filtering datset table based on particular criteria.
· It will support sort in based on particular column.
· It will provide security for dataset table by restricting manipulations.
54. Data Relation?
When you want to apply foreign key relation between dataset table columns then we required data relation.
DataRelation will provide 3 features
i. Child record will not be accepted if there is no parent record.
ii. The parent record can’t be deleted if the child records exist or the parent record can be deleted along with corresponding child records.
iii. The child records can be accessed based on parent record.
If the requirement is 1st two things Data Relation is recommended.
It will consume more amounts of memory resources.
55. Dynamic Cursor?
When the database table manipulation is reflected implicitly within record set memory then it is called as Dynamic cursor implementation.
This Dynamic cursor is supported by only SQL-Server where the database server will manage the record set.
· ADO.Net does not support dynamic cursor implementation because Dataset is purely disconnected implementation. when the .Net application require dynamic cursor implementation the solution will be ADO Library.
56. COM?
Components object Model.
Component?
A component can be defined as unit of binary standard code, represented in the form of DLL or EXE or OCX
Component will provide following:-
a. Reusability.
b. Better Maintenance
c. Application startup will be faster.
d. Language Interoperability
The requirement in the industry is component concept with object oriented programming. The solution provided by the Microsoft is COM.
COMà 1) Set of RulesàCOM interfaces
2) Set of subroutinesàCOM Runtime.
· COM rules have to be implemented by the developer for designing component.
· COM Runtime is provided for providing component services to different client applications.
· COM comes as a built in with windows operating system.
· COM Interfaces:
IUnknown Interface.
Udispatch Interface
IUnknown Interface:
· ADDRef
· Release
· Query Interface
A com component should maintain a counter variable called as ref. Count. When a reference is provided for the COM object AddRef method will increment reference count variable. When a reference is removed for the COM object, release method will decrement reference count variable. If the ref. Count becomes zero, COM object will be destroyed.
Query Interface will provide access to other interfaces supported by Com.
Iunknown interface is called as standard COM Interface.
This has to be implemented by every COM component. As it carries lifetime methods for components.
Note:
VC++ , will support the COM directly where as visual Basic will support com indirectly through activex platform.

A COM component requires a unique identifier called as GUID ie., Global Unique Identifier. This GUID will be 128 bit no in the hexadecimal format, this will provide uniqueness for the COM components.
After attaching GUID the source code can be compiled into DLL or Exe.
COM supports two type of components
1) In process Com Component
2) Out process Com Component
Inprocess component will provide faster communication i.e., better performance compared to out-process component. Out process component is required to implement automation & distributing services through DCOM
COM Component should be registered under windows registry.
57. InProcess COM Component?
When the COM component is loaded into the client application process, then it is called as inprocess COM component. This will be represented in the form of DLL server.
58. Out-Process COM Component?
When the component is external to the client application process, then it is called as out-process component. This will be represented in the form of EXE.Server

59. COM Drawbacks?
· COM is a binary standard towards windows.
· COM component is invalid without registry entry.
· COM doesn’t support inheritance it is object based.
· Versioning problem: Windows Registry can’t maintain multiple versions of same COM components. This is called as versioning problem. It can be termed as “DLL HELL”
This problems has been overcome in .Net Framework by introducing “Assemblies”

60. Assemblies?
Assembly can be defined as a small unit of code for deployment.
This provides reusability, security & versioning.
Assembly will contain collection of user defined types & resource information . The user defined types will be grouped under logical container called as “Namespace”
Assemblyà
1. EXEàApplicationàNo Reusability
2. DLLàLibraryàReusability
Friend class:- The class which is accessible only within the assembly is called Friend Class.
Public Class:-The class which is accessible outside the assembly is called as public class
Friend Method:- The method which is accessible with the instance created within the assembly, then it is called as Friend Method.
Protected Friend:- This is similar to Friend method, It is accessible outside the assembly within derived class only.
Assembly can be classified into three types.
1) Private Assembly:- The Assembly local to a particular folder is called as “private Assembly”. This assembly will be accessible to all the applications present in the same folder. Private Assembly is recommending when the assembly is required for a specific application.
2) Shared Assembly
3) Satellite Assembly

61. Probing?
It is a concept of runtime locating assembly required for the application execution.
The default probing of private assembly will be implemented in two places
1) Application Folder ( E:\VBNET56)
2) Subfolder with the name of Assembly(E:\VBNET56\MYDLL)
The probing can be extended by providing set of instructions to the run time in the form of configuration file.
.
62. Assembly Architecture?
Manifest

Type
IL

Meta Data
code
Resource Info


Manifest:- Manifest will contain Metadata of the Assembly. This includes title of the assembly, description of the assembly public key, company Name, version no so on.
Manifest will maintain the files required fort the assembly.
Compiler will prepare the manifest & It is required for the run time
CmdPrompt:> ILDASM MYDLLCLIENT.EXE
Type Metadata:- It will maintain description of namespaces & types supported by assembly.
IL Code:- The compiler will convert .Net high-level language code into IL-code.
This is understandable to the CLR (common Language Runtime).
This is not a executable code. It is a platform independent code which will be interpreted by CLR into operating system native code.

63. What is Shared Assembly?
When the assembly is placed into a repository called as “GAC” then the assembly is called as “Shred Assembly”.
A single copy of Assembly will provide services to different Client applications through out the system hence it is also called as “Machine wide Assembly”.
When the Assembly is required for set of applications then always go with ‘shared Assembly’.

64. Generating Public Key?
Microsoft is providing strong Name utility i.e, [SN.Exe]
E:\VBNET56> sn –k(lower case k)
E:\> SN –k keyfile1.snk
It will produce keyfile1.snk
Containing publickey.
E:\dir> SN –tp keyfile.snk
Public key is …..
…. Public key token is 12AB-----
Public key:- Public key is a very lengthy number. It will occupy around 160 bytes of memory; it will under go hashing and produces 8 byte number called as “public key token”.
This public key token will be given to each client application.
.
_______________________________________68 page
65. Strong Name?
When “xxxx“assembly is Build then It will produce xxxx.dll signed with public key.
When the assembly signed with public key, then it is called as strong named Assembly.
Strong Name is a collection of 4 things.
· Assembly Name
· Public key
· Version number
· Culture (English USA default)
This strong name will provide uniqueness for Assembly
66. What is GAC (Global Assembly Cache)?
GAC will act as a registry of .Net framework for maintaining shared Assembly. This comes with the installation of .Net Framework.
Location:- C:\WinNT\AssemblyàGAC[Global AssemblyName verson …]
GAC is applied with security options.
1. It will accept only strong Name assemblies.
2. It is accessible to the user with administrator privilege.
Placing Assembly into GAC:-
1. Windows Explorer.
E:\VBNET56\Sassembly56\Bin\Sassembly56.Dll…. drag and drop at c:\WinNT\Assembly
2. Command prompt UtilityàGacutil.exe
Cmd:\> Gacutil –i “E:\VBNET56\Sassembly56\bin\Sassembly56.dll”
Assembly will be placed into GAC.
Cmd:\> Gacutil –u Sassembly56
To delete from GAC
Windows Registry will maintain location of COM component where GAC will contain Assembly.
Windows Registry cannot maintain multiple versions of COM component where as GAC can contain multiple version of Assembly.
When the DLL is placed into version folder, then the assembly will be displayed with built in assembly list, under ADD Reference.
67. CLR Architecture?
.Net àRuntimeàCLRàMscoree.dll
c:\winNT\System32
CLR is platform dependent different Operating systems will be provided with different Runtimes i.e., CLRs
When you execute .Net application the request will go to operating system, o/s will take care of loading CLR. The application, which will load CLR, is called as “RunTimeHost”
The RunTimeHost for desktop application is an API function called “CORBINDTORUNTIME”
The RunTimeHost for web-based application is an ASP.Net WORKER Process i.e.,[ASPNet_wp.exe]
ClientApp.exeàAassembly.DLL
CLR is a collection of resources i.e., services.
Assembly Resolve will read the manifest of the application. It will identity private assemblies & shared Assemblies required for the application it will forward request to assembly loader.
68. What is Assembly Loader?
· Assembly loader will load the assembly into application process.
69. What is Type Checker?
Type checker will verify all the types used in the application with CTS or CLS standard.
This provides type safety
70. What is Debug Manager?
Debug manager service will provide line by line execution. This will support debugging process
71. What is Garbage Collector?
It will release the memory of unused objects. This will provide automatic memory management.
72. COM Marshaller?
It will provide communication with COM runtime.
This will support inter-operatability with COM
73. What is Thread Support?
This service will maintain more than one execution path within application process.
This will provide equal processor time to all the execution paths this will support multi-threading.
IL to Native Compiler is called as ‘JIT’ compiler [i.e., Just in Time Compiler]
This will convert intermediate language code into operating system native code.
74. What is Versioning Assembly?
When you want to differentiate older content of the assembly with the newer content of the assembly then we require version number. I.e.,., versioning Assembly.
This provides Uniqueness for the Assembly.
Version number comes with 4 parts
1) Major.Minor.Build.Revision
When the subprogram logic is modified the version number of the assembly has to be changed towards revision part.
When new sub-programs are added version number has to be changed towards build part.
When the interface names are changed i.e., method names & class names.
Version number has to be changed towards minor part.
When new classes are added into the assembly, version number has to be changed towards major part.
Runtime will provide compatibility towards revision & build parts.
75. What is Side-by-Side Execution?
When more than one application is executed side by side using the same Assembly by side using the same Assembly with different version numbers, than it is called as side-by-side Execution.
This is supported because GAC can maintain multiple versions of same Assembly
76. What is Interoperatibility With COM?
· Managed Code:- The code which will be executed under the control of CLR than it is called as managed code.
· Unmanaged code:- The code which will be executed outside the CLR is called as unmanaged code …
· Unsafe Code:- This is a managed code which is not recommended to use in the application development. This is pointer programming.
Note: This is not supported by VB.Net It is supported by C#.
When managed code is communicating with unmanaged code then it is called as interoperatibility.
Interopertibility is required towards migration projects. I.e., converting VB 6.p application into VB.Net Application.
77. Converting Type Library into Type Metadata?
Type Library can be converted into type metadata in two ways
· Using Visual studio.Net
· Using Command prompt utility àILBIMP.ExeàType Library Importer utility.
Note: CLR will maintain a proxy i.e., software to communicate with COM runtime. This proxy is provided with a name called as RCW i.e., Runtime callable Wrapper..Net Application is dependent on COM based DLL.
· CLR services will not be provided for component.COM object will be destroyed by itself. Garbage collector service will not be provided.
· Inheritance is not supported.

78. What is Type Library Importer Utility?
VS.Net will produce Private Assembly from COM based DLL.
If the requirement is shared Assembly then go with type library importer utility.
Cmd:\> TLBIMP KEYFILE:KEYFILE1.SNKNAMESPACE:vbmATH56Netout:vbMath56Net.dll vbMath56.Dll
It will produce VBMath56Net:Dll [.Net Assembly]
Singed with public key.
Cmd:\> Gacutil –I VBMath56Net.Dll
VB6.0 application can take the services of .Net Assembly.
MicroSoft is providing two utilities for converting TypeMetaData into TypeLibrary.
a. Type Library Exporter utility i.e.,[TLBEXP.EXE]
b. Register Assembly [RegAsm.exe]
“TLBEXP” will not regster COM based DLL under windows registry where as “RegASM” will register Under Windows registry
E:\VBNET56 àMYDLL.DLL[.NET]
Cmd:\> RegASM tlb:mydllcom.dll
It will produce my DLLCOM.DLL
79. What is CCW (COM callable Wrapper)?
CLR will maintain a proxy to receive COM request. This proxy is provided with a name called as CCW i., COM Callable Wrapper.
· When .Net application is calling windows API function then it is called as pinvoke i.e., platform invoke.
· COM based component can be developed directly from visual studio. Net
80. Windows Control Library?
To create user defined control it provides reusability.
The user defined control can be created in two ways.
· Inherited Control: - Extending functionality of existing control.
· User Control:- Grouping collection of existing controls.
Note:-
Raise Event will make a call to event procedure provided by the application developer.
VB 6.0 supports user defined control creation with activex control project.



81. Difference between ActiveX Control and Windows Control Library?

ActiveX Control
Windows Control Library
It will be represented in the form of OCX file i.e., OLE Control Extension It is a COM based Component. It requires registry entry.
It will be represented in the form of DLL file It is a .Net component It doesn’t require registry entry.
It does not support Inherited control creation because COM doesn’t support inheritance.
It supports Inherited control & user control creation.
It doesn’t support scratch level control creation.
It supports scratch level control creation using Graphics [GUI]

82. What is Delegate?
C , C++ àFunction pointer . It will maintain Address of the sub programs.
· In C++ function pointer is provided in the form of ordinary statement. It is not provided with object oriented approach.
· In C++ function pointer can not maintain address of member functon.
· In C++ function pointer does not provide Type safety.
This ploblems has been overcome under .Net Framework by providing ‘Delegate’
Delegate is a user defined type for maintaining address of the sub program.
This acts like ‘function pointer’
Syntax:-
Privatepublic Delegate subFunction ( para…..)
Private delegate sub
Any method withstring (s as string)
It will be inherited from system.delegate
Dim ptr as AnyMethodWithString
Ptr=Addressof
The delegate variable can maintain address of the sub program where the sub program type & signature should match with delegate type.
Ptr.Invoke(---)
It will call subprogram.
Delegate is required to implement callback functionality.
In this case one sub program will be send as a parameter to another sub-program.

Microsoft has applied Delegate concept in different areas of .Net f/w
1. Event Handling
2. Multithreading
3. Distributed Application
Even Handling Architecture:- It will maintain address of subprogram i.e.àDelegate
Microsoft is providing a delegate towards each event. The application developer should provide sub-procedure to the event delegate.
This sub-procedure should match with signature of the delegate.
For this reason it is mandatory to provide two parameters for the event procedure.
VB.Net is supporting two types of event Binding.
1. Static Event Binding.
2. Dynamic Event Binding.
Static Event Binding:- When address of the sub program is provided to the event delegate at compilation time, then it is called as static event binding. This can be implemented using handles keyword.
A single sub-program can act as a event procedure for more than one control event.
The First parameter will provide reference to the control which is making a call to sub-provide additional information based on the action performed by the user.
Advantages:-
1. It provides reusability
2. It provides better maintenance
VB 6.0 supports control array this will provide one event procedure for set of controls. The controls should belong to same category.
VB.Net does not support control array. The same can be implemented with ‘Delegate’ concept. It provides more flexibility.
Dynamic Even Binding:- When the sub-program address is provided to the event delegate at Runtime, then it is called as Dynamic event binding.
This is required when the control creation takes place at runtime.
This can be implemented using two methods
1. Add Handler:- Attaching subprogram to Event Delegate
2. Remove Handler:- Removing sub-program from event Delegate.
83. Crystal Report Designer?
Report à Presentation of Data in a formatted manner.
The Data will be presented in different sections
· Report Header section
· Group Header section
· Page Header Section
· Details Section
· Page Footer section
· Group Footer Section
· Report footer section
Crystal Report:- VB6.) Supports crystal report designer & data Reprot Designer.
Crystal Report
Data Report
It is a third party software provided by Seagate software.
This is provided by Microsoft it comes as build in with VB6.0
It doesn’t support Dynamic SQL i.e., select statement can’t be provided to the report through programming.
It supports Dynamic SQL.
It supports complex report generation
It supports Basic report generation.
VB.Net supports only crystal Report Designer. This comes as build-in with .Net Framework.
Microsoft is maintains a team called as crystal Decisions Team this will take of enhancements towards crystal report Designer under .Net framework.
Crystal Report Designer is supported with desktop application & web based application.

84. Crystal Report Viewer Control?
This control will act as a container for presenting crystal report & it is provided with set of build in options for printing, zooming, navigation buttons.
85. Packaging & Deployment?
When comes to Xcopy deployment client has to perform set of manual operations in terms registering DLL files creating programs menu so on.
To avoid this manual operations setup creation has been introduced.
When you create a setup for the application then it is called as ‘packaging’
VB6.0 supports CAB based setup[i.e. Cabinet File setup] this will support maintaining application in a single CAB file or multiple CAB files.
The problem with this is, it will not perform uninstallation, if the installation is terminated in the middle.
This problem has been over come with “Windows Installer package setup” i.e., MSI setup.
This will support maintaining the application only in a single file.
.Net framework supports the different types of projects for setup creation.
Setup Creation:-
1. Setup projectàMSI setup for Desktop Application.
2. Web Setup ProjectàMSI setup for Web Application
3. CAB setup Project
4. Merge Module Project
It will package Assembly or Assemblies in the form of ‘MSMFile’
This is not a independent setup it has to be related with MSI setup
Or CAB setup project.
If the application is communicating with oracle or sql-server database the ‘export file’ has to be created. This export file can be carried along with the setup to client system the tables can be imported in the client system.
Exporting Oracle Data:-
D:\Oracle\orac90\Bin> Exp
Username = scott
Password = tiger
Exportfile :> H:\VbNet56\ORATABLES.DMP
“ T
“ EMP
All the tables struction & data will be stored into a Dump File Called ORATABLES.DMP.
This file should be carried to the client system.
In the client system using import utility i.e., Imp.exe.
The data can be imported from dump file into oracle database server.
Deploying Application in Client System:- Client system requires CLR & Base class libraries for executing .Net Application.
Microsoft is providing a redistributable package called as ‘dotNetfx.exe’
When you Run this exe, it will install CLR & Base class libraries.
This is provided with windows component update CD & it is free download from Microsoft website.
86. Multi Threading?
Thread:-
A thread can be defined as unit of code maintaining its own execution path.
When the application is executed only one execution path then it is called as “single threaded application”
When the application is maintaining more than one execution path then it is called as ‘multithreaded application’.
When the application is having task which can be finished without user interaction then approach with threading implementation.
This will improve the performance of the application.
Ex. Printing job
Clientserver app.
Asynchronous Connection
Asynchronous Query
Graphics
Note:- CLR is maintaining a service called ‘thread support service’ this service will manage more than one execution path within .Net application process.
It will distribute equal processor time for all the threads within application process.
Methods:
1. Start() à It will maintain execution path for sub-program.
2. Sleep(milliseconds) à It will halt thread execution for N millisecs.
3. Suspend()
4. Resume()
5. CurrentThread() àIt will return thread under execution.
6. Join()àIt will attach child thread with the main thread so that main thread will be alive till all the child threads are dead.
7. Abort() à It will stop thread execution
Note:- Multi threaded application will provide different results for the different executions. It will be based on Hardware of the system & number of process handled by the operating system.
87. Asynchronous Connection?
When the application is waiting for the response of database server than it is is called as synchronous connection.
When the application is not waiting for the response of database server, then it is called as Asynchronous connection.
This will improve performance of the application.
Asynchronous connection is only recommended when the fallowed by statements are not dependent on the connection.
ADOà It supports Asynchronous Connection.
Dim Con as new connection
Con.open “provider name”,”username”,”password”,adAsyncConnect
à It will implements Asynchronous connection.
Note:- ADO.Net does not support Asynchronous connection, this can be implemented through “multithreading”.

88. Synchronization of Threads?
When the threads are executed one after another than it is called as synchronization of threads.
This is required when more than one thread is assigned with the same task.
This will provide proper result.
89. Distributed Application Development?
Application goes with 3 things presentation logic, Business logic, data storage.
Arrangement of these 3 things will go with 3 types of Architectures.

1. Single Tire-Architecture or monolithic Architecture.
2. Two Tire-Architecture or Client-Server Architecture.
3. Three Tire-Architecture.
90. Single Tire Architecture?
When a single user operates application then goes with single tire implementation.
If different users operate the application in different systems where the centralization data is required, and then go with ‘Two-Tier’.
91. Two Tire Architecture?
· In two tier Architecture business logic will be repeated in each client system so the maintenance will not be easier & no security for database tables. It is recommended to maintain business logic with database server in the form of stored sub-program. This is called as 2 ½ type Architecture
92. 2 ½ Tire Architecture?
When it comes to enterprise level where more no. of clients will be existing in different locations, it is not recommended to maintain business logic with database server for the following reasons.
· More burden on database server
· Client side software of database should be installed in each client system so the organization has to purchase more no. of client side licenses. This will be financial burden for the organization.
· Providing Database location to the client system is not recommended for the security reason. And the application communicating with database directly will create the maintenance problem.
· The solution for this problem is creating database independent application; this is possible with 3 tier Architecture.
93. Three Tier Architecture?
When the business logic is maintained independent of client application and data base server, then it is called as three-tier architecture.
Microsoft is supporting 3 tier architecture with D-COM.
Sun micro system is supporting three tier Architecture with RMI.
94. DCOM?
Distributed COM. It will distribute business logic to different client applications on the network.
It will produce 3 files
i) .Tld file is a type library file this will contain description of methods required for client application.
ii) .Vbr file will contain DCOM services required for the client application.
‘Tld & Vbr’ files are required in the client system to communicate with server system.
When Client makes a request proxy will convert request into stream, this is called as serialization. This stream will be arranged in a particular format by attaching IP Address to the network level, transmission. This is called as “MARCHALING”.
When the request is provided to the strub object it will perform unmarshaling & Deserialization of data & then makes a call to actual method on server machine & vice versa.
95. DCOM Drawbacks?
· It will produce N/W based stream, this is platform dependent. So transmission is supported under Windows NT.
· The arrangement of stream is proprietary std. So communication is possible between m/s applications.
· It supports only client activation mode. The object will be created towards each client request.
This will be burden for the server in certain cases.
These problems have been overcome under .Net FW by supporting remoting and XML web services.
96. Remoting?
It will provide .Net application to .Net application communication under homogeneous or heterogeneous platforms.
A ‘Channel’ is a means of communication between two applications ‘Remoting’ is supporting two types of channels.
i) TCP channel
ii) HTTP Channel
‘HTTP Channel” will produce XML based stream this is platform independent stream. This is required for cross platform transmission.
97. Difference between TCP Channel and HTTP Channel?
TCP Channel
HTTP Channel
It will produce binary standard stream. It is a compressed format stream. It will consume less amount of memory so transmission will become faster. This provides faster communication.
It will produce XML based stream. It is a text-based format It will consume more amount of memory so transmission will become slow. This makes communication slow.
It is applicable for intranet-based implementation.
It is for intranet based & internet based implementation when it comes to internet based implementation is has to be related with web server.
It requires manual coding to implement security
It doesn’t require manual coding to implement security will be provided by web server.
98. Remoting Serialization & Deserialization?
This can be implemented using ‘formatter classes’
i) Binary formatter
ii) SOAP formatter
Objectàformatter (serialization)àstream
Streamàformatter (de-serialization)àobject
Binary formatter will produce binary standard stream, this is used by TCP channel.
SOAP formatter will produce XML based stream, this is used by ‘HTTP channnel’
99. Remoting Activation modes?
Remotingàmarchal by value
àmarchal by referenceàserver activated àsinglecall
àsingleton
ClientActivated
1. When it comes to marshal by value the object will be created within server application process. This object will be transmitted to client application process.
2. When it comes to marshal by reference the object will be maintained by the server application process & client application will communicate with the object.
3. When the client makes a method all then the object is created makes a method call then the object is created within server application process, this is called as server activated implementation or server activated object.
If it is ‘single call’ the object will be destroyed after method execution. This is purely stateless implementation.
If it is ‘single ton’ the same object will provide services to different clients.
This object will be maintained by the life time 5 min. default.

· .Net àSystem.RunTime.Remoting.DLLà
Creating a channelàsystem.Runtime.remoting.channels.TCPHTTP namespace.
Dim t as new TcpChannel(PortNumber)
A portnumber is a logical one which will provide uniqueness for a particular service.
This will connect client request with a particular service.
This is called as End-point for the communication.
The portnumber should be in the range of ‘0 to 65535’ ‘1024’ ports are Reserved.

HTTP à80 port number
FTP à21
SMTP à25
NNTP à118
HTTPS à443
ORACLE à1521

Registering with O/S
System.Runtime.remoting.channels (namespace)àcahnnel services calssàRegister channel(+)
Registering Type with Remoting Registryà system.Runtime.remoting(Namespace)àremoting configuration calssàregisterwillknownservicetype(type,uri,mode)
* SystemàmarshalbyrefobjectclassàIt will provide for lifetime of object.
àIt will provide logic for stream generation.
When you want to distribute a class the class should be inherited from Marshal ByRefObjectClass.

100. Resource Management?
Non executable data of the application is called as resource information of the application. It is recommended to maintain external to the application sothat the maintenance will become easier & it can be loaded into the application Dynamicaly. It is not recommaned to maintain this information in the form of textfile for the security reason.
It has to be maintained in the binary standard format, this is called as resource file.

H:\vbnet56àMyResources.txt[notepad]
ADDR=Ammerpet, Hyd
Constr=Provider=MSDAORA.1;user id=scott;password=tiger;Datasource=sever

Microsoft is providing resource generator utility to compile text-file into resource file.
>Resgen MyResources.txt
MyResources.Resources:

The Resource information can be packaged in the form of an assembly called as “satellite Assembly”
The Assembly which maintains only resource information is called as “Satellite” Assembly or Resource only Ass.
Satellite Assembly can be generated by using Assembly linker utility i.e.,(AL.exe)

101. What is Static Assembly?
When the Assembly information is available under manifest of the application then the assembly is called as ‘Static Assembly’
102. What is Dynamic Assembly?
When the Assembly information is not available under manifest of the application but the assembly is loaded dynamically at Runtime, Then it is called as Dynamic Assembly.
The satellite Assembly can be loaded dynamically into the Application.
103. What is Loading Assembly?
Dim A as System.Reflection.Assembly
A=system.Reflection.Assembly.Loadfile(“E:\VbNet56\RAssembly.DLL”)
Dim Rm as new system.Resources.Resourcemanager(“MyResources”,A)
Rm.Getstring(“Addr”)
104. What is Localization & Globalization?
* CultureàLanguage code-----Country code

Each culture will have its own set of standards in terms of dae format time format, currency format so on..
When you design an application specific to culture then it is called as localization.
When you design an application supporting multiple cultures then it is called as Globalization.
The default culture will be English US.(en US)

1 comment:

suresh said...

hi this is suresh your infirmation is very useful to others.