>Concorsi
>Forum
>Bandi/G.U.
 
 
 
 
  Login |  Registrati 
Elenco in ordine alfabetico delle domande di 70-176: Desktop applications with Microsoft Visual Basic 6

Seleziona l'iniziale:
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

> Clicca qui per scaricare l'elenco completo delle domande di questo argomento in formato Word!


You are about to begin a new project for the ABC company. Here is the information that you have been given:



  • The ABC company has 140 employees, but only 30 of them will use your new application.
  • ABC company has an existing system that utilizes an SQL Server database. Some of the data may be corrupt.
  • Your application needs to use the same SQL Server database.
  • Some of the users need to access your new application as a standalone application, whereas others need to access some of the services it provides from an application that will be built at a later time.
  • It is possible that the application to be built later might be done in Visual C++. Or, maybe it will be built with Visual Basic. The company doesn’t seem to be too sure.


What type of project will you create?

   ActiveX EXE
You are building a COM component that contains two classes, A and B. Suppose class A implements class B. Which of the following statements is true? [Check all correct answers]   Class A cannot access the Friend procedures of class B.
You are building a COM component that contains two classes, A and B. Suppose class A implements class B. Which of the following statements is true? [Check all correct answers]   Class B must include all the Public procedures of class A.
You are calling an API function that requires a string capable of storing 100 bytes of data. How should you declare the string to be passed?   Dim myVar As String * 101
You are creating an ActiveX control that is meant to be used in not only other Visual Basic projects but also other development environments. The control will be issued to run on Windows 95, Windows 98, and Windows NT. The code has this rather unlikely code inside of it:



Dim myVar1 As Variant
Dim myVar2 As Variant
Dim myVar3 As Integer
myVar1 = "1"
myVar2 = "one"



Which of the following statements are valid? [Check all correct answers]

   myVar3 = myVar1 + 4
You are creating an ActiveX control that is meant to be used in not only other Visual Basic projects but also other development environments. The control will be issued to run on Windows 95, Windows 98, and Windows NT. The code has this rather unlikely code inside of it:



Dim myVar1 As Variant
Dim myVar2 As Variant
Dim myVar3 As Integer
myVar1 = "1"
myVar2 = "one"



Which of the following statements are valid? [Check all correct answers]

   myVar3 = Val(myVar1) + Val(myVar2)
You are designing an application with 100 users in 6 offices around the world. The main office is located in Detroit, Michigan, whereas other offices are in the cities of London, Paris, Sydney, Calcutta, and Rio de Janeiro. The main office is running on a Windows NT network, but the other offices run a mishmash of operating systems and equipment. The application you are designing is rather dynamic in that the business rules are subject to frequent change. Management has indicated that it is willing to make some changes in the computing environment-perhaps up to $400 or $500 per user. Of the choices listed, what is the best approach to building the application?   Create an IIS application project
You create a COM DLL with Visual Basic and write a client program that references certain methods of the objects exposed by the DLL. The objects are explicity declared. What type of binding will result?   vTable
You have a created a class module and added an event Processing_Complete (duration As Long). How would this event be invoked?   RaiseEvent Processing_Complete (1124)
You have a form named form1 on which is a CommandButton named command1. Consider the following code snippet:



Private Sub Command1_Click()
If TypeOf Me Is Form1 Then
MsgBox "form1"
End If
If TypeOf Me Is Form Then
MsgBox "form"
End If
If TypeOf Me Is CommandButton Then
MsgBox "CommandButton"
End If


What will be displayed in the message box(es)? [Check all correct answers]

   form1
You have a form named form1 on which is a CommandButton named command1. Consider the following code snippet:



Private Sub Command1_Click()
If TypeOf Me Is Form1 Then
MsgBox "form1"
End If
If TypeOf Me Is Form Then
MsgBox "form"
End If
If TypeOf Me Is CommandButton Then
MsgBox "CommandButton"
End If


What will be displayed in the message box(es)? [Check all correct answers]

   form
You have a form named frmCustomer. On frmCustomer, there is a CommandButton control named cmdOK and a control array of TextBox controls named txtFields. This code is in the Click event of cmdOK. Other than the Name, Index, and Caption, you did not change any control properties at design time.



The project contains a DataEnvironment object named deData. deData is a single Connection object named conSQLSrv. There is also a single Command object named cmdCustomer that returns all customers in the database. One of the fields in the record is cust_age, which is numeric.


The Form has a module-level variable named rsCustomer that is assigned as follows:



Dim WithEvents rsCustomer As Recordset


The Form_Load event contains the following code:


Set rsCustomer = deData.cmdCustomer
cmdOK_Click


The following code is attached to the cmdOK_Click event procedure:


Dim vControl
For Each vControl in txtFields
txtFields.CausesValidation = Not _ txtFields.CausesValidation
Next
cmdOK.Enabled = False


The Validate event of txtFields contains the following code:


If Val(txtFields(Index).Text) < 0 Then
MsgBox "Invalid Age"
txtFields(Index).SelStart = 0
txtFields(Index).SelLength = _ Len(txtFields(Index).Text)
Cancel = True
End If



When you test the code, you notice that there are some problems. What are they? [Check all correct answers]

   The code does not run at all.
You have a form named frmCustomer. On frmCustomer, there is a CommandButton control named cmdOK and a control array of TextBox controls named txtFields. This code is in the Click event of cmdOK. Other than the Name, Index, and Caption, you did not change any control properties at design time.



The project contains a DataEnvironment object named deData. deData is a single Connection object named conSQLSrv. There is also a single Command object named cmdCustomer that returns all customers in the database. One of the fields in the record is cust_age, which is numeric.


The Form has a module-level variable named rsCustomer that is assigned as follows:



Dim WithEvents rsCustomer As Recordset


The Form_Load event contains the following code:


Set rsCustomer = deData.cmdCustomer
cmdOK_Click


The following code is attached to the cmdOK_Click event procedure:


Dim vControl
For Each vControl in txtFields
txtFields.CausesValidation = Not _ txtFields.CausesValidation
Next
cmdOK.Enabled = False


The Validate event of txtFields contains the following code:


If Val(txtFields(Index).Text) < 0 Then
MsgBox "Invalid Age"
txtFields(Index).SelStart = 0
txtFields(Index).SelLength = _ Len(txtFields(Index).Text)
Cancel = True
End If



When you test the code, you notice that there are some problems. What are they? [Check all correct answers]

   The Validate event cannot possibly execute.
You have a form named frmCustomer. On frmCustomer, there is a CommandButton control named cmdOK and a control array of TextBox controls named txtFields. This code is in the Click event of cmdOK. Other than the Name, Index, and Caption, you did not change any control properties at design time.



The project contains a DataEnvironment object named deData. deData is a single Connection object named conSQLSrv. There is also a single Command object named cmdCustomer that returns all customers in the database. One of the fields in the record is cust_age, which is numeric.


The Form has a module-level variable named rsCustomer that is assigned as follows:



Dim WithEvents rsCustomer As Recordset


The Form_Load event contains the following code:


Set rsCustomer = deData.cmdCustomer
cmdOK_Click


The following code is attached to the cmdOK_Click event procedure:


Dim vControl
For Each vControl in txtFields
txtFields.CausesValidation = Not _ txtFields.CausesValidation
Next
cmdOK.Enabled = False


The Validate event of txtFields contains the following code:


If Val(txtFields(Index).Text) < 0 Then
MsgBox "Invalid Age"
txtFields(Index).SelStart = 0
txtFields(Index).SelLength = _ Len(txtFields(Index).Text)
Cancel = True
End If



When you test the code, you notice that there are some problems. What are they? [Check all correct answers]

   There are logic errors in the Validate event.
You have a form with a single TextBox control. As you can see in Exhibits 1 and 2 (Figures 15.1 and 15.2), the Cut and Copy menu items are enabled when text is highlighted and disabled when text is disabled. Where is the most likely place that the author attached code to accomplish this?   The Edit menu's Click event procedure.
You have a form with an OLE container control named OLE1. Which of the following will create an embedded object?   OLE1.CreateEmbed ("c:\docs\mydoc.doc")
You have a form with four text boxes on it and need to intercept keystrokes for all four text boxes. Which of the following solutions is best?   Use the KeyDown or KeyPress events of each of the text boxes.
You have a form with one CommandButton named Command1. You enter the following code:



Private Sub Command1_Click()
MsgBox 1
End Sub
Private Sub Command2_Click()
MsgBox 2
End Sub



You then rename Command1 to Command2 and run the project. What will be displayed?

   1
You have an ADO record set named rs open; it contains some addresses. One of the fields is City. Which of the following will find the first occurrence of the city “Worcester”?   

Dim search As String
You have an application consisting of a form named form1 and two CommandButton controls named Command1 and Command2. The code is as follows:


Private Sub Command1_Click()
MsgBox "Hello World"
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Command1_Click
End Sub



What happens when the user presses Command2?

   The program just ends.
You have an application that is remarkably similar to the one in Question 27, consisting of a form named form1 and two CommandButton controls named Command1 and Command2. The code is as follows:

Private Sub Command1_Click()
MsgBox "Hello World"
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Command1_Click
End Sub

What happens when the user presses Command2?
   The application displays the message box and ends.
You have an application with the following code snippet:



#If Win95 Then
MsgBox "Welcome Win95 user!"
#ElseIf Win32 Then
MsgBox "Welcome Win32 user!"
#End If



The application is being run under Windows 95. Which message box will be displayed?

   “Welcome Win32 user!”
You have created a class module and are adding a property that is to be exposed for read/write access. What statement(s) will accomplish this?   Property Get and Property Let
You have created a COM component for which you are using the apartment-threaded model. Which of the following statements are not true? [Check all correct answers]   Each thread can be shared with multiple clients in a round-robin manner.
You have created a COM component for which you are using the apartment-threaded model. Which of the following statements are not true? [Check all correct answers]   Threads can be limited in number in the Project Properties dialog.
You have created a COM component for which you have specified a thread pool of six threads. What type of component have you created?   ActiveX EXE
You have created a COM component that you wish to persist. What method should you use?   WriteProperty
You have created a Standard EXE project with Visual Basic that analyzes sales data from your company. You used the Package and Deployment Wizard to distribute the program throughout the Sales department, which includes Mary, Director of Marketing. Inside of a procedure that performs varios statistical analysis, you have this code snippet:



Dim myVar As Integer
myVar = 3
If myVar = 3 Then Debug.Print myVar



Where will the output be displayed?

   None of the above
You have created an ActiveX component to run on a remote computer. What project option causes the necessary files to be generated when the project is compiled?   Remote Server Files.
You have created an ActiveX control project. You place a PictureBox, Image, and CommandButton control on the User control. The only code is this:


Private Sub Command1_Click()
Image1 = Picture1
End Sub



You set the Picture property of the PictureBox to a neat bitmap that you found on the Internet. You compile the project into an OCX file and add it to another Visual Basic project. In the new project, you have only a form on which you place your fabulous ActiveX control. You add no code to the form at all.



Next, you use the ActiveX Document Migration Wizard and convert your form to a UserDocument. You run the project inside of Internet Explorer and click on the CommandButton control. What happens?

   The bitmap displayed in the PictureBox is displayed in the Image control.
You have created an ActiveX control. The InvisibleAtRuntime property was set to True when you created it. It performs some currency exchange calculations for your order-entry application. The ActiveX control has a bug in it that causes it to crash every once in a great while with no discernible pattern. Because the crashes are so rare, you elect to proceed with the rest of your project and figure that some day (maybe after next year’s Super Bowl), you’ll get around to figuring out what the bug is.



You will include the ActiveX control as part of a COM component that is to be used by your order-entry application. The COM component is responsible for connecting to the database and retrieving, validating, and editing records. The COM component will also include code to validate user passwords and assign a “security level.” (The security level is used to determine which screens the user is allowed to see and whether or not he or she can update the data.)



The order-entry application will leave almost all business logic to the COM component and will consist mainly of the user interface (forms, menus, and so forth). The COM component will be shared by multiple users on an application server.



What type of Visual Basic project will you choose to create the COM component?

   COM EXE
You have created an application with Visual Basic. After compiling it, you have run the Package And Deployment Wizard to create a CAB file for distribution. What step(s) do you take to compress the CAB file in a manner such that the Setup.EXE program you distribute can still install your application?   None of the above.
You have created an in-process COM component with Visual Basic 6 and now wish to debug it. How do you do it?   Open the Visual Basic client application, and then use the Add Project option to add the COM component project into the same instance of Visual Basic. Run the client application as normal.
You have placed some controls on a form and wish to dock them on the bottom of the screen. Which is the best approach to doing so?   Place the controls in a PictureBox control.
You have written a database application. You have a form where users can update records. However, you are concerned that a user might close the form before all changes have been saved. In what event of the form could you place code to handle this?   QueryUnload
You wish to boldface the text on every command button on every open form in your application. Which code snippet will accomplish this?   

Dim vForm As Variant
Your application displays a pop-up menu. Which of the following is true?   The menu is displayed modally.
Your application has opened an ADO Recordset. In your code, you have coded an error handler that specifies On Error Resume Next followed by a line of code that invokes the MoveLast method of the Recordset object. Under which of the following circumstances might there be no records?   When both BOF and EOF are True
Your form has two TextBox controls occupying the exact same space (one is on top of the other). Assuming the following code snippet, with which TextBox control(s) can the user interact (that is, into which TextBox control[s] can the user type)?



Private Sub Form_Load()
Text2.ZOrder 1
Text1.ZOrder 0
End Sub

   Both