OOP Ch10 Quiz

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following message boxes is created by this statement:MessageBox.Show("Are you sure you want to exit?","Closing",MessageBoxButtons.YesNo,MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); Group of answer choices

mc028-2.jpg

What does the following code do?for (int i = 1; i < cboNumbers.Items.Count; i += 2){cboNumbers.Items[i] = "XXX";} A. It changes the first item in the combo box to "XXX". B. It changes every second item in the combo box to "XXX". C. It changes every item in the combo box to "XXX". D. It doesn't change any items in the combo box.

B. It changes every second item in the combo box to "XXX".

What is displayed in the text portion of the combo box cboNames after the following method is called?private void Select(){cboNames.Items.Clear();string[] names = {"Robbie", "Maria", "Sheldon"};foreach (string name in names){cboNames.Items.Add(name);}cboNames.SelectedIndex = 1;} A. Robbie B. Maria C. Sheldon D. Nothing is displayed

B. Maria

What event is raised when the user selects an item from the drop-down list of a combo box? A. SelectedIndex B. SelectedIndexChanged C. TextChanged D. SelectedItem

B. SelectedIndexChanged

What method do you use to display a modal form? A. ShowModal() B. ShowDialog() C. ShowForm() D. Show()

B. ShowDialog()

What happens if the event handler for a form's FormClosing event doesn't do anything? A. An exception is thrown. B. The form is closed. C. The form remains open. D. The form is minimized.

B. The form is closed.

What happens to radio buttons that are not placed in a group box? A. Each is placed its own group. B. They function as a separate group. C. They are disabled. D. They are automatically placed in the first group that appears on the form.

B. They function as a separate group.

A global using directive A. makes a namespace available to an entire file B. makes a namespace available to an entire app C. makes all using directives unnecessary D. makes all namespaces unnecessary

B. makes a namespace available to an entire app

To add items to a list box, you use A. the Add() method of the list box B. the Add() method of the Items collection of the list box C. the Text property of the list box D. the Text property of the Items collection of the list box

B. the Add() method of the Items collection of the list box

What will the cboNumbers combo box contain if the following method is called twice? private void Fill(){for (int i = 1; i < 5; i++){cboNumbers.Items.Clear();cboNumbers.Items.Add(i);}} A. 1, 2, 3, 4, 1, 2, 3, 4 B. 1, 2, 3, 4 C. 4, 4 D. 4

D. 4

If you want to load values into a combo box when a form is first displayed, where should you put the code that fills the combo box? A. In the event handler for the Load event of the form B. In the event handler for the Init event of the form C. In the Fill() method of the form D. In the Start() method of the form

A. In the event handler for the Load event of the form

What method in the Program class defines the starting point for an application? A. Main() B. Load() C. Start() D. Init()

A. Main()

Most developers code global using directives in a class file named A. GlobalUsings.cs B. Global.Usings.cs C. Using.cs D. Usings.cs

A. Usings.cs

How do you retrieve the selected item in a list box? A. With the SelectedItem property B. With the Selection property C. With the GetSelection() method D. With the GetSelectedItem() method

A. With the SelectedItem property

Which of the following statements turns on the value in a check box named chkSportFan? A. chkSportFan.Checked = true; B. chkSportFan.IsChecked = true; C. chkSportFan.Check(); D. chkSportFan.Enabled = true;

A. chkSportFan.Checked = true;

After you change the name of a form, you can use the Rename refactoring command to update the name of an event handler and its A. parameters B. wiring C. method signature D. return type

B. wiring

Which of the following statements starts a Windows Forms application by displaying a form named Form1? A. Program.Display(new Form1()); B. Program.Display(Form1); C. Application.Run(new Form1()); D. Application.Run(Form1);

C. Application.Run(new Form1());

What enumeration do you use to determine how the user responded to a dialog that's displayed using the Show method of the MessageBox class? A. MessageBoxResult B. DialogBoxResult C. DialogResult D. MessageResult

C. DialogResult

What is the primary difference in the use of radio button and check box controls? A. Two or more radio buttons can be used on a single form. B. Different properties are used to test whether the control is selected. C. Radio buttons work as a group; check boxes work independently. D. Check boxes can't be placed in a group box.

C. Radio buttons work as a group; check boxes work independently.

A modal form is A. a form that can operate in one of several modes B. a form that remains open throughout an application C. a form that must be closed before the user can continue using other forms D. a form that is not visible

C. a form that must be closed before the user can continue using other forms

What control do you use to create a group of radio buttons? A. button set B. button group C. group box D. border

C. group box

To change the name of a form, you can change the name of the form in the Solution Explorer and then A. change the name of the form in the Properties window B. use the Events windows to change the names of the event handlers for the form C. let Visual Studio automatically change any other uses of the form name D. change the name of the form in the Toolbox

C. let Visual Studio automatically change any other uses of the form name

Which of the following statements displays a custom dialog named preferencesForm? A. Display(preferencesForm); B. preferencesForm.ShowModal(); C. preferencesForm.ShowDialog(); D. preferencesForm.Display();

C. preferencesForm.ShowDialog();

The tab order determines the order in which A. the tabs in the Form Designer window are displayed B. the user must enter data into the controls on a form C. the controls on a form receive focus when the user presses the Tab key D. the controls are displayed on the form

C. the controls on a form receive focus when the user presses the Tab key

An easy way to change the tab order of several controls is to use A. the Properties window B. the Form Designer C. the TabIndex property D. Tab Order view

D. Tab Order view

You can use the Tag property of a form to get or set A. string data only B. numeric data only C. value types only D. any type of data

D. any type of data

Which of the following statements gets the value of the chkSendEmail check box? A. bool isEmailChecked = chkSendEmail.Items.Checked; B. bool isEmailChecked = chkSendEmail.Checked(); C. bool isEmailChecked = chkSendEmail.IsChecked; D. bool isEmailChecked = chkSendEmail.Checked;

D. bool isEmailChecked = chkSendEmail.Checked;

Which of the following statements selects the first item in a list box named lstDates? A. lstDates.Select; B. lstDates.SelectFirst(); C. lstDates.SelectedItem = ComboBox.First; D. lstDates.SelectedIndex = 0;

D. lstDates.SelectedIndex = 0;


Ensembles d'études connexes

Intro to Comm Lucian Lu Exam Prep

View Set

Primerica - Life Insurance Policies (AZ)

View Set

Inflation, Hyperinflation and Deflation

View Set

Labels, SDS's, Symbols, Hazards and Training

View Set

Cultural Anthropology chapter 16 & 17

View Set

integumentary A&P & practice questions

View Set

Real Estate Investments and Business Brokerage

View Set