MCA-3 Visual Basic

SUBJECT:- Visual Basic

1) Which ANSI characters are used for string concatenation?
a) ~ b) +
c) & d) #

2) A code module with option 0 has a one dimensional array Strtests() of strings with 14 elements containing Test name. How could you add another Test element to the array?
a) Strtests Add(14)
b) ReDim Strtests(15)
c) ReDim Preserve Strtests(14)
d) ReDim Preserve Strtests(15)

3) What are 2 advantages of having more than one workspace in a project? Choose all correct answers.
a) Having more than one database object
b) Defining different user permission levels
c) Having non-nested transactions
d) Making the most use of memory

4) You want to capture a key event only with an ASCII character. Which event will do this?
a) KeyUp b) KeyPress
c) KeyAscii d) KeyDown

5) What will allow you to use the contents of the last row of a listbox named ListTest?
a) ListTest.ListCount
b) ListTest(ListCount – 1)
c) ListTest.List(ListCount)
d) ListTest.List(ListCount – 1)

6) What code should be placed before the error handler in an error-handling routine?
a) Nothing
b) On Error Go To 0
c) On Error Go To error-handler
d) Exit Sub or Exit Function

7) If the Menuchoice index = 0, how would you create a menu array?
a) Create Menuchoice(1)
b) Load Menuchoice(1)
c) New Menuchoice(1)
d) Array Menuchoice(1)

8) What is Tur$ in the following line of code? Tur$ = Left$(Trim$("Key press is a property") , 3)
a) Erty b) Pro
c) Key d) Ess

9) There is no drive B in your computer. What type of error will occur if a program tries to access Drive B?
a) Debug b) Design-time
c) Run-time d) Program

10) How can you create a shortcut access key on a menu control? Choose all correct answers.
a) A list in the menu editor
b) An ampersand in the Name property
c) An ampersand in the Caption
d) An Alt key combination for main menu items for the menu editor

11) What is the default type of variable?
a) Integer b) String
c) Single d) Variant

12) How would you code a read-only custom property for a form?
a) Write a Property Let procedure without a Property Get
b) Declare a Property Let procedure without a Property Get
c) Write a Property Get procedure without a Property Let
d) Declare a Property Get procedure without a Property Let

13) If you need to read all characters, including carriage returns, which function to use?
a) Read b) Read$
c) Input d) Input$

14) How can you declare a variable so that it is not reinitialized the next time a procedure is executed?
a) Public b) Private
c) Preserve d) Static

15) What is the proper procedure to group controls within a frame?
a) Add frame, then add controls onto the frame
b) Add frame, then add controls by double-clicking the control
c) Add controls, then drag and drop the frame onto the controls
d) Add controls, then drag and drop the controls onto the frame
16) What is the purpose of an error-handler code? Choose all correct answers.
a) To tell the users the code does not work
b) To rectify or react to the error in the program
c) To create a Dr. Watson memory dump to a file
d) Provide a visual clue to the user to tell where to restart once the error has been handled

17) You are trying to set the focus to a control. Which 3 situations will cause a run-time error?
a) The control is a label control
b) A disabled control
c) A control that is not visible
d) A control that already has focus

18) What type of constant is used in conditional compiling?
a) Boolean b) Integer
c) Long d) Variant

19) You have a general procedure in Selform called EncodeSub_Click. On Selform, you include a command button with the name CommandStart. Code for the button is in the click event procedure. If you rename the CommandStart to EncodeSub, what happens when the button is clicked?
a) Nothing
b) The first code in EncodeSub_Click will run
c) The code put in CommandStart_Click will run
d) The code put in CommandStart_Click will run, but under the name EncodeSub_Click

20) In VB, which statement do you use to copy a file?
a) Copy b) CopyFile
c) Shell to Dos Copy d) FileCopy

21) Which file format is needed to create a Help file?
a) TXT b) HLP
c) DOC d) RTF

22) When a user clicks the No button on a message box, what value is returned?
a) 0 b) 1
c) 6 d) 7

23) How can you create a menu bar on a form? Choose all correct answers.
a) Tools >> Menu Editor b) Alt + E
c) Ctrl + B d) Menu Editor

24) What does a control's DragIcon property do? Choose all correct answers.
a) Provides the image while dragging
b) Allows dragging if set to True
c) Allows DragDrop if DragDrop is set to
d) Provides an outline of the control if left blank while dragging


25) What property is used to indicate the type of database used with data control?
a) Connect b) TypeDB
c) Database d) ReadSource

26) You use the data control to bind to an Access database in your application. If the user changes data and moves to another record, when does the Validate Event of the data control occur? Select all that apply.
a) Before UpdateRecord method executes
b) Before the Update method executes?
c) Before a different record becomes the current record
d) Before the UpdateControls method executes
27) Your application contains on Form1 a command button named cmdOK. There is code in the cmdOk_Click event procedure. What happens to this code if you rename the button cmdAccept?
a) The code is sent to Recycle Bin
b) The code is placed in the Form1 General Object section
c) The code is deleted from the applicatio
d) The code is temporarily placed in the clipboard

28) Which of the following statements can you use to open a recordset associated with a database that will give you the fastest access to the data?
a) Set CustomerDB = Customers.OpenRecordset("SELECT CustomerName FROM Customers WHERE Country = Canada", dbOpenTable, dbForwardOnly)
b) Set CustomerDB = Customers.OpenRecordset("SELECT CustomerName FROM Customers WHERE Country = Canada", dbOpenDynaset)
c) Set CustomerDB = Customers.OpenRecordset("SELECT CustomerName FROM Customers WHERE Country = Canada", dbOpenSnapshot)
d) Set CustomerDB = Customers.OpenRecordset("SELECT CustomerName FROM Customers WHERE Country = Canada", dbOpenSnapshot, dbForwardOnly)

29) You want to enable the user to access a menu command by pressing ALT plus an access key. How can you accomplish this?
a) Using the menu editor, include a pipe(|) symbol after the letter you want to assign as the access key in the NegotiateMenus property for the menu command
b) Using the menu editor, include an underscore(_) character before the letter you want to assign as the access key in the Caption property for the menu command
c) Using the menu editor, include an ampersand(&) before the letter you want to assign as the access key in the Caption property for the menu command
d) Using the menu editor, include a pipe(|) symbol before the letter you want to assign as the access key in the Caption property for the menu command

30) You create an application that contains several forms, and you want all of the forms to minimize whenever the user minimizes frmMain. How can you accomplish this?
a) Create a code module and name it frmMain and set the MDIChild property for each form in your project o True
b) Create a standard form and name it frmMain and set the MDIChild property for each of the other forms in your project to True
c) Create an MDI form and name it frmMain and set the MDIChild property for each form in your project to True
d) Create an MDI form and name it frmMain and set the MDIChild property for each of the other forms in your project to True

31) What Object method and event are used to create a popup menu? Select all that apply.
a) MouseUp b) MouseDown
c) PopupMenu d) PopUp

32) You are using the VarType function in your code. What is the purpose of using the function?
a) It allows you to determine whether an item is a variable or a constant
b) It allows you to declare a variable without using keywords such as Dim, Static or Public
c) It identifies a variable's data type
d) It instructs your application how to store a variant value

33) If you want to find a specific record in a Recordset, which Recordset method can you use? Select all that apply.
a) Use the Seek method, regardless of the type of Recordset being used
b) Use the Seek method to find a specific record in a table-type Recordset
c) Use Find methods, regardless of the type of Recordset being used
d) Use Find methods to find a specific record in a Dynaset-type Recordset

34) You want to be able to open a database using a data control within your application. Which of the following steps should you complete? Select all that apply.
a) Use only data-bound controls, such as DBGrid and DBCombo in the project
b) Set the RecordSource property of the data control
c) Set the data control as the DataDource property of bound controls
d) Set the data control as the DatabaseName property of the data control


35) When is the RecordCount property of a Recordset accurate?
a) Only immediately after the Recordset is created
b) Only after all records in the Recordset have been created
c) Only when the Recordset is not updatable
d) Always

36) You want the execution of your code to halt when a variable changes. Which tool provides the simplest way to accomplish this?
a) Immediate Window
b) Locals Window
c) Properties Window
d) Watch Window
37) How can you prevent a run-time error from stopping execution of a procedure? Select all that apply.
a) Include the line Err.Raise in each procedure in your application
b) Include the line On Error Go To ErrorHandler in the procedure, and define ErrorHandler in the procedure
c) Include the line On Error Resume Next in the procedure
d) Include the line Err.Clear in each procedure in your application

38) You want to call a DLL that has the same name as a public variable in your application. What can you do to resolve the conflict? Select all that apply.
a) Use the Alias keyword in the declaration
b) Use the ByVal keyword in the declaration
c) Use the ByRef keyword in the declaration
d) Use the Optional keyword in the declaration

39) Which of the following statements are true concerning the ERR object? Select all that apply.
a) The Number property is the default property
b) The Source property is the default property
c) The ERR object's properties retain their values following a Resume statement
d) The Clear method resets the ERR object's properties

40) You are testing error handling code. Which of the following statements should you use to reset the properties related to run-time errors?
a) Error.Clear b) Error.Err = ""
c) Err.Clear d) Err.Error() = ""

41) You need to unhide a group of option buttons on a formif the user has selected the SetTimeOptions check box. Which of the following control statements can you use to check for this condition?
a) A For Each…Next statement
b) An If…Then…Else statement
c) A With statement
d) A For…Next statement


42) Your application will need to use a read-only property of a class module. Which type of property procedure will you need to use to create this read-only property?
a) Property Get b) Property Read
c) Property Let d) Property Set


43) You create a Forward-only snapshot-type Recordset to increase the access speed for a set of records you only need to pass through once. Which of the following methods can you use to navigate through the Recordset? Select all that apply.
a) MovePrevious b) MoveNext
c) MoveFirst d) MoveLast

44) Which of the following identifies the valid settings and their meanings for the value property of a check box?
a) 0 (unchecked), 1 (checked), 2(grayed)
b) 0 (unchecked), -1 (checked)
c) False (unchecked), True (checked)
d) 1 (unchecked), 2 (checked), 3 (grayed)

45) Which of the following objects can have a GotFocus event? Select all that apply.
a) Label b) Text box
c) Command button d) Combo box

46) What is the most significant difference between ActiveX controls and code components?
a) ActiveX controls are version-independent
b) ActiveX controls expose functionality that can be used by other applications through automation
c) ActiveX controls must exist within some type of container , usually a form or an application
d) ActiveX controls generate events through user interaction with a visual interface
47) Which action will cause a design time instance of an ActiveX control to be created?
a) Running an application containing the control at design time
b) Closing a form containing the control
c) Ending an application containing the control at design time
d) Running a compiled application containing the control

48) Which characteristic of ActiveX controls on a web page contributes to security?
a) ActiveX controls execute on the Web server rather than the user's computer
b) ActiveX controls must have a continuous connection to the Web server execution
c) Licensing makes it impossible for users to access source code downloaded from the web server
d) Only the compiled ActiveX control is downloaded from the Web server and users never see the source code

49) Why is communication between a client and an in-process server more efficient than communication between a client and an out-of -process server?
a) The server and client run in separate address spaces
b) Proxy code is used to facilitate communication between client and server
c) The server and client run in the same address space
d) Stub code is used to make communication more efficient

50) Which item is a feature of an in-process component?
a) One instance serves multiple clients
b) Global data can be shared
c) The component and client run in the same address space
d) The client is insulated from problems with the server

51) Which project template would you select to build an in-process code component?
a) ActiveX Control b) ActiveX DLL
c) ActiveX EXE d) Standard EXE

52) How can you create a read-only property for a class?
a) Define a Property Get procedure and define a Property Let procedure with no arguments
b) Define a Property Get procedure and define a Property Let procedure
c) Define a Property Get procedure without a Property Let or Property Set procedure
d) Define a Property Set or Property Let procedure without a Property Get procedure

53) How can you create a property that is an Object data type?
a) Define a Property Get procedure and a Property Let procedure
b) Define a Property Set procedure and a Property Let procedure
c) Define a Property Get procedure without a matching Property Let or Property Set procedure
d) Define a Property Set and a Property Get procedure

54) What is a remote server component?
a) It is a server component which runs in the space as its client application
b) It is a server component which runs in its own process space
c) It is an out-of-process component located on a separate computer
d) It is an in-process component located on a separate computer

55) When you create an ActiveX project, which type of file is used by Visual Basic to store the graphical elements of a User document?
a) .dox b) .dob
c) .dll d) .vbd

56) When you compile an ActiveX project named Myproj as an out-of process component, what file is produced in addition to Myproj.exe?
a) Myproj.dob b) Myproj.dll
c) Myproj.vbd d) Myproj.dox

57) Predict the output of the following code segments:
Dim lngAmount As Long
lngAmount = 998.502
Print lngAmount
a) 998.509 b) 999.509
c) 999 d) 998

58) Predict the output of the following code segments:
Dim lngVar As Long, lngVar2 As Long
lngVar = 2000000 : lngVar2 = 9000000
Dim sngVar
sngVar = lngVar + lngVar2
Print sngVar
a) 110000 b) 1100000
c) 11000000 d) 1100


59) Predict the output of the following code segments :
Dim vntVar As Variant, strVar$
strVar = "100" : vntVar = strVar + 100
Print strVar
a) 100 b) 99
c) 1000 d) 10


60) Predict the output of the following code segments :
Dim vntVar As Variant : vntVar = Null
If (vntVar) Then
MsgBox "Null"
Else
MsgBox "Not Null"
End If

a) NULL b) Not Null
c) NOT NULL d) Null

61) Data Access Objects are:
a) A set of classes used for creating OOPS
applications
b) A set of classes used for manipulating
data in Jet databases
c) A set of objects that programmer's can
customize
d) A set of objects that are created by the
users

62) Whenever an ActiveX document is opened in a container, a connection is established between:
a)Document server and container application
b)Document server and server application
c)ActiveX document & container application
d)ActiveX document and document server

63) Which of the following events is not generated if the document container is not Internet Explorer:
a) Initialize b) Display
c) Terminate d) Show

64) The Hyperlink object is used to:
a) Integrate an application with the Internet
b)Create an application that can be opened in
the Internet Explorer
c)Run Internet Explorer from an ActiveX doc.
d)All of the above

65) What happens when you attempt to close a database while a transaction is in progress?
a) The program ends
b) A rollback is issued & the program ends
c) A run-time error occurs
d) Nothing happens

66) Which of the following cannot be used to connect to an ODBC database table?
a) Open the ODBC database using the OpenDatabase method
b) Create QueryDef object that references an ODBC database
c) Use the ODBC API
d) Create a TableDef object that references an ODBC database

67) ODBC database can be accessed by using:
a) DAO & RDO
b) DAO, Data Control & RDO
c) DAO, RDO and ODBC API
d) DAO, Data Control and ODBC API

68) An ActiveX control is based on:
a) Class b) Document
c) Type library d) Dynamic-link
Library

69) ActiveX controls needs a container control, named as:
a) UserControl object
b) ActiveXControl object
c) ContainerControl object
d) COMControl object

70) To test an ActiveX control, you need to create a:
a) Project b) Form
c) Standard EXE project
d) Event procedure

71) Information about the nature of the error is retrieved from the system __________ object.
a) Error b) Err
c) On Error d) Error Check

72) The default property of the Err object is ____.
a) Number b) Variant
c) Raise d) Clear

73) Which of the following is/are not an ActiveX component?
a) ActiveX DLLs b) ActiveX controls
c) ActiveX documents d)ActiveX applications

74) In which two situations would you load, but not show, a form? Choose two.
a) To access records in a MS Access database
b) To use a serial communications control
c) To use the Timer control to generate timed events
d) To start an Error Handler routine

75) Which two techniques can be used to create a control array? Choose two.
a) At design time, assign the same name to more than one control.
b)At run time, assign the same name to more than one control.
c) At run time, set the control's Index property to a value that is not Null.
d) At design time, copy an existing control and then paste it onto the form.

76) How can you set an error trap?
a) Use the Resume command
b) Use the On Error statement
c) Place a Label before your error handler code
d) Write an error-handling routine that responds to all errors you can anticipate

77) When would you use the #If…#End If and #Const directives to conditionally compile statements?
a)Your application will access various graphic files
b)You want to create Symbolic Debug Info
c)Your application will run on different platforms
d)You are designing an Internet-enabled ActiveX application

78) Dim strvarString As String * 10
StrvarString = InputBox("Enter a String")
MsgBox strVarString 'Assume "Hello World" is entered in General declarations of Form1

a)Hello World b) Enter a String
c) Enter a string : Hello World

79) ______property is used to find the appropriate help topic in help file
a) Id Help Context b) Help Context Id
c)Context Id Help d) Help Id

80) ____is used to create a separator bar in caption box in menu
a) & b) -
c) __ (d) Alt

81)___property determines whether and how the menu appears in container form.
a) WindowListPoisition b) NegotiatePoisition
c) MenuList c) None

82) _____Determines whether the clipboard contains text or graphics.
a) GetData( ) b) GetTExt( )
c) SetData( ) d)GetFormat( )

83) The syntax for disable menu control is
a) mnumy.disabled=true b)mnumy.enabled=true
c) mnumy.enabled=false c)mnumy.visible=false

84) To display popup menu in left corner of from is:
a) Form.PopupMenu MyMenu,VBPopupMenu Left Align,0,0
b) Form.PopupMenu MyMenu,VBPopup Left Align Menu,0,0
c) Form.PopupMenu MyMenu,VBPopup Left,0,0
d) A & C

85) What will be syntax to fill HOB variable with the data of the current record of file.
a) Get#Filenum,HOB,CurrentRecord
b) Put#Filenum,HOB,CurrentRecord
c) Get#Filenum, CurrentRecord,HOB
d) Put#Filenum,CurrentRecord,HOB

86) __returns an integer representing the file no. that can be used by the open statement
a) FileFree( ) b) FileNum( )
c) FreeFile( ) d) FreeNum()

87) These files are accessed line by line
a) Random Access b) Sequential Access
c) Binary Access d) All of above

88) Syntax for opening a file in for random access
a) Open “c:\Emp.dat” for random as ABCno len, Recordlen
b) Open “c:\Emp.dat” for random as ABCno len=Recordlen
c) Open “c:\Emp.dat” for random as ABCno = len ( recordlen)
d) None

89) Input (lof(filenum),filenum) is syntax which used for the .
a) to calculate and write length of file
b) To read contents of file & assign to another file
c) To write contents on file which is specified by the filenum.
d) None
90) ____object is collection of object classes that model the structure of relational database sys.
a) ADO b) RDO
c) DAO d) ISAM

91)__is the top level database object & corresponds to the Jet database engine
a) Workspace b) DBEngine
c) Database d) User

92) The default workspace is signify by the
a) Workspace(1) b) Workspace(2)
c) Workspace(0) d) Workspace( )

93) ____object represents built in characteristics or a user define characteristics of data access object
a) User Object b) Document Object
c) Property Object d) Relation Object

94) ____method is used to add each field to its table and to add each table to the database
a) Addnew b) Append
c) Update d) Save

95) The___ enables to filter, sort, extract and update data from more than one table.
a) TableType recordset b)SnapshotType
Recordset
c) DynasetType recordset d) All of the above


96) ____to lock the recordset soon after an edit addnew is issued until an update command is issued
a) DBOptimistic b) DBPessimistic
c) DBReadOnly d) DBEditTable only

97) All ODBC data source use only ___locking
a) DBOptimistic b) DBPessimistic
c) DBReadOnly d) DBEditTable only

98) ___Database include Microsoft SQL Server, Sybase, Oracle etc;
a) ODBC b) JetDatabase
c) ISAM d) All of the above

99) ____is a collection of low level functions which can be callled directly from with in VB application.
a) System Defined b) User Defined
c) API d) Window Defined

100) _____& _______ properties of the TableDef object are set to specify the external table and database has to attached
a) Create TableDef & Connect
b) Source TableName & Connect
c) Craete TableDef & Append
d) None.

Comments

Popular posts from this blog

MCA-3 COMPUTER GRAPHICS

MCA-5 Data warehouse & Data Mining

BCA-1, COMMUNICATION SKILLS IN ENGLISH