Sei sulla pagina 1di 16

VB Interview Questions

1) It is possible to start VB application through Genaral module?

2) A. Yes

3) How you will start VB application through general module?

a. By Creating Sub Main procedure in the module. Select project properties,


change main module before that we have one main function in module
form main function it will start the execution.

4) What is option explicit?

a. Before we use the variables we should declare data type of that variable.
Identify the mismatching of variables.

5) what is type key word?

a. For declaring user defined datatypes.

6) what is dynamic array?

A. Reinitialization of array at runtime.

7) how to reinitialize dynamic array with out lost previous values?


A. Using the preserve Keyword
syntax: redim a(3) - dynamic array

redim preserve a(5)

8) what is diffrence ActiveXexe, ActiveXdll?


A. Activexexe is out process component and is used by end user.

Activexdll is inprocess component used by developer only.

9) what is command to register com component in system?

A. regsvr32

10) what is backward compatibility?

A Serilalization
10) How you will add Activexdll to your project?

A. First register the dll using regsvr32 dll path and we give the reference to the dll
through project references.

11) whether you open your vb project in note pad? what you find if you open your
project in notepad?

A. YES

12) What are different comjpilation in VB?

A. Pseudocode compilation, Native code compilation

12) How you will execute the stored procedure?

A. By using command objects

14) what is default property of textbox?

A.Text

15) what is default property op lable?


A.Caption

16)How you will deploy your VB project?


A.Using Deployment and Package wizard

17) what are the locking systems in ado?


A. Lock Pessimistic: Locks the row once after any edits occur.

Lock Optimistic: Locks the row only when update is called.

Lock Batch Optimistic: Allows Batch Udates.

Lock Readonly: Read Only. Cannot alter the data.

18)what are the property procedures?


A.property SET, GET

19) How you write read only property in VB?


A. By declaring GET Procedure

20) How you write writeonly propery?


A. By declaring SET Procedure

21) What are the cursors?

A. Cursor is the information underlying the recordset. There are 4 types of cursors.

1. Forward Only- Fastest, can only move forward in the record set.

2. Static- Can move to any record in the record set. Data is static and never
changes.

3. Keyset – Changes are detectable, records that are deleted by other users are
unavailable and records created by other users not detected.

4. Dynamic – All changes are visible.

22)Difference between datagrid and flexigrid?

A. DataGrid is editable and Flexigrid is noteditable

23) Which object is ignored by complied code?

A. Debug object

24) When the focus is changed from one form to another form which event is fired
first?

A. De – activated

25) what is the keypress event parameter?

A. Keyascii

26) What is stored in the .dep file?

A. Runtime files needed to support vb Project?

27) Which type of property procedure return a values?

A.Get

28)Forms are a specialized form of what?

A. Class

29) The list of files to be distributed is found in which file?


A..Lst

30)What will the following statement do?

Debug.print strsql

A. Prints the contents of the strsql to the immediate window.

31) How can u count the no.of controls on the form?

A. Form1.count

32) How many controls we can paste on the form?

A.254

33) Types of files in VB?

A. Sequential , Random, Binary

34)Which function is used to determine the next available file no.?

A. FreeFile

35)What is Userdefined datatype?

A. A userdefined datatype is one that contains other existing datatypes grouped


together to form a new datatype.

36) Where we can declare userdefined datatypes?

A. We must declare all usedefined datatypes at module level only. It is invalid to


declare in inside the procedures.

37)What are the special list boxes?

A VB has three Special List Boxex to help us manage directories, drives and files.

These are 1) Directory list box 2) Drive List Box 3) File List Box

38) How can we open the sequential file?

A. Open “ TextFile.dat” for append as #1

39) How can you determine the no.of printers?


A. Printers.count – 1

40).How to cancel the print job?

a).Printer.killdoc

41).What is template?

A). A template is a modal. A template form is a modal form.

42).What are the template forms?

A).The application wizard only offers four template form options.

1).Splash Screen

2).Login Screen

3).Options dialog box

4). About box

43). What is modal and modeless forms?


A).To the modal form We must give input to activate other forms.Ex Msgbox
To the modeless forms ,no need to give input .we can activate other forms.Default
is VbModeless

44).What are the modules in VB?


A).FormLevel Modules, Standard Modules, Class Modules.

45). What is data binding?How can we bind the control?


A). Data binding is the concept of relating the control with memory location. This is also
called as bounding the control.
Set text1.datasource=recordset
Text1.datafield=”Field Name”

46).What are the types of ActiveX components in VB?


A). 1)Standard Exe 2)ActiveX Exe 3) ActiveX DLL 4)ActiveX Document 5)ActiveX
Control 6).Project Group

47).Difference between inprocess and out of process?


A). An in-process component is implemented as a DLL. And runs in the same process
spaces 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 than dll’s because communications between
client and component must be marshaled across process boundaries. A single instance of
an out of process component can service many clients.

48). Advantage of ActiveX Dll over Acitve Exe”

A). ActiveX Dll: An in-process component,or ActiveX dll, runs in another application’s
process. In-process components are used by applications or other in-process components.
This allows us to wrap up common functionality(like an Activex EXE).

ActiveX Exe:An out-of-process component, or Activex Exe, runs in its own address
space, The client is usually an application running in another process. The code running
in an ActiveX exe is running in a separate process space.

49)Single thread and multithread thread apartments?


A. All components created with VB use the apartment model.

50) What is component?


A. If you compile an ActiveX DLL, it becomes a component.
B. If you compile an ActiveX Control it becomes both a component and a control.

51) Controls which do not have events?


A Shape and line controls .

52) What are the light weight controls?


A. Image , shape and line controls are consider to be light weight controls i.e. they
support only a subset of properties, methods and events found in the picture box.
Because of this , they typically require less system resources and load faster
than picture box control.

53) What are the control categories?


A 1. Intrinsic controls(Command Button, Textbox, Frame etc)
2.ActiveX controls(.ocx Files, listview, toolbar, animations etc)
3.Insertable Objects(Microsoft Excel Worksheet.

54) What are the differences between Image and PictureBox?


A. The sizing behavior of the image control differs from that of the picture box.
It has Stretch property while the picture box has an auto size property. Setting
the AutoSize property to true causes a picture box to resize to the dimensions
of the picture; setting to false causes the picture to be cropped(only a portion
of the picture is visible). When set to false(the Default) the stretch property of
the image control causes it to resize to the dimensions of the picture. Setting
the stretch property to true causes the picture to resize to the size of the image
control, which may cause the picture to appear distorted.
55) Default property of the datacontrol?
A Connect property
56) Define the scope of public, private,Friend procedures?
A The set of public variables, methods, properties and events describe in a class
module define the interface for an object. The interface consists of the object members
that are available to a programmer who is using the object from code.
We can create private variables, methods, properties and events that are used by
other procedures within the class module but are not part of the objects public interface.
Additionally constants user defined types and declared statements within a class module
must always be private.
The friend keyword makes a procedure private to the project. The procedure is
available to any code running within the project but is not available to a referencing
project.

57) Difference between function and subroutine?


A. A function returns a value and subroutine doesn’t return a value.

58)Difference between linked object and embedded object?


A Embedded objects: When we embed an object, a copy object is inserted into the
destination document. There is no link to the original file. When we change information
in the source document no changes will be reflected in the destination document. The
actual data for the object Is stored within the destination file . To make changes to the
embedded object double click it and it will launch the original application the source file
was in.
Linking Objects: Information is updated when we modify the original source file
when we use a linked object. This dynamic updating is very handy for things such as the
aforementioned monthly report. We can open up the Excel spreadsheet that is referenced
within our word document. Make changes to the spreadsheet, close Excel, and when we
open our word document the changes are already there. If that object is linked to 10 other
word files, the changes are already in those 10 files, too ! Actually linking or embedding
an object is easy and faster.

59) Difference between list box and combo box?


A ListBox Control: Displays a list of items from which the user can select one or
more. If the number of items exceeds the number that can be displayed, a scroll bar is
automatically added to the list box control.
ComboBox Control: Combines the features of a text box and a list box. This
control allows the user to select an item either by typing text into the combo box, or by
selecting it from the list.
Difference: Generally, a combo box is appropriate when there is a list of suggested
choices, and list box is appropriate when we want to limit input to what is on the list. A
combo box contains an edit field, so choices not on the list can be typed in this field.

60) Types of RecordSets?


A All recordset objects are constructed using records(rows) and fields(columns).
There are 5 types of recordsets.
1. Table-type Recordset:
Repersentaion in code of a base table that we can use to add,
change, or delete records from a single database table
2. Dynaset-type RecordSet:
The result of a query that can have updatable records. A Dynaset-
type RecordSet is the dynamic set of records that we can use to
add, change, or delete records from a underlying database tables. A
Dynaset-type RecordSet object can contain fields from one or
more tables in a database. This type corresponds to an ODBC
keyset cursor.
3. Snapshot-type Recordset:
A static copy of a set of records that we can use to find data or
generate reports. A snapshot recordset object can contain fields
from one or more tables in a database but can’t be updated. This
type corresponds to an ODBC static cursor.
4. Forwardonly-type Recordset:
Identify to a snapshot except that no cursor is provided. We can
only scroll forward through records. This improves performance in
Situations where we only need to make single pass thorugh a
resultset. This type corresponds to an ODBC forward cursor.
5. Dynamic-type Recordset:
A query resultset from one or more base tables in which you can
add, change or delete records from a row returning query. Further, records
other users add , delete or edit in the base tables also appear in recordset. This
type corresponds to an ODBC dynamic cursor.

61) Difference between ListIndex and TabIndex?


A. ListIndex: Returns or sets the index of the currently selected item in the
control. Not available at design time. Default ListIndex is –1 for Combo Box,
Dir Listbox, Drive ListBox Controls.
TabIndex: Returns or sets the tab order of most objects within their parant
form.

62). Difference b/w Query Unload and Unload in form?


A). Query Unload event occurs before Unload event when we close the application or
form.

63).Draw and explain sequence Modal of DAO?


A).Connection,Container,Database,DBEngine,Document,Erro,Field,Group,IndexParamet
erPropertyQueryDef,RecordSet,Relation,TableDef,User,WorkSpace.

64)How can objects on different threads communicate with one another?


A Processes communicate with one another through messages using Microsoft
Remote Procedure Call (RPC) technology to pass information to one another. There is no
difference to the caller between a call coming from a process on a remote machine and a
call coming from another process on the same machine. Multithreaded applications must
avoid two threading problems. DeadLocks and Races. A DeadLock occurs when each
thread is waiting for the other to do something.

65)How can you force new objects to be created on new threads?


A The create thread function creates a thread to execute within the virtual address
space of the calling process. To Create a thread that runs in the virtual address space of
another process creating a new thread is as easy as declaring it and supplying with a
delegate to the method where the thread is to start. When you are ready to begin
execution on the thread call the thread.start() method. There are special considerations
involve when working with multiple threads of execution.
To Create a new thread of execution declare the thread:
Dim myThread as system.Threading.Thread
Instantiate the thread with the appropriate delegate for the starting poing of the thread.
Use the address of operator to create the delegate in VB.
MyThread= new system.Threading.Thread(Addressof myStartingMethod)

Call the Thread.start() method to start the thread.


MyThread.start()

66) What type of multithreading does VB6.0 implements?


A Apartment model threading

67) What is database connection pooling?


A This allows MTS(Microsoft Transaction Server) to reuse database connections.
Database Connections are put to sleep as opposed to being created and destroyed and are
activated upon Request.

68) Dim x, y as integer. What is x and y data type?


A x as a variant and y as integer.

69) What is the size of the variant data type?


A The variant date type has a numeric storage, size of 16 bytes and can contain data
up to the range of a Decimal or a character storage size of 22 bytes (plus string length)
and can store any character text.

70) what is the return type of Instr and Strcmp?


A Instr - Integer (Numeric position)
Strcmp - Integer( if both the strings are equal result is 0)
Strcmp(Str1, Str2, comparetype) compareing mode= 0 - Binary Comparing
1 – Textual Comparing

71) What is max size allowed for msgbox prompt and inputbox ?
A 1024

72) Max Label caption length – 2048


73) Max TextBox length – 32000

74) Max Control Names Length – 255

75) Extensions in VB
A frm, bas, cls, res, vbx, ocx, frx ,vbp, exe

76) What is frx?


A When some controls like grid and third party control placed in our application
then it will create frx in runtime.

77) Name some date functions?


A Dateadd(), Datediff(), Datepart(), Cdate()

78) What is keyword used to compare to objects?


A IsOperator – Returns Boolean

79) How many procedures are in VB?


A only two. 1) Function and 2) Sub Procedures
Function will return value
Sub Procedres won’t return value

80) Where will you give the option explicit keyword and for what?
A In the general declaration section. To trap undeclared variables.

81) What is friend variable?


A Scope sharable between projects.

82)What is binding? What are the types of binding?


A Assigning variable with defined memory space is nothing but Binding.
Late Binding – Memory size is allotted in later stage.
Ex: Dim x as object
Early Binding – Memory size is allotted while declaring itself.
Ex. Dim x as new object

83) What is differece between property Get, Set and Let.


A Set : Value is assigned to ActiveX object from the form
Let : Value is retrieved to ActiveX object from the form.
Get : Assigns the value of an expression to a variable or property.

84) What is Mask Edit and why it is used?


A It is a Conrol used to restricted data input as well formatted data output.

85)Drag and Drop state numbers and functions?


A State 0 – Source control is being dragged with the range of a target.
State 1 – Out of the range of a target
State 2 - One position in the target to another.

86) What are the type validations available in VB?


A field, form

87) What is the result of Null * any value?


A 0

88) What is control array and how many we can have it within the form?
A Group of controls share the same name is called Control array.
Max : 32,767

89) What is the default model of the form and what is it number?
A VbModaless – 0(zero) - we can able to place another window above this form.

90) What is the difference between standard and class modules?


A Standard global within the project
Class global through out the all project only thing is we want to set the type lib.
Class modules can be instantiated.

91) How to declare DLL Procedure?


A Declare function “<Function Name>” lib “<Lib Name>” alias “<Alias Name>”
(Arg,-----) as return type.

92)What is MDI Form? MDI Styles?


A We can have only one MDI form for a project. Multiple Document
Interface(MDI). This form type is VbModel. We have set the child property of the forms
to true to place forms inside this MDI. Style availables:->
1.VbCascade
2.VbTitle Horizontal

93) How many images can be placed in the ImageList?


A 64

94) What is Inprocess and OutOfprocess?


A Inprocess – It will run within the memory (Local Machine)
OutOfProcess – It will run out of the memory( Normally in the server side)

95) Different type of datatypes?


A LOB(Large Object Datatype)
CLOB(Stores Character Objects)
BLOB(Stores Binary Objects such as Graphic, video chips and sound files)
BFILE(Store File Pointers to LOB. It may contain file name for photo’s store on
CD-Rom.

96) What is Zorder Method?


A Object.Zorder=1 or 0 place a specified MDI form or control at the front or back
of the Z-order within its graphical level.

97) What is difference between generic variable and specific variables?


A Generic Variable:
Create object Ex: Ole – Automation. No need refer the object library
Specific Variable:
Binding procedure, Early and late Binding ( Can be remove from the
memory)

98) What are properties available in clip board?


A No properties available. Only the methods they are SetText, GetText, SetData,
GetFormat, Clear

99)What is DLL?
A Libraries of procedure external to the application but can be called from the
application.

100) What is TabStrip Control? What is the Starting index value? How to locate it?
A It is tab control to place our controls within the form in multiple sheets.
Index starts with 1. And to identify
If tabstrip1.selecteditem.index=1 then
----------
----------
end if

101) Why we use TreeView control?


A To list the hierarchial list of the node objects such as files and directories.

102)Why we need OLE_Automation? Advantages?


A). Enables an application to exposes objects and methods to other applications. No need
to reserve money. No need to write functions. Object library that slimplify programming
tasks.ie No need of library. (OLE,TLB)

103). What is the difference between Create object and get object?
A). Create object is used to create instance of object. Get Object is used to get the
reference to an existing object.

104). what is collection objects?


A). Similarly to arrays but is preferred over an array because of the following reasons.
1). A collection object uses less memory than an array.
2). It provides methods to add and delete members
3). It does not required reason statement when objects are added or deleted
4). It does not have boundary limitations

105). What is static variable?


A).Its scope will be available through out the life time.

106). Private dim x as integer? Write or Wrong


A). Private cannot be used in front of DIM.

107).What is the scope of the class ?


A). Public, Private, Friend

108). What are the style properties of Combo Box?


A).Simple,Dropdown List-We can type and select
Drop Down Combo-only drop down

109).What are the style properties of List Box?


A).Simple-Single Select,Extented-Multiple Select

110).What are the different types of Dialog Box?


A). Predefined, Custom, User Defiend

111). What is parser bug?


A). It is difficult to use database objects declared in a module from within a form.

112). What is the dll required for running the VB?


A).vbrun300.dll

113).Can we create CGI(Common Gate Interface) scripts in VB?


A). Yes

114). How to change the mouse pointer?


A). Screen.MousePointer=VBHourGlass/VBNormal (or)
Form1.MousePointer= VBHourGlass/VBNormal

115).What is ADO? What are its Objects?


A).ActiveX Data Object can access data from both flat files as well as the database. Ie, it
is encapsulation of DAO, RDO and OLE that is why we call it is as OLE-DB technology.
ADO objects are
1). Connection 2). Record set 3). Command 4). Parameter 5).Parameters 6).
Field 7). Error 8).Errors 9). Property 10).Properties 11).Field 12). Fields

116). What is DataWare control?


A). Any control bound to Data Control Ex.TextBox, Check Box, Picture Box, Image
Control, Label, ListBox, Combo Box, DB Combo.
117).What are two validate with Data Control?
A). Data_Validate, Data_Error

118).Record Set types and number Available in VB?


A). 3. They are 1-Dynaset,0-Table,2-Snap Shot

119). What are the locks avialble in Vb?


A). 1). Batch Optimistic 2). Optimistic 3). Pessimistic 4). Read Only

120). What is the difference between RDO and ADO?


A). RDO is Hierarchy model where as ADO is Object model. .ActiveX Data Object can
access data from both flat files as well as the database. Ie, it is encapsulation of DAO,
RDO and OLE that is why we call it is as OLE-DB technology.

121)How can we call stored procedure of Back End in RDO and ADO?
A). In RDO - We can call using RDO Query Objects.
In ADO – We can call using Command Objects

122). What is the difference between Microsoft ODBC Driver and Oracle ODBC Driver?
A). Microsoft ODBC Driver will support all the methods and properties of VB . Where as
Oracle not.

123). What are the technologies for Accessing Database from VB?
A). DAO, Data Control, RDO,ODBCDIRECT,ADO, ODBC API,0040.

124). Calling Stored Procedures in VB?


A). 1). Calling simply the procedure with out arguments {Call ProcedureName”}
2). If it is with Arguments Means then Declare the Query Def qy Set Qy as New
Query def
Qy.SQL=”{ Call ProcedureName(?,?,?)}”
Qy(0)=val(txt1.text)
Qy(1)=val(txt2.text)
Qy(2)=val(txt3.text)
Set Rs=Qy.OpenResultSet
Txt(1)=rs.Rdocolumns(0)

125) What is MAPI


A). Messaging Application Programing Interface.

126). Different types of passing values?


A). By Value, By ref, Optional, Param Array
Note: Optional keyword can’t be used while declaring arguments for a function using
param array.

127). What are the different types of errors?


A). Syntax Errors. Runtime, Logic.
128). What is Centralization Error Handling?
A). Writing function and calling it when error occurs.

129). To connect the Data Control with Back End what are al the properties to be set?
A). Data Source Name, Record Source Name.

130). How to trap Data Base Error?


A). Dim x as rdoError
X(0).des
X(1).number

131). How to increase the Date corresponding with month,date,year?


A).DateSerial(Year(now),month(now)+1,1). Hour,min,Sec,Month, Year, DateSerial,
Dateadd, Datediff, Weekday,DateValue, timeserial, timevalue

132).How would you declare and raise custom events in a class?


A). Public Event OnVarChange();
Raise Event OnVarChange[(arg1, arg2,…argn)]

133). What is the difference between ANSi and UNICODE strings when passed as
arguemts to a DLL?
A). ANSI- one byte for a char
UNICODE- two bytes per char- works only on NT

134). What is the purpose of DoEvents Command?


A). Fields execution so that the OS can process other events. Returns number of open
forms. Useful for things like ‘cancel search’ in windows.

135). Under which circumstance does a VB application ignore a Timer Event?


A). When the system is really busy doing something else and when DoEvents is being
executed.

136). What does NewIndex Property return?


A). Used to retrieve the index of the item most recently added to a ListBox or Combobox
control

137). What is the purpose of the AutoRedraw property on a form or container?


A). Setting AutoRedraw to True automatically redraws the output from these methods in
a Form object or PictureBox Control When , for example, the object is resized or
redisplayed after being hidden by another object

138).What kind of components can we use as DCOM servers?


A). ActiveX-Components, COM

139).What are some methods we can use to send data from one VB executable to another
one?
140).Diff between standard module and class module?

141).How many tabs in a tabbed dialog(SSTab) do you consider appropriate?


A) 99

142).What does the implements statement do?

143). What is the diff between MsbBox statement and MsgboxQ function?

144). What was introduced to VB to allow the use of CallBack functions?

145). Which controls can’t be placed in MDI?

146). Which property is used to compress a Image in Image Control?


A). Stretch
147). Which property of menu can’t be set at run time?

148).Which property of textbox can’t be set at run time? And what is the maximum sized
of textbox?

Potrebbero piacerti anche