T TestsWorld

Free practice test · Microsoft

Exam 70-306

35 questions with a timer and instant results. Practise in short drills or take the full test, then see exactly which topics need work.

📝 35 questions ⏱ 20 min for all 🎯 Pass mark 70% 💸 Free, unlimited attempts
⚡
Short drills

Pick 10, 25 or 50 questions for a quick round, or take all of them.

💡
Learn as you go

Practice mode shows the right answer and an explanation for every question.

📊
See your weak spots

Your result shows strong and weak topics and what to read next.

What's in the test

Easy 20% Medium 54% Hard 26%
DataColumn Expression 1Control Docking 2Event Handlers 1Control Validation 2Exception Handling 1Web Service Proxy Classes 1DataReader Commands 1Validating Event 1Menu Events 2Event Handling 1Transaction Isolation Levels 2Project Templates 1

Sample questions with answers

6 of the 35 questions in Exam 70-306. Try each one, then open the answer.

  1. Question 1
    You develop an application that enables users to enter and edit purchase order details. The application includes a Windows Form named DisplayPOForm. The application uses a client-side DataSet object to manage data. The DataSet object contains a Data Table object named PODetails. This object includes one column named Quantity and another named UnitPrice. For each item on a purchase order, your application must display a line item total in a DataGrid control on DisplayPOForm. The line item is the product of Quantity times UnitPrice. Your database design does not allow you to store calculated values in the database. You need to add code to your Form_Load procedure to calculate and display the line item total. Which code segment should you use?
    • A. Dim totalColumn As New DataColumn("Total", Type.GetType("System.Decimal")) PODetails.Columns.Add(totalColumn) totalColumn.Expression = "Quantity * UnitPrice"
    • B. Dim totalColumn As New DataColumn("Total", Type.GetType("System.Decimal")) PODetails.Columns.Add(totalColumn) totalColumn.Equals("Quantity * UnitPrice")
    • C. PODetails.DisplayExpression("Quantity * UnitPrice")
    • D. PODetails.DisplayExpression("quantityColumn + unitPriceColumn")
    Show answer
    Answer: A. Dim totalColumn As New DataColumn("Total", Type.GetType("System.Decimal")) PODetails.Columns.Add(totalColumn) totalColumn.Expression = "Quantity * UnitPrice"
    We use the Expression property of the DataColumn object to calculate the values in the column.
  2. Question 2
    Your company uses Visual Studio .NET to develop internal applications. You create a Windows control that will display custom status bar information. Many different developers in your company will use the control to display the same information in many different applications. The control must always be displayed at the bottom of the parent form in every application. It must always be as wide as the form. When the form is resized, the control should be resized and repositioned accordingly. What should you do?
    • A. Create a property to allow the developers to set the Dock property of the control. Set the default value of the property to AnchorStyle.Bottom.
    • B. Create a property to allow the developer to set the Anchor property of the control. Set the default value of the property to AnchorStyle.Bottom.
    • C. Place the following code segment in the UserControl_Load event: Me.Dock = DockStyle.Bottom
    • D. Place the following code segment in the UserControl_Load event: Me.Anchor = AnchorStyle.Bottom
    Show answer
    Answer: C. Place the following code segment in the UserControl_Load event: Me.Dock = DockStyle.Bottom
    DockStyle.Bottom docks the control to the bottom of the form. This will force the control to be as wide as to form. Furthermore the control will be resized automatically.
  3. Question 3
    You are using Visual Basic.NET to design a form. You wish to define ten Button controls with similar functionality. In order for your code to be as maintainable as possible, you want to implement only one Button Click event handler which will be referenced by all ten buttons. Using a control array containing all ten Button controls would be one way to do this.
    • A. False
    • B. True
    • C. Can't Say
    • D. None of these
    Show answer
    Answer: A. False
    Control arrays are not available in Visual Basic.NET. In Visual Basic.NET, you can achieve similar functionality by directly pointing multiple controls to the same event handler. To do this, use the AddHandler keyword. For example, to associate bt2 with bt0's Click event handler, you might use code like: AddHandler bt2.Click, AddressOf Me.bt1_Click
  4. Question 4
    You are developing a securities research Windows application, which includes a main form displaying a summary of all research available for a particular stock ticker symbol.The first field on this form is an ActiveX control which allows the user to enter a stock ticker symbol to display.When the user exits the field, the rest of the controls are populated with data about that particular stock, and the focus advances to the MyNotes text box control.If the user does not enter a valid ticker symbol, you want to force the application to keep the cursor in the TickerSym control, rather than advancing to MyNotes.How do you do this?
    • A. In the MyNotes_GotFocus event handler, validate the contents of TickerSym, and if validation is not successful, raise the TickerSym_GotFocus event.
    • B. Define a TickerSym_Validate procedure which handles the TickerSym_Validate event, and set the TickerSym.Valid property to False if validation is not successful
    • C. In the TickerSym_LostFocus event handler, set the Me.NextIndex property to the TabIndex of the TickerSym control
    • D. In the TickerSym_Validate event handler, set the CancelEventArgs.Cancel property to True
    Show answer
    Answer: D. In the TickerSym_Validate event handler, set the CancelEventArgs.Cancel property to True
    Perform the validation in the control's Validate event handler.If the validation does not succeed, set the CancelEventArgs.Cancel property to True, to cause the focus to remain on that control.You should validate the contents of a control in that same control's Validate event handler, not in the subsequently-appearing control's GotFocus event handler.While this might technically work, it requires putting code specific to one control into another, and if the order of controls on the form ever changed, you might have to move the code to another control's GotFocus event handler.There is no standard property called "Valid", used to indicate whether or not data is considered valid; this functionality is handled by setting CancelEventArgs.Cancel = True.The LostFocus event is not as appropriate a location as the Validate event, because by the time LostFocus occurs, focus has shifted to the next control, and must be shifted back to the TickerSym control.
  5. Question 5
    Your development team is creating a new Windows-based application for a mortgage company. The application consists of a user interface and several XML Web services. You develop all XML Web services and perform unit testing. Now you are ready to write the user interface code. Because some of your servers are being upgraded, the XML Web service that provides mortgage rates is currently offline. However, you have access to its description file. You must begin writing code against this XML Web service immediately. What should you do?
    • A. Generate the proxy class for the XML Web service by using Disco.exe.
    • B. Generate the proxy class for XML Web service by using Wsdl.exe.
    • C. Obtain a copy of the XML Web service assembly and register it on your local development computer.
    • D. Add the description file for the XML Web service to your Visual Studio .NET project.
    Show answer
    Answer: B. Generate the proxy class for XML Web service by using Wsdl.exe.
    Ordinarily to access an XML Web service from a client application, you first add a Web reference, which is a reference to an XML Web service. When you create a Web reference, Visual Studio creates an XML Web service proxy class automatically and adds it to your project. However, you can manually generate a proxy class using the XML Web services Description Language Tool, Wsdl.exe, used by Visual Studio to create a proxy class when adding a Web reference. This is necessary when you are unable to access the XML Web service from the machine on which Visual Studio is installed, such as when the XML Web service is located on a network that will not be accessible to the client until run time. You then manually add the file that the tool generated to your application project.
  6. Question 6
    What output is produced by the following code segment? Debug.WriteLine("Beginning") Try Throw New MyException() Catch excp as MyException ' Note: The MyException class inherits from ApplicationException Debug.WriteLine("In catch MyException") Catch excp as ApplicationException Debug.WriteLine("In catch ApplicationException") Finally Debug.WriteLine("Ending") End Try
    • A. Beginning In catch MyException Ending
    • B. Beginning In catch MyException Ending In catch ApplicationException Ending
    • C. Beginning In catch MyException
    • D. Beginning In catch MyException In catch ApplicationException
    Show answer
    Answer: A. Beginning In catch MyException Ending
    A single Try/Catch/Finally block that is not nested will trap only the first exception which occurs during execution of the code in the Try block, execute the code in the relevant Catch block, and then proceed to the Finally code, if present. Unless the Try/Catch/Finally is surrounded by a loop, it will only execute once, so it is impossible for the Finally code to execute twice

Want all 35 with a timer and a topic-wise result? Start the free test at the top of this page.

About this practice test

This course will give you the ability to develop and implement Windows-based applications with Web forms, ASP.NET, and the Microsoft .NET Framework. When you pass the Developing and Implementing Windows Applications with Microsoft Visual Basic® .NET and Microsoft Visual Studio® .NET exam, you achieve Microsoft Certified Professional status

This practice test belongs to TestsWorld's Microsoft certification track. The bank covers the long history of Microsoft technical exams — from the classic 70-xxx Windows Server, SQL Server, Exchange and SharePoint papers, through to MCITP / MCSE designations. Many of these exams are now retired but the underlying concepts remain useful for legacy environment support, brown-field migrations, and historical reference.

What this practice test gives you

42 multiple-choice questions covering the subject area, served from a randomised order so each attempt feels fresh. Take the test at your own pace. Allowed time per attempt: 20 min. Pass mark: 70%.

Study tips. Many Microsoft exams in this bank are legacy 70-xxx era; review the explanations carefully and cross-check terminology against the modern Microsoft Learn documentation where the concept still applies. For currently-live exams, Microsoft Learn's role-based learning paths remain the canonical free study material.

Before you start: device, fullscreen and proctoring