Microsoft Certification 70-526 Practice Exam

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Muskad202
M
Muskad202
Community Contributor
Quizzes Created: 2 | Total Attempts: 7,117
Questions: 38 | Attempts: 1,944

SettingsSettingsSettings
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.

    Correct Answer
    B. MdiParent on Forms A,B and C; and IsMdiContainer on FormD.
    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.

    Rate this question:

  • 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

    Correct Answer
    C. Browsable
    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.

    Rate this question:

  • 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;

    Correct Answer
    D. Com.CommandText = �Customers�; com.CommandType = CommandType.TableDirect;
    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.

    Rate this question:

  • 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�;

    Correct Answer
    B. Bt1.Text = �&Go�;
    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.

    Rate this question:

  • 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

    Correct Answer
    C. 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.

    Rate this question:

  • 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

    Correct Answer
    C. Launch Conditions Editor
    Explanation
    The conditions in the Launch Conditions Editor are checked before the application installation starts.

    Rate this question:

  • 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

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

    Rate this question:

  • 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;

    Correct Answer
    C. TransactionScope.Complete();
    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.

    Rate this question:

  • 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�

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

    Rate this question:

  • 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();

    Correct Answer
    B. ExecuteNonQuery();
    Explanation
    You should use ExecuteNonQuery() to insert any SQL statement which does not return a dataset.

    Rate this question:

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

    Correct Answer
    B. Use the Tag property.
    Explanation
    You should use the Tag property to store custom data with a Control.

    Rate this question:

  • 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

    Correct Answer
    A. System.Windows.Forms.UserControl
    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.

    Rate this question:

  • 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);

    Correct Answer
    C. Ep1.SetError(Text1, �invalid data�);
    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.

    Rate this question:

  • 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

    Correct Answer
    C. Void return type, object parameter
    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.

    Rate this question:

  • 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";

    Correct Answer
    B. XmlDocument doc = new XmlDocument(); doc.Load("input.xml");
    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.

    Rate this question:

  • 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

    Correct Answer(s)
    A. System.Net.WebClient
    D. System.Net.HttpWebRequest
    Explanation
    You can use System.Net.WebClient and System.Net.HttpWebRequest to access websites on the internet using HTTP.

    Rate this question:

  • 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();

    Correct Answer
    C. Thread T = new Thread(new ParameterizedThreadStart("ThreadedFunction")); T.Start(filename);
    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.

    Rate this question:

  • 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");

    Correct Answer
    B. DataRelation dr = new DataRelation("relationname", dco, dcoi); ds1.Relations.Add(dr);
    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.

    Rate this question:

  • 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

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

    Rate this question:

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

      |=

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

    Rate this question:

  • 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");

    Correct Answer
    C. DataTable.Columns.Add("TotalPrice", typeof(Double), "Quantity * UnitPrice");
    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.

    Rate this question:

  • 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

    Correct Answer(s)
    B. AccessibleName
    D. AccessibleDescription
    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.

    Rate this question:

  • 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

    Correct Answer
    D. MouseHover and MouseLeave
    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.

    Rate this question:

  • 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

    Correct Answer
    C. RowChanging
    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.

    Rate this question:

  • 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();

    Correct Answer
    C. Trans.Rollback();
    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.

    Rate this question:

  • 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

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

    Rate this question:

  • 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�);

    Correct Answer
    C. Cb1.DataBindings.Add(�Checked�, dt1, �IsApproved�);
    Explanation
    The signature of the method is:
    control.DataBindings.Add(�control property�, datatable /dataset object, �column name in Datatable/Dataset�);

    Rate this question:

  • 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

    Correct Answer
    C. Set
    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.

    Rate this question:

  • 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;

    Correct Answer
    B. VersionNT = 501;
    Explanation
    VersionNT>=500 will be true for all versions greater than or equal to Windows 2000. VersionNTName is an invalid property.

    Rate this question:

  • 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

    Correct Answer
    C. ProgressChanged
    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.

    Rate this question:

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

    Correct Answer
    A. Create a Setup Application
    Explanation
    You should create a setup project in order to copy assemblies into the GAC.

    Rate this question:

  • 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);

    Correct Answer
    B. SqlCommand cmd = new SqlCommand(); cmd.CommandText = "DELETE FROM MyTable"; int rowcount = cmd.ExecuteNonQuery();
    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".

    Rate this question:

  • 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

    Correct Answer
    B. RunWorkerCompleted
    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.

    Rate this question:

  • 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");

    Correct Answer
    A. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr");
    Explanation
    The CurrentCulture property determines the formatting to use while displaying numbers, dates, and time. The CurrentUICulture property determines which localized resources to load.

    Rate this question:

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

    Correct Answer
    D. Override the OnKeyDown method.
    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.

    Rate this question:

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

    Correct Answer
    A. Apply the DefaultEvent attribute to the class that represents your control. Specify the name of the event.
    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.

    Rate this question:

  • 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();

    Correct Answer
    C. Bg1.DoWork += delegate { functionname(); }; bg1.RunWorkerAsync();
    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.

    Rate this question:

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

    Correct Answer
    B. By the amount specified in the Step property
    Explanation
    The progress bar's value will increase by the amount specified in the Step property.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 19, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 26, 2006
    Quiz Created by
    Muskad202

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.