Microsoft Certification 70-526 Practice Exam

38 Questions

Settings
Microsoft Certification Exam Quizzes & Trivia

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 try out the quiz. All the best!


Questions and Answers
  • 1. 
    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?
    • A. 

      IsMdiChild on Forms A,B and C; and IsMdiParent on FormD.

    • B. 

      MdiParent on Forms A,B and C; and IsMdiContainer on FormD.

    • C. 

      IsMdiChild on Forms A,B and C; and IsMdiContainer on FormD.

    • D. 

      MdiParent on Forms A,B and C; and IsMdiParent on FormD.

  • 2. 
    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?
    • A. 

      DebuggerBrowsable

    • B. 

      ComVisible

    • C. 

      Browsable

    • D. 

      DisplayBrowsable

  • 3. 
    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�?
    • A. 

      Com.CommandText = �SELECT * FROM Customers�; com.CommandType = CommandType.StoredProcedure;

    • B. 

      Com.CommandText = �SELECT * FROM Customers�; com.CommandType = CommandType.TableDirect;

    • C. 

      Com.CommandText = �Customers�; com.CommandType = CommandType.Text;

    • D. 

      Com.CommandText = �Customers�; com.CommandType = CommandType.TableDirect;

  • 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?
    • A. 

      Bt1.Text = @�Go�;

    • B. 

      Bt1.Text = �&Go�;

    • C. 

      Bt1.Text = �&&Go�;

    • D. 

      Bt1.Text = �@Go�;

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

      NavigateUrl

    • B. 

      DocumentUrl

    • C. 

      Url

    • D. 

      PageUrl

  • 6. 
    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?
    • A. 

      Registry Editor

    • B. 

      File System Editor

    • C. 

      Launch Conditions Editor

    • D. 

      Required Components Editor

  • 7. 
    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?
    • A. 

      Normal

    • B. 

      StretchImage

    • C. 

      ExpandImage

    • D. 

      AutoSizeImage

  • 8. 
    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?
    • A. 

      TransactionScope.Completed = true;

    • B. 

      TransactionScope.Commit();

    • C. 

      TransactionScope.Complete();

    • D. 

      TransactionScope.IsCompleted = true;

  • 9. 
    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?
    • A. 

      ?CustomerName

    • B. 

      %CustomerName

    • C. 

      @CustomerName

    • D. 

      #CustomerName

  • 10. 
    Which function of the SqlCommand object must you use in order to execute an �INSERT� SQL Query?
    • A. 

      ExecuteScalar();

    • B. 

      ExecuteNonQuery();

    • C. 

      ExecuteReader();

    • D. 

      ExecuteCommand();

  • 11. 
    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?
    • A. 

      Use the Text property.

    • B. 

      Use the Tag property.

    • C. 

      Use the UserInfo property.

    • D. 

      Use the CustomData property.

  • 12. 
    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?
    • A. 

      System.Windows.Forms.UserControl

    • B. 

      System.Windows.Forms.Control

    • C. 

      System.Windows.Forms.WindowsControl

    • D. 

      System.Windows.Forms.Component

  • 13. 
    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?
    • A. 

      Text1.SetError(�invalid data�, ep1);

    • B. 

      Text1.SetError(ep1, �invalid data�);

    • C. 

      Ep1.SetError(Text1, �invalid data�);

    • D. 

      Ep1.SetError(�invalid data�, Text1);

  • 14. 
    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?
    • A. 

      Void return type, no parameter

    • B. 

      Object return type, no parameter

    • C. 

      Void return type, object parameter

    • D. 

      Object return type, object parameter

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

      XmlDocument doc = new XmlDocument("input.xml");

    • B. 

      XmlDocument doc = new XmlDocument(); doc.Load("input.xml");

    • C. 

      XmlDocument doc = new XmlDocument(); doc.Open("input.xml");

    • D. 

      XmlDocument doc = new XmlDocument(); doc.File = "input.xml";

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

      System.Net.WebClient

    • B. 

      System.Net.HttpClient

    • C. 

      Sytem.Net.InetClient

    • D. 

      System.Net.HttpWebRequest

    • E. 

      System.Net.IPClient

  • 17. 
    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?
    • A. 

      Thread T = new Thread(new ThreadStart("ThreadedFunction")); T.Start(filename);

    • B. 

      Thread T = new Thread(new ThreadStart("ThreadedFunction", filename)); T.Start();

    • C. 

      Thread T = new Thread(new ParameterizedThreadStart("ThreadedFunction")); T.Start(filename);

    • D. 

      Thread T = new Thread(new ParameterizedThreadStart("ThreadedFunction", filename)); T.Start();

  • 18. 
    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?
    • A. 

      DataRelation dr = new DataRelation("relationname", dcoi, dco); ds1.Relations.Add(dr);

    • B. 

      DataRelation dr = new DataRelation("relationname", dco, dcoi); ds1.Relations.Add(dr);

    • C. 

      DataRelation dr = new DataRelation("relationname", dcoi, dco); ds1.Relations.Add("relationname");

    • D. 

      DataRelation dr = new DataRelation("relationname", dco, dcoi); ds1.Relations.Add("relationname");

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

      XmlValidatingReader

    • B. 

      XmlDictionaryReader

    • C. 

      XmlReader

    • D. 

      XmlSchemaReader

  • 20. 
    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?
    • A. 

      &=

    • B. 

      =

    • C. 

      +=

    • D. 

      |=

  • 21. 
    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?
    • A. 

      DataTable.Columns.Add("TotalPrice", typeof(Double), "Quantity" * "UnitPrice");

    • B. 

      DataTable.Columns.Add("TotalPrice", typeof(Double), Quantity * UnitPrice);

    • C. 

      DataTable.Columns.Add("TotalPrice", typeof(Double), "Quantity * UnitPrice");

    • D. 

      DataTable.Columns.Add("TotalPrice", typeof(Double), "Quantity", "UnitPrice");

  • 22. 
    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?
    • A. 

      Name

    • B. 

      AccessibleName

    • C. 

      Description

    • D. 

      AccessibleDescription

    • E. 

      AccessibleRole

  • 23. 
    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?
    • A. 

      MouseOver and MouseOut

    • B. 

      MouseHover and MouseOut

    • C. 

      MouseOver and MouseLeave

    • D. 

      MouseHover and MouseLeave

  • 24. 
    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?
    • A. 

      RowUpdating

    • B. 

      RowUpdated

    • C. 

      RowChanging

    • D. 

      RowChanged

  • 25. 
    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 don�t get committed to the database?
    • A. 

      Trans.Abort();

    • B. 

      Conn.AbortTransaction();

    • C. 

      Trans.Rollback();

    • D. 

      Conn.RollbackTransaction();

  • 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?
    • A. 

      ReadCommitted

    • B. 

      ReadUncommitted

    • C. 

      Serializable

    • D. 

      Chaos

  • 27. 
    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?
    • A. 

      Cb1.DataBindings.Add(dt1, �Checked�);

    • B. 

      Cb1.DataBindings.Add(dt1, �IsApproved�, �Checked�);

    • C. 

      Cb1.DataBindings.Add(�Checked�, dt1, �IsApproved�);

    • D. 

      Cb1.DataBindings.Add(�Checked�, �dt1.IsApproved�);

  • 28. 
    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?
    • A. 

      WaitOne

    • B. 

      Reset

    • C. 

      Set

    • D. 

      Close

  • 29. 
    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?
    • A. 

      VersionNTName = �XP�;

    • B. 

      VersionNT = 501;

    • C. 

      VersionNTName >= �XP�;

    • D. 

      VersionNT >=500;

  • 30. 
    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?
    • A. 

      PercentageChanged

    • B. 

      WorkDone

    • C. 

      ProgressChanged

    • D. 

      ProgressPercentageIncreased

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

      Create a Setup Application

    • B. 

      Use XCOPY to copy the files

    • C. 

      Create a CAB project

    • D. 

      Use ClickOnce.

  • 32. 
    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?
    • A. 

      SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; int rowcount = cmd.ExecuteScalar();

    • B. 

      SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; int rowcount = cmd.ExecuteNonQuery();

    • C. 

      SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; SqlDataReader dr = cmd.ExecuteReader(); int rowcount = dr.RowCount;

    • D. 

      SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; int rowcount; cmd.ExecuteNonQuery(out rowcount);

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

      WorkCompleted

    • B. 

      RunWorkerCompleted

    • C. 

      ProgressCompleted

    • D. 

      ProgressPercentageCompleted

  • 34. 
    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?
    • A. 

      Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr");

    • B. 

      Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = new CultureInfo("fr");

    • C. 

      Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture += new CultureInfo("fr");

    • D. 

      Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture += new CultureInfo("fr");

  • 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?
    • A. 

      Handle the KeyPress event

    • B. 

      Override the OnKeyPress method

    • C. 

      Handle the KeyDown event

    • D. 

      Override the OnKeyDown method.

  • 36. 
    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?
    • A. 

      Apply the DefaultEvent attribute to the class that represents your control. Specify the name of the event.

    • B. 

      Apply the DefaultEvent attribute to the class that represents your control. Specify the name of the event handler.

    • C. 

      Apply the DefaultEvent attribute to the event. Pass a value of true.

    • D. 

      Apply the DefaultEvent attribute to the event. Don�t pass any parameter.

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

      Bg1.DoWork(functionname); bg1.RunWorkerAsync();

    • B. 

      Bg1.DoWork = functionname; bg1.RunWorkerAsync();

    • C. 

      Bg1.DoWork += delegate { functionname(); }; bg1.RunWorkerAsync();

    • D. 

      Bg1.RunWorkerAsync(functioname); bg1.DoWork();

  • 38. 
    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 progressbar�s value increase?
    • A. 

      By the amount specified in the Parameter to PerformStep()

    • B. 

      By the amount specified in the Step property

    • C. 

      By the amount specified in the IncrementStep property.

    • D. 

      By 1.