Thursday, July 17, 2008

visual basic questions

1. If you want to display a hierarchical structure of a web site,Which is
the following control you should use?
(a) Outline
(b) Listbox
(c) Listview
(d) Treeview (Correct)
2. One question is something like, If varient variable of object changes and
you want to moniter the changes when the variable changes.How to do that?
(Choose 2)
(a) Debug.Print(Correct)
(b) Object browser
(c) Local(Correct)
3.If you want to offer an option in a help menu for users to access your Web
Site,what Compononent should you use?
(a) Automation
(b) Hyperlink (Correct)
(c) Winsock
(d) Activex compononet
4.You have devoloped an application which will run exclusively on a Pentium
Pro.What options will you select to optimize numeric operations? (Choose 2)
(a) Assume no Aliasing
(b) Optimize for Small Code
(c) Disable Visual Basic Floating Point Error Checking (Correct)
(d) Remove Safe Pentium FDIV Checks (Correct)
5. Which line of code will create a new instance of an object new Form1 in
(a)Dim Frmx as Form1
(b)Dim Frmx as New Form1
(c)Set Frmx = Form1
(d)Set Frmx = GetObject("Project1.Form1") (Correct)
6.Which line of code will create a new instance of form1.
(a) Dim Frmx as Form1
(b) Dim Frmx as New Form1
(c) Set Frmx = GetObject(,"Project1.Form1")
(d) Set Frmx = New Form1 (Correct)
7. What Object do you use for the ShowHelp method?
(b) Ambient
(c) CommonDialog control (Correct)
8.Which two required for Early binding?
(a) Type library (Correct)
(b) Dual Interface
(c) New Keyword (Correct)
(d) CreateObject Function
9.You want to minimize download time for an activex document with several
components.How to Package within a .cab file?
(a) Put the component in .cab file and all the running compononent file in
secondary file
(b) digitally sign the component
(c) Put the .inf file in the primary .cab file points to the microsoft web
**** See the Internet component download in Book on line
10.You drag Label on Form1 and drop it on some control on Form1.What line of
code will change the background color of Label1 to red?
(a)Label1.backColor = vbRed
(b)Source.BackColor = vbRed (Correct)
(c) Target.backColor = vbRed
11.You have a Form1 and command button.You put code in command button
event.You cut the command button from Form1 and paste it on Form2.What
happend to the code?
(a)It will be deleted
(b)It will be moved on form2
(c) It will be remained on General section of Form1 (Correct)
12. Which two of the following Will disqualify a safe Activex scripting
control for www applications?(Choose 2)
(a) One that creates Password
(b) Writes to the file
(c) Read Information from the registry
(d) Insert Information to the registry
13. What two arguements you can use for property procedures?
(a) param Array (Correct)
(b) Alias
(c)Address of
(d)Optional (Correct)
14.What Element you can use for Conditional compilation directive?
(a) Public Constant
(b)Private constant
(c) Literal Expression (correct0
15.In what order Form Fires?
(a)Load Initialize Resize Paint
(b) Load Initialize Paint Resize
(c) Initialize Load Resize Paint (Correct)
(d) Initialize Load Paint Resize
16.You have an ActiveX document that uses the AsyncRead Method to obtain
data from an intranet location.What type of data cannot be returned?
(b) Byte arrays
(c) Hyperlinks (Correct)
(d) Pictures
17.How to debug an out of process component?
(a) Start a second instance of the developing enviroment. (Correct)
(b)Create an error handler for the out of process component.
(c) Create project group.
18. You have command button Command1 with code in its click event:
Command2.Value = True
and a comman2 button with code in its click event
Comman1.Value = True.
What happens when this code executed?
(a) Over flow error
(b) Out of stack error (Correct)
19. What will happen when this code executed?
Sub MySub()
Static intNum as integer
If intNum <= 4 then
exit sub
intNum = intNum + 1
End if
End Sub
(a) Syntax error Will be displayed
(b) Codel will be returned without error (Correct)
(c) the computer will hung
20.How to declare a Dll with a DWORD datatype?
ByVal as Long
21.What property you will use to change the background color for the
(a) Ambient (Correct0
21. Your application contains the following Class names Class1 with a
property named Myproperty.You run the following code
Dim A as Class1
Dim B as New Class1
B.Myproperty = 3
Set A = New Class1
How many instances of class1 exist after you run this code?
(a) 0
(c)2 (Correct)
22. See the proper syntax for the ParamArray Keyword.
23.Which arguement of the Add method is used to specify a node object to
(c)Relationship (Correct)
24.All users have default Locks for database.You put the code
Data1.LockEdit = False.When try to chage the data in database what will
(a) Errror will return when you try to edit
(b) Error will return when you try to update
(c) The error will be something that data changed and operation stoped.
25.What event occours when you press F2?
(a) MouseUp
(b) KeyPress
(d) KeyDown (correct)
26.You set a form with AutoRedraw = False.You have a command button,an image
control,You use Pset Method to draw on the form and a print method to Create
text.If the form minimized and then restored,what are redisplayed?
(a) Command button( correct)
(b) Image (bitmap) (correct)
27.What can you do with menus created dynamically?(Choose 2)
(a) Create Popup menus with it (correct)
(b) Remove the menu after using them (correct)
28. You want to create an instance on an ActiveX component that can
Asynchronouly signal projects that use it.what should you create?Choose2
(a) an event (Correct)
(b) an object Callback (correct)
(c)the address of operater
(d) Implements
29.We obtained many dll funcions from dirrerent vendors.Two functions happen
to have the same name but different purposes.What can you do? Choose 2
(a)Using an alias (Correct)
(b) Modifying the dll funcion
(c) Declaring each Private in separate modules. (Correct)
30.What control can you place on an MDI form? Choose 3
(a) Image
(b) Picture (Correct)
(c) Data access (Correct)
(d) Timer (Correct)
(e) Frame
31.You are using Graphics on your don't want the picture to be
erased when you minimized.what should you do?
Set AutoRedraw property to true.
32.What can be viewed in the local window? Choose2
(a) Show the variables within the scope of the current procedure (Correct)
(b) All Object variables declared in the executing procedure.
33.To use Alt F for File menu what you should do?
(a) Use the menuEditor
(b) Put the Alt F in name section.
(c) Put the Caption in File &F (Correct)
34.You have a Label control in UserControl.If the User resizes the
UserControl during runtime in which event will you handle the resizing of
the Label?
(a) Label1_Resize
(b) Label1_Initialize
(c) UserControl_Resize (Correct)
35.You have a option button inside a Frame.The option button's Help
contextID is 0.If user presses F1 Key,what will happen ?
(a) Main help window will be displayed
(b) The help for the form will be displayed (correct)
(c) The help for option button will be displayed
36.How can you test the unload behaviour of an In Process Component?
(a) Add a second instance
(b) Add a project group with the test project and component and run in a
singe instance (Correct)
37.while running a web page, a user gets a warning about unsafe control and
the control does not get downloaded.what to do?
Tell the user to reduce the security level to zero or none.
38.You are writing code for a drag and drop want to set the
drop higlight the proper treeview control element.Which method should use to
do this?
Ans. HitTest
39.What are two restrictions on how the implements statement can be used?
choose 2
1) It requried a reference to a type library.
2) It cannot be used in standered module.
40.You want to obtain a reference to a specific Activex document to a
specific ActiveX document object that is currently loaded.This object is
handled by an activex document server that was created in microsoft visual
c++.Which line of code must you use to obtain a reference to the object.
Ans. Set MyObj = GetObject(Filename,3someapp.2SomeClass)
41.What's the database default recordset type?
(a) Dynaset Object
(b) Dynaset type recordset object (Correct)
(c) Table type
d) Snapshot type recordset object
42.You create a class module that will be used by other ptogrammers in your
company. You wnat the class module to function like an intrinsic feature of
the visual basic langrage.YOu do not want to require the programmers to write
code to create an instance of the class. which type of instancing should you
use for the class module.
(a) Private
(b) Multiuse
(c) GlobalMultiUse
(d) PublicNot Creatable (Correct)
44.Which of the following properties apply to an ambient properties?
(a) Front color
(b) UserMode correct
(c) back color correct
(d)Left to right
45.Which is the valid property of the form's collection?
Ans. Count
46.You are designing a component to generate run time errors.What would be
Raise method on Err object.
47.You want the execution of your code to halt when variable changes.Which
tool to use?
Wach window
48.One question on DragOver
49.Which type of file is created when you use the setup wizard and choose
the create internet download setup option?
.Cab file
50.Show Help method used with which control
Ans. commonDialog control
51.One Question on progressbar.
52.One question on LateBinding
53.You have a form with textbox,Textbox1.You add a second
textbox,textbox2.How can you set the focus to textbox?
Ans. Textbox2.TabIndex = 0
Know withevent Variable
Know Regsvr32.exe to register all the components.
1) You want to late bind a class called employee in component called bus.
Correct code would be :-
a) dim classvar as object
classvar = new employee
b) dim classvar as employee
classvar = new employee
c) dim classvar as object (*)
classvar = createobject("bus.employee")
d) dim classvar as employee
classvar = createobject("bus.employee")
2) A DLL function is documented as follows
WINAPI DWORD Myfunc( char c )
how would you declare it in vb (only difference was in the parameters)
a) declare function myfunc( bval myarg as byte) alias "myfunc" as long (*)
b) declare function myfunc( bval myarg as string) alias "myfunc" as long
c) declare function myfunc( byref myarg as string) alias "myfunc" as long
d) declare function myfunc( bval myarg as string*1) alias "myfunc" as long
3) How do you test the unload behavior of an in-process component ?
a) starting different instances of VB
c) add a test project to the project group (*)
d) add debug statements
c) use the windows api unloaddll function or something like that
4) What is the correct usage of the parramarray keyword ?
( cant remember the exact options but they went this way )
a) sub mysub( arg1 as string, paramarray arg2, arg3 as string)
b) sub mysub( arg1 as string, optional arg2 as string, arg3 as paramarray)
c) sub mysub( arg1 as string, arg2 as string, bval arg3() as paramarray)
d) sub mysub( arg1 as string, arg2 as string, paramarray arg3 ) (*)
Things I remember noting were 1) position - where are parammaray args allowed
2) optional args allowed with paramarays ?
3) can paramarrays be passed byval ?
5) You create a multiuser application in which you set lockedits= false.
which error message are you likely to get ?
a) Couldnt save ; currently locked by user on machine (*)
b) data has changed ; operation stopped
c) couldnt update; currently locked by user on machine
6)You put a label on your user control. You want the label to change size
with the user control. Which event would you use ?
a) label1_resize
b) usercontrol1_resize (*)
c) label1_change
d) usercontrol1_change
7)A question that went - what does packaging your component in a cab also
allow you to do ?
digitally sign your component
8)A question on the best way to package your application for distribution
over the web?
The point is to minimize download time and the clue was that it uses many
components shipped with vb
a) in primary and secondary cab files
b) in a primary cab file and an inf file pointing to a secondary cab file
c) In a primary cab file and an inf file pointing to the cab files for the
components depended on
d) ??
9)You want to use debug statements but dont want to distribute them in the
end program.what do you do
(a) use conditional compilation (*)
10)You create a database application for your company. The tables are linked
and have a common transaction field. You now want to create new reports at
regional and headoffice level but dont want to change either the table
structures ar the report definitions.What do you do ?
a) use the filter property to create a new TABLE
b) use the sort property to create a new TABLE
c) use the filter property to create a new dynaset (*)
d) copy the records you want to another TABLE
11)You develop a component for use on a web page, but your users get a
warning about an unsafe control and the control does not get downloaded.
What do you do ?
a) use codebase
b) use licencing
c) set the user safety level to none
d) obtain a digital certificate for signing your component (*)
12)What is needed for early binding ? (choose 2)
a) type library (*)
b) new keyword
c) dual interface (*)
d) createobject function
13) Which types of files can be registerd with regsvr32
a) exe
b) dll (*)
14)A class in an object provided by DLL can not be instantiated by IIS what
do you do ?
a) register the dll using regsver32.exe (*)
15)You are creating a component that should be able to asynchronously notify
projects that use it. What would you use ?. (choose 2)
(a) Events (*)
(b) object callbacks (*)
(c) the address of operator
(d) Implements statement
16)Advantages of the context options in the watches window
17)Which object to use if you want to provide a menu option that links to
help on a web site ?
hyperlink ?
18)disadvantages of the implements keyword
a) cannot be used in a standard module (*)
b) cannot be used more than once in a module
d) cannot be used in the declaration section of a module
19)What you can do with dynamic menus (choose 2)
(cant remember options)
(a) assign them function keys
(b) add menu items to them (*)
(c) make items visible and invisble
20)Datacontrols default recordset type
a) dynaset object ( beware !)
b) table type recordset
c) dynaset type recordset (*)
21)What happens when f1 is pressed when the button does not have a
helpContextID but the containing frame does ?
22)CommonDialogs are a way to show help
23)Use of Ambient properties to make your usercontrol respond to the
background of the containing application
24)Using source.backcolor to change the backcolor of a label being dragged
over the target
25)The I LOVE RAP question (Initialize, Load, Resize, Activate, Paint form
26)The use of treeview to show a hierachical view in a website
27)The use NegotiateMenus on the container to make an objects menu visible.
Options were
something like this :-
a) use the MenuNegotiate property of the container
b) use the MenuNegotiate property of the object
c) use the NegotiateMenus property of the container
d) use the NegotiateMenus property of the object
28)The use of the WithEvents keyword to declare an event sink for a class
named class1
i.e dim WithEvents MyVar as Class1
29)The Asyncread method cannot return hyperlinks directly
30)The use of Load command1(1) when command1 with an index of zero already
31)The use of the caption property to define hot keys in menus e.g
caption= "&File" defines alt+f as hotkey
32)The use of State in the dragover event to know whether the dragged
control is moving onto or away from your control.
3. There was question where you had to pick which code segment was right:
dim frm as form
for each frm in forms
msgbox frm.index.caption
dim frm as form
for each frm in forms
msgbox frm(index).caption.text
* dim frm as form
for each frm in forms
msgbox frm.caption
4. I got the "What is the best was to view a Web site's hierarchy..." use
5. A question about lockedits. if recordset.lockedits=false, which would be
the most like to occur:
•update error: record locked on by •save error:
record locked on by •can not read database...
6. a logic question. What happens when:
sub mysub()
static x as integer
if y => 4 then
exit sub
end if
end sub
7. I did the worst on app setup/distribution. A question was "A user says
your control can not be download. What do you suggest?"
•digitally sign your control •create a cab file •tell the user to set the
safety level in IE to none •??
8. Know the order of a form load: initialize, load, resize, activate, paint
9. Also autoredraw. If not set to true, graphics drawn with Pset or text on
the form printed used Print will disappear if another form is placed on top
then minimized.

Your Title