How do you register a component?Expected answer: Compiling the component, running REGSVR32 MyDLL.dll
Name and explain the different compatibility types when creating a COM component.Expected answer: No Compatibility ? New GUID created, references from other components will not workProject Compatibility ? Default for a new component <Not as critical to mention this one>Binary Compatibility ? GUID does not change, references from other components will work
Why iss it important to use source control software for source code?Expected answer: Modification history.Code ownership: Multiple people can not modify the same code at the same time.
What two methods are called from the ObjectContext object to inform MTS that the transaction was successful or unsuccessful?Expected answer: SetComplete and SetAbort.
What is the tool used to configure the port range and protocols for DCOM communications?Expected answer: DCOMCONFIG.EXE
What does Option Explicit refer to?Expected answer: All variables must be declared before use. Their type is not required.
What are the different ways to Declare and Instantiate an object in Visual Basic 6?Expected answer: Dim obj as OBJ.CLASS with eitherSet obj = New OBJ.CLASS orSet obj = CreateObject(?OBJ.CLASS?) orSet obj = GetObject( ,? OBJ.CLASS?)orDim obj as New OBJ.CLASS
Name the four different cursor types in ADO and describe them briefly.Expected answer: The cursor types are listed from least to most resource intensive.Forward Only ? Fastest, can only move forward in recordset Static ? Can move to any record in the recordset. Data is static and never changes.KeySet ? Changes are detectable, records that are deleted by other users are unavailable, and records created by other users are not detectedDynamic ? All changes are visible.
Name the four different locking type in ADO and describe them briefly.Expected answer: LockPessimistic ? Locks the row once after any edits occur.LockOptimistic ? Locks the row only when Update is called.LockBatchOptimistic ? Allows Batch Updates.LockReadOnly ? Read only. Can not alter the data.
Describe Database Connection pooling (relative to MTS )Expected answer: This allows MTS to reuse database connections. Database connections are put to ?sleep? as opposed to being created and destroyed and are activated upon request.
What are the ADO objects? Explain them. Provide a scenario using three of them to return data from a database.Expected answer: Connection ? Connects to a data source; contains the Errors collectionCommand ? Executes commands to the data source. Is the only object that can accept parameters for a stored procedure.Recordset ? The set of data returned from the database.Scenario: There are many possibilities. The most likely is as follows:Dim conn As ADODB.ConnectionDim rs As ADODB.RecordsetDim Cmd As ADODB.Commandconn.ConnectionString = ?CONNECTION STRING?conn.OpenSet Cmd.ActiveConnection = connCmd.CommandText = ?SQL STATEMENT?Set rs = Cmd.ExecuteSet rs.ActiveConnection = Nothingconn.Close
Under the ADO Command Object, what collection is responsible for input to stored procedures?Expected answer: The Parameters collection.
What are some benefits of using MTS?Expected answer: Database Pooling, Transactional operations, Deployment, Security, Remote Execution.
What is the benefit of wrapping database calls into MTS transactions?Expected answer: If database calls are made within the context of a transaction, aborting the transaction will undo and changes that occur within that transaction. This removes the possibility of stranded, or partial data.
Describe and In Process vs. Out of Process component. Which is faster?Expected answer:An in-process component is implemented as a DLL, and runs in the same process space as its client app, enabling the most efficient communication between client and component.Each client app that uses the component starts a new instance of it.An out of process component is implemented as an EXE, and unlike a dll, runs in its own process space. As a result, exe’s are slower then dll’s because communications between client and component must be marshalled across process boundaries. A single instance of an out of process component can service many clients.
What are the main components of the ADO object model? How are they used?Expected answer:Connection: Used to make a connection between your app and an external data source, ie, sql server.Command: Used to build queries, including user-specific parameters, to access records from a data source (which are returned in a Recordset)Recordset:Used to access records returned from an SQL query. With a recordset, you can navigate returned records. You can also add, modify or delete records.
Good site.But it’ll be better if u people will specify the fullword of the Acronyms given like MTS.It’ll help alot for average or beginers.Anyway thanks alot!!!
Object linking and embedding, for using to other object classes like
word, excel , autocad objects in our own applications, only thing we have to add reference for these objects
Q : What is the need of tabindex property is label control.
Ans : Set the UseMnemonic property to True if you want to define a character in the Caption property of the Label as an access key. When you define an access key in a Label control, the user can press and hold down ALT+ the character you designate to move the focus to the next control in the tab order.
Q : What is the need of zorder method?
Ans : Three graphical layers are associated with forms and containers. The back layer is the drawing space where the results of the graphics methods are displayed. Next is the middle layer where graphical objects and Label controls are displayed. The front layer is where all nongraphical controls like CommandButton, CheckBox, or ListBox are displayed. Anything contained in a layer closer to the front covers anything contained in the layer(s) behind it. ZOrder arranges objects only within the layer where the object is displayed.
Q : .____ is the difference between Listindex and Tab index.
Ans : Listindex : Gives current index inside a list
Tabindex : specifies the tab order in the form
the ans to question “Which property of textbox cannot be changed at runtime” is only the Name Property of the textbox. The ans provided above “TabIndex” is wrong u may change tab order at runtime.
Q-1:which type of combobox is non editable ?
ans:dropdown list
Q-2:which method of recordset is used to store records in an array?
ans:getrows
q-3:how can you display records page wise?
ans:use pagesize,pagecount,absolutepage property of recordset.
q-4:why recordset.recordcount returns -1??
ans:cursertype may not be forwardonly
for more questions mailto:prasantpkm@yahoo.com
This site is good. Why don’t you include the Q/A’s provided by users? So nice of them. They are not doing any business here.
Do we require Miscellaneous stuff for sexy singles and dating that you are showing on the left side? If that is for your business, plz.. that is not required for us. Let’s encourage education and knowledge sharing and nothing else.
What is the difference between and Interface and an Abstract Class?
While this topic is probably more popular amongst Java or .NET peeps, don’t be surpised if asked in an interview.
An Interface basically is a contract which defines the factors (properties and methods) that a class must provide. However the interface does not specify how these factors are to be implemented.
An abstract class is similar to an interface in that it defines empty properties and methods but may include some methods and properties which are already implemented.
Functionally in VB6 they are pretty much the same. You can create standard interfaces by compiling abstract classes in Visual Basic ActiveX DLLs or EXEs, or with the MkTypLib utility. In order to implement an interface, you must use the References dialog box to set a reference to the type library or ActiveX DLL or EXE. In similar fashion, any application that uses objects which have implemented an abstract interface must also have a reference to the type library that describes the interface. Information about implemented interfaces cannot be included in the type libraries of components, because there is no way to resolve naming conflicts.
VB6 does not support inheritance but provides for using interfaces as a means of class inheritance and extension.
Q: Early Binding vs Late Binding - define them and explain their pros and cons
A: Binding refers the object type definition. You are using Early Binding if the object type is specified when declaring your object. Eg if you Dim myObject as ADODB.Recordset that is early binding.
If on the other hand you declare your object as a generic type you are late binding. Eg if you Dim myObject as Object.
On should note that binding is determined at object declaration and not at object instantiation.
Therefore it does not matter if you later go on to Set myObject = New ADODB.Recordset or Set myObject = CreateObject(”ADODB.Recordset”).
Early binding allows developers to interact with the object’s properties and methods during coding. You can enjoy the benefits of intellisense. Also, early binding permits the compiler to check your code. Errors are caught at compile time. Early binding also results in faster code. It’s disadvantage is that you cannot create a generic object which may be bound to different types of objects.
Late binding on the other hand permits defining generic objects which may be bound to different objects. Eg you could declare myControl as Control without knowing which control you will encounter. You could then query the Controls collection and determine which control you are working on using the TypeOf method and branch to the section of your code that provides for that type. This is the only benefit of late binding. It’s disadvantages are that it is error prone and you will not enjoy much intellisense whilst coding.
Q: How does Option Explicit affect using late binding?
A: It doesn’t! Option Explicit demands that variables are declared prior to being used. The variable type does not have to be defined. In .NET using Option Strict Off will affect late binding.
Q. : What is Maximum no. of controls that can be placed on a VB6 standard form?
Q. : How do we add a registry entry in HKEY_LOCAL_MACHINE, using a function in VB6 and also how to retrive it? i was able to make the entry in HKEY_CURRENT_USER and read it too.
36 Comments on Visual Basic
Good site.But it’ll be better if u people will specify the fullword of the Acronyms given like MTS.It’ll help alot for average or beginers.Anyway thanks alot!!!
very helpfull site .it is the site which i searched for a long time to get interview questions…pls put more questions…and practice test also
Nice questions. Please cover COM/DCOM also.
Nice site, good for preparing ourself for the interviews
Question from other site : Which controls can not be placed in MDI ?
Ans : Controls Wihtout the align porpery can not be placed directly in a MDI form
Question : List out controls which does not have events
shape, line controls
Q : Which property of textbox cannot be changed at runtime. What is the max size of textbox?
Ans : example : LAignment property, tabindex etc.
max size : No limits
Q : To.set the command button for ESC ___ Property has to be changed.
Ans : Cancel
Q : What is the default property of datacontrol.
Ans : Caption
Q : .___,__,___ are the type of combo box?
1. dropdown combo
2. simple combo
3. dropdwon list
Q : OLE is used for _______
Object linking and embedding, for using to other object classes like
word, excel , autocad objects in our own applications, only thing we have to add reference for these objects
Q : What is the need of tabindex property is label control.
Ans : Set the UseMnemonic property to True if you want to define a character in the Caption property of the Label as an access key. When you define an access key in a Label control, the user can press and hold down ALT+ the character you designate to move the focus to the next control in the tab order.
Q : Clear property is available in ____,___ control.
combo, list controls
Q : .___ Property is used to count no. of items in a combobox.
Ans : ListCount
Q : .___ is a property to resize a label control according to your caption
Ans : Autosize
Q : Which controls have refresh method.
Ans : Checkbox, comna, combo, list, picture, ADo control, Data,Datagrid, Datareport,Dir list biox, filelistbox etc
Q : Timer control contains ________ no. of events.
Ans : Only One
Q : .____ property is used to lock a textbox to enter a datas.
Ans : Locked = true
Q : What is the need of zorder method?
Ans : Three graphical layers are associated with forms and containers. The back layer is the drawing space where the results of the graphics methods are displayed. Next is the middle layer where graphical objects and Label controls are displayed. The front layer is where all nongraphical controls like CommandButton, CheckBox, or ListBox are displayed. Anything contained in a layer closer to the front covers anything contained in the layer(s) behind it. ZOrder arranges objects only within the layer where the object is displayed.
Q : .____ is the difference between Listindex and Tab index.
Ans : Lisindex : Gives current index inside a list
Q : .____ is the difference between Listindex and Tab index.
Ans : Listindex : Gives current index inside a list
Tabindex : specifies the tab order in the form
Q : .____ property of menu cannot be set at run time.
And : Name
the ans to question “Which property of textbox cannot be changed at runtime” is only the Name Property of the textbox. The ans provided above “TabIndex” is wrong u may change tab order at runtime.
Q-1:which type of combobox is non editable ?
ans:dropdown list
Q-2:which method of recordset is used to store records in an array?
ans:getrows
q-3:how can you display records page wise?
ans:use pagesize,pagecount,absolutepage property of recordset.
q-4:why recordset.recordcount returns -1??
ans:cursertype may not be forwardonly
for more questions mailto:prasantpkm@yahoo.com
This site is good. Why don’t you include the Q/A’s provided by users? So nice of them. They are not doing any business here.
Do we require Miscellaneous stuff for sexy singles and dating that you are showing on the left side? If that is for your business, plz.. that is not required for us. Let’s encourage education and knowledge sharing and nothing else.
What is the difference between and Interface and an Abstract Class?
While this topic is probably more popular amongst Java or .NET peeps, don’t be surpised if asked in an interview.
An Interface basically is a contract which defines the factors (properties and methods) that a class must provide. However the interface does not specify how these factors are to be implemented.
An abstract class is similar to an interface in that it defines empty properties and methods but may include some methods and properties which are already implemented.
Functionally in VB6 they are pretty much the same. You can create standard interfaces by compiling abstract classes in Visual Basic ActiveX DLLs or EXEs, or with the MkTypLib utility. In order to implement an interface, you must use the References dialog box to set a reference to the type library or ActiveX DLL or EXE. In similar fashion, any application that uses objects which have implemented an abstract interface must also have a reference to the type library that describes the interface. Information about implemented interfaces cannot be included in the type libraries of components, because there is no way to resolve naming conflicts.
VB6 does not support inheritance but provides for using interfaces as a means of class inheritance and extension.
Q: Early Binding vs Late Binding - define them and explain their pros and cons
A: Binding refers the object type definition. You are using Early Binding if the object type is specified when declaring your object. Eg if you Dim myObject as ADODB.Recordset that is early binding.
If on the other hand you declare your object as a generic type you are late binding. Eg if you Dim myObject as Object.
On should note that binding is determined at object declaration and not at object instantiation.
Therefore it does not matter if you later go on to Set myObject = New ADODB.Recordset or Set myObject = CreateObject(”ADODB.Recordset”).
Early binding allows developers to interact with the object’s properties and methods during coding. You can enjoy the benefits of intellisense. Also, early binding permits the compiler to check your code. Errors are caught at compile time. Early binding also results in faster code. It’s disadvantage is that you cannot create a generic object which may be bound to different types of objects.
Late binding on the other hand permits defining generic objects which may be bound to different objects. Eg you could declare myControl as Control without knowing which control you will encounter. You could then query the Controls collection and determine which control you are working on using the TypeOf method and branch to the section of your code that provides for that type. This is the only benefit of late binding. It’s disadvantages are that it is error prone and you will not enjoy much intellisense whilst coding.
Q: How does Option Explicit affect using late binding?
A: It doesn’t! Option Explicit demands that variables are declared prior to being used. The variable type does not have to be defined. In .NET using Option Strict Off will affect late binding.
See: http://www.developerfusion.com/show/1047/8/
Here’s a couple of good one’s I faced today! I did not answer them correctly.
Q: What is Debug.Assert and when would you use it?
A: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vamthassert.asp
Q: What is the DLL Base Address found on the Compile Tab of your Project Properties dialog?
A: http://www.vbaccelerator.com/home/VB/Code/Techniques/Component_Base_Addresses/article.asp
Ans of Q. 12 :- Parameter Collection is responsible for input to stored procedures.
For comment 7, the given ans is wrong . the max size is 32K
Q. what is used the Mdi form refresh,method Zorder in visual basic..
For comment 7 and comment 30 the given answers wrong wrong . the max size is 64K
Q. : What is Maximum no. of controls that can be placed on a VB6 standard form?
Q. : How do we add a registry entry in HKEY_LOCAL_MACHINE, using a function in VB6 and also how to retrive it? i was able to make the entry in HKEY_CURRENT_USER and read it too.
Yes I support comment 32. 64k is right. I need to know the maximum size an Access database can accommodate.
How to count listbox (listindex as single)?
How to count listbox (listindex as single)?