Microsoft Certification 70-526 Practice Exam

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Muskad202
Muskad202
Community Contributor
Quizzes Created: 2 | Total Attempts: 7,118
| Attempts: 1,944 | Questions: 38 | Updated: May 22, 2025
Please wait...
Question 1 / 39
🏆 Rank #--
Score 0/100

1. You decide to use named parameters in a SqlCommand object in order to execute SQL queries on a database. You have a parameter named �CustomerName�. How do you refer to it within the SQL query text in the SqlCommand object?

Explanation

You should use code like:
SqlCommand.CommanText = SELECT * FROM Customers WHERE CustomerName=@CustomerName;
SqlCommand.Parameters.Add(@CustomerName, customer name here);

Submit
Please wait...
About This Quiz
Microsoft Certification 70-526 Practice Exam - Quiz

This is a practice exam for Microsoft Technology Specialist (TS) Exam 70-526 on the topic of Microsoft. NET Framework 2.0 - Windows-based Client Development developed for students and learners. You can either take this as 70-526 practice questions or as a timed practice exam. Read the questions carefully. So, let's... see moretry out the quiz. All the best!
see less

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. Which function of the SqlCommand object must you use in order to execute an INSERT SQL Query?

Explanation

You should use ExecuteNonQuery() to insert any SQL statement which does not return a dataset.

Submit

3. You dynamically create a TextBox control tb1 in code at runtime. You want to associate an event handler with tb1 that gets fired when the user clicks tb1. What operator will you use to associate the event handling function with the Click event of tb1?

Explanation

You should use code like:
tb1.Click += new System.EventHandler(functionname);

Submit

4. You have added a button named Bt1 to your form, whose Text is Go. You want to assign a shortcut to the button so that whenever a user presses ALT+G, the Click event of the button Bt1 is raised. What code should you use?

Explanation

Specifying the �&� character in front of any character in the Text property, causes the succeeding character to be displayed with an underline below it, and causes that character along with the ALT character to act as a shortcut.

Submit

5. You use a BackgroundWorker object in order to execute some work in a background thread. Whenever the percentage of the work done changes, you want to be notified so that you can update a progress bar control. What event handler of the BackgroundWorker object would you use?

Explanation

The ProgressChanged event handler of the BackgroundWorker object would be used in this scenario. This event is raised when the progress of the background operation changes. By subscribing to this event, you can be notified whenever the percentage of the work done changes, allowing you to update a progress bar control accordingly.

Submit

6. You have a DataSet object ds1, which contains two tables Orders and OrderDetails. The OrderId column in Orders is set to a DataColumn object called to, and the same column in the OrderDetails table is set to a DataColumn object called DCOI. Since this is a foreign key relationship, you want to capture this relationship in the dataset. What code would you use to link these two tables in the DataSet ds1?

Explanation

The syntax for creating a DataRelation is:
DataRelation dr= new DataRelation(�relation name�, parentColumn, childColumn);
The DataSet.Relations.Add() method only accepts a DataRelation parameter.

Submit

7. You execute a number of SQL Queries on an SQLConnection object conn, in the context of a SqlTransaction trans. In your code, you have logic that aborts the transaction in some cases. What code would you use to abort the transaction so that the changes dont get committed to the database?

Explanation

The correct answer is trans.Rollback(). This code is used to abort the transaction and rollback any changes made within the transaction, ensuring that the changes are not committed to the database.

Submit

8. You have a textbox Text1 and an ErrorProvider ep1 on your form. You want to display an error message on your form when invalid data in Text1 is entered. What code should you use?

Explanation

The correct code to display an error message on the form when invalid data is entered in Text1 is "ep1.SetError(Text1, 'invalid data')". This code sets the error message "invalid data" for the control Text1 using the ErrorProvider ep1.

Submit

9. You have a textbox control on your form. You want to store some custom data associated with that object. This data should not be visible to the user � it is meant for internal use in your application. What code should you use?

Explanation

You should use the Tag property to store custom data with a Control.

Submit

10. You create a function F, which will be executed in a separate thread. You create a thread object T, and use a ParameterizedThreadStart delegate passing in F, so that when the thread starts, F will get executed. What should the signature of the function F be?

Explanation

The function F should have a void return type because it is not required to return any value. It should have an object parameter because the ParameterizedThreadStart delegate expects a method with a single object parameter.

Submit

11. You want to create an XmlDocument object in order to read XML data stored in a file input.xml. Which code should you use?

Explanation

The correct code to create an XmlDocument object and read XML data stored in a file "input.xml" is "XmlDocument doc = new XmlDocument(); doc.Load("input.xml");". This code initializes an XmlDocument object and then uses the Load method to load the XML data from the file "input.xml" into the XmlDocument object.

Submit

12. Your application assemblies need to be installed into the Global Assembly Cache. What deployment strategy should you adopt?

Explanation

You should create a setup project in order to copy assemblies into the GAC.

Submit

13. You want to create a reusable control by combining existing Windows Controls in order to use it in various of your applications. What should the base class of your control be?

Explanation

The correct answer is System.Windows.Forms.UserControl because UserControl is a class in the System.Windows.Forms namespace that provides a base class for creating controls that can be used in multiple applications. It allows you to combine and customize existing Windows Controls to create a new control that can be easily reused in different applications.

Submit

14. You create a custom control, which a user can drag and drop on his form. You want to create custom properties for your control, which the user can set using the Properties window of the Visual Studio IDE. What attribute can you use to control the visibility of the properties in the Properties window in the Visual Studio IDE?

Explanation

The Browsable attribute can be used to control the visibility of the properties in the Properties window of the Visual Studio IDE. By setting this attribute to true, the properties will be visible and editable in the Properties window, allowing the user to set them. Conversely, setting the attribute to false will hide the properties from the Properties window, preventing the user from modifying them.

Submit

15. You add a PictureBox control to your form, in order to display images to the user. Usually, you see that the images are smaller in size than the PictureBox control. What value of the SizeMode property should you set so that the size of the images adjust to fill the PictureBox control?

Explanation

You should set PictureBox.SizeMode=StretchImage so that the image stretches to fill the PictureBox control.

Submit

16. What event of the BackgroundWorker object will you use in order to execute code that should run when the background thread completes?

Explanation

The correct event to use in order to execute code that should run when the background thread completes is the RunWorkerCompleted event. This event is raised when the background operation has completed, been canceled, or has raised an exception. It provides a way to handle the completion of the background operation and perform any necessary cleanup or post-processing tasks.

Submit

17. You want to execute a DELETE SQL query on a table in a database. You want to retrieve the number of rows that were deleted. What code should you use?

Explanation

The correct answer is to use the code: SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; int rowcount = cmd.ExecuteNonQuery().

The ExecuteNonQuery() method is used to execute a SQL query that does not return any data. It is commonly used for executing INSERT, UPDATE, and DELETE queries. In this case, the DELETE query will delete rows from the table specified in the command text, and the number of affected rows will be returned as an integer value, which can be stored in the variable "rowcount".

Submit

18. You use a DataTable to load data from the Orders Table from a database. The Orders table contains two columns of Quantity and UnitPrice. You want to add another column, which computes the total price using the formula: TotalPrice=Quantity*UnitPrice. What code will you use to add this third column to the DataTable?

Explanation

The correct answer is dataTable.Columns.Add("TotalPrice", typeof(Double), "Quantity * UnitPrice"). This code adds a new column named "TotalPrice" to the DataTable with a data type of Double. The expression "Quantity * UnitPrice" is used as the formula to compute the values for the new column.

Submit

19. You place a progress bar control on your form. From your code, you call the PerformStep() method on the progress bar object. By how much will the progressbars value increase?

Explanation

The progress bar's value will increase by the amount specified in the Step property.

Submit

20. You want your application to load the localized resources for the French language, but you want numbers and date/times to be displayed in the United States format. What code should you use?

Explanation

The CurrentCulture property determines the formatting to use while displaying numbers, dates, and time. The CurrentUICulture property determines which localized resources to load.

Submit

21. You have a background worker object bw1. How do you assign the work to it that should be executed in a background thread?

Explanation

The correct answer is bg1.DoWork += delegate { functionname(); }; bg1.RunWorkerAsync();. This is the correct way to assign work to a background worker object. The "+=" operator is used to add a delegate to the DoWork event, which specifies the method that will be executed in the background thread. Then, the RunWorkerAsync() method is called to start the background operation.

Submit

22. You create a function named ThreadedFunction which you will execute in a new Thread. To this function, you will pass the name of a file, and in the function, you will read the contents of that file. What code should you use to start the thread?

Explanation

The correct code to start the thread is "Thread T = new Thread(new ParameterizedThreadStart("ThreadedFunction")); T.Start(filename);" This is because the "ParameterizedThreadStart" delegate allows you to pass a parameter to the thread function, in this case, the filename. The "Start" method is then called on the thread object to start the execution of the thread.

Submit

23. Within your Setup and Deployment project, you want certain actions to occur only if the user is installing the application on windows xp. What condition would you check for?

Explanation

VersionNT>=500 will be true for all versions greater than or equal to Windows 2000. VersionNTName is an invalid property.

Submit

24. You have a .xml file and the corresponding .xsd. Which class should you use to validate the XML against the corresponding schema file?

Explanation

You should use the XmlReader class. You should not use XmlValidatingReader, because this class has been marked as obsolete in .NET 2.0.

Submit

25. When the user moves the mouse cursor over a Button control, you want to change the background colour of the button. When the user moves the mouse away from the Button, you want to restore the original background color of the Button. What events do you need to use?

Explanation

The correct answer is MouseOver and MouseLeave. The MouseOver event is triggered when the user moves the mouse cursor over the Button control, allowing us to change the background color of the button. The MouseLeave event is triggered when the user moves the mouse away from the Button, allowing us to restore the original background color of the Button. MouseHover and MouseOut are not the correct events in this scenario.

Submit

26. You have code that executes SQL statements on a database within the context of a SQLTransaction. You want to ensure that no user can perform any updates in the database until your transaction is complete. What IsolationLevel should you use?

Explanation

The Serializable IsolationLevel places a lock on the database, preventing any other updates from occurring in the database until the transaction completes.

Submit

27. You create a SqlCommand object com in order to execute a SQL Query on a database table. Which code snippet should you use in order to select all records from the table Customers?

Explanation

The correct answer is com.CommandText = "Customers"; com.CommandType = CommandType.TableDirect; because the "Customers" table is being selected using the CommandType.TableDirect enumeration value. This value indicates that the command text is a table name rather than a SQL query or stored procedure.

Submit

28. Which property of the web browser control should you use in order to navigate to a specified URL?

Explanation

The correct answer is "Url". The Url property of the web browser control is used to navigate to a specified URL. This property allows you to set the URL of the web page that you want to display in the control. By assigning a valid URL to the Url property, the web browser control will navigate to that URL and load the corresponding web page.

Submit

29. You have a DataTable dt1, which contains data about registered users. There is a column in the data table named IsApproved which is a Boolean Column which determines whether the user has been approved or not. You add a Checkbox cb1 to your form. You want cb1 to be ticked or not depending on the IsApproved value of the current row in the table. What code should you use?

Explanation

The signature of the method is:
control.DataBindings.Add(�control property�, datatable /dataset object, �column name in Datatable/Dataset�);

Submit

30. You create 4 forms FormA, FormB, FormC and FormD. You want to allow users to open FormA, FormB and FormC at the same time within FormD. Which properties do you need to set?

Explanation

You need to set the MdiParent on Forms A,B and C to the value FormD. There is no property named IsMdiParent IsMdiContainer must be set to true on FormD.

Submit

31. You are creating a custom control, which has a single custom event. When the user double-clicks the control in the designer, you want the code for the event handler for the custom event to be autogenerated. What should you do?

Explanation

By applying the DefaultEvent attribute to the class that represents the control and specifying the name of the event, the code for the event handler for the custom event will be autogenerated when the user double-clicks the control in the designer. This attribute allows the event to be set as the default event for the control, making it easier for developers to handle the event without manually writing the event handler code.

Submit

32. You are creating a setup and deployment project for your application. You want to ensure that the .NET Framework 2.0 is installed on the computers of the users who want to install your application. Which deployment editor should you use?

Explanation

The conditions in the Launch Conditions Editor are checked before the application installation starts.

Submit

33. You use an AutoResetEvent object for synchronizing access to common variables from different threads. Which method of the AutoResetEvent would you call in order to signal to other threads that the current thread has finished accessing the common variables?

Explanation

The Set method of the AutoResetEvent object is used to signal to other threads that the current thread has finished accessing the common variables. This method allows other threads that are waiting on the AutoResetEvent to proceed and access the common variables.

Submit

34. You use a TransactionScope in your application in your application in order to use transaction semantics. What code should you use in order to commit the transaction within the transaction scope?

Explanation

To commit the transaction within the transaction scope, you should use the code TransactionScope.Complete(). This method marks the transaction as complete and allows it to be committed.

Submit

35. If the user presses a certain key combination (which includes ALT) while your control had focus, you want to receive a notification so that you can execute custom code. In your custom code, you want to prevent other controls from receiving notification about the key combination that was pressed. What should you do?

Explanation

You should override the OnKeyDown method, and not call the base implementation. If you just handle the KeyDown event, then other controls will also receive notifications. The KeyPress event and the OnKeyPress method wont allow you to determine if the ALT key was pressed or not.

Submit

36. You have a DataTable in your application which you display to the user. The user is allowed to enter some data in a textbox and then press the Update button to update the data in the data table. You want to add code to an event of the DataTable so that when a Row is being updated, a message box is displayed to the user. Which event of the DataTable should you use?

Explanation

There are no events named RowUpdating and RowUpdated. The RowChanged event is not the correct event to use here since it is fired after the data has been updated. The Question asks for the message to be displayed while a row is being updated.

Submit

37. You want to make your application accessible to physically challenged users. Consider Windows Narrator. When controls receive focus, the Narrator speaks out the information given to it. Which properties does the Narrator speak out for a windows control?

Explanation

The Narrator speaks out the AccessibleName and AccessibleDescription properties for a windows control. These properties provide information about the control to visually impaired users. The AccessibleName property represents the name or label of the control, while the AccessibleDescription property provides a more detailed description of the control's purpose or function. By providing accurate and descriptive information in these properties, developers can ensure that visually impaired users can navigate and interact with the application effectively.

Submit

38. You want to access websites on the internet using HTTP. Which of the classes below can you use?

Explanation

You can use System.Net.WebClient and System.Net.HttpWebRequest to access websites on the internet using HTTP.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (38)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
You decide to use named parameters in a SqlCommand object in order to...
Which function of the SqlCommand object must you use in order to...
You dynamically create a TextBox control tb1 in code at runtime. You...
You have added a button named Bt1 to your form, whose Text is Go. You...
You use a BackgroundWorker object in order to execute some work in a...
You have a DataSet object ds1, which contains two tables Orders and...
You execute a number of SQL Queries on an SQLConnection object conn,...
You have a textbox Text1 and an ErrorProvider ep1 on your form. You...
You have a textbox control on your form. You want to store some custom...
You create a function F, which will be executed in a separate thread....
You want to create an XmlDocument object in order to read XML data...
Your application assemblies need to be installed into the Global...
You want to create a reusable control by combining existing Windows...
You create a custom control, which a user can drag and drop on his...
You add a PictureBox control to your form, in order to display images...
What event of the BackgroundWorker object will you use in order to...
You want to execute a DELETE SQL query on a table in a database. You...
You use a DataTable to load data from the Orders Table from a...
You place a progress bar control on your form. From your code, you...
You want your application to load the localized resources for the...
You have a background worker object bw1. How do you assign the work to...
You create a function named ThreadedFunction which you will execute in...
Within your Setup and Deployment project, you want certain actions to...
You have a .xml file and the corresponding .xsd. Which class should...
When the user moves the mouse cursor over a Button control, you want...
You have code that executes SQL statements on a database within the...
You create a SqlCommand object com in order to execute a SQL Query on...
Which property of the web browser control should you use in order to...
You have a DataTable dt1, which contains data about registered users....
You create 4 forms FormA, FormB, FormC and FormD. You want to allow...
You are creating a custom control, which has a single custom event....
You are creating a setup and deployment project for your application....
You use an AutoResetEvent object for synchronizing access to common...
You use a TransactionScope in your application in your application in...
If the user presses a certain key combination (which includes ALT)...
You have a DataTable in your application which you display to the...
You want to make your application accessible to physically challenged...
You want to access websites on the internet using HTTP. Which of the...
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!