Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
COMPLETION
1. When youre using C#, the normal way to handle the events for a web server control is to use an
________________ that identifies the event and the event handler that should handle it.
ANS:
attribute
OnEvent attribute
OnEvent attribute
PTS: 1
2. The event handlers for the Click and Command events of any of the button controls are only executed
during a ________________.
ANS: postback
PTS: 1
3. To determine where the user clicked within an image button control, you can use the properties of the
___________ argument thats passed to the event handler.
ANS: e
PTS: 1
4. To determine which of several buttons were clicked when you use the Command event, you can set
and check the ____________ or CommandArgument attribute of the buttons.
ANS: CommandName
PTS: 1
5. The radio buttons on a form are normally assigned to one or more __________.
ANS: groups
PTS: 1
6. The CheckedChanged event is fired whenever the status of a _____________ control changes.
ANS:
check box
checkbox
PTS: 1
7. The CheckedChanged event is fired when the status of a _____________ control changes to checked.
ANS: radio button
PTS: 1
8. To refer to the items in any list control, you can use the ___________ of the list item collection.
ANS: indexer
PTS: 1
9. To get the value of the selected item in any list control, you can use the ____________ property of the
control.
ANS: SelectedValue
PTS: 1
10. To determine whether an item in an item list collection has been selected, you can use the
______________ property of that item.
ANS: Selected
PTS: 1
11. Write C# code that refers to the third item in a bulleted list control named blstProducts.
_________________________________________________________
ANS: blstProducts.Items[2]
PTS: 1
12. The hyperlink control provides an easy way to _____________ to another page.
ANS:
link
transfer
navigate
PTS: 1
13. The calendar control provides an easy way to get a ______________ from the user.
ANS: date
PTS: 1
MULTIPLE CHOICE
1. Which of the following cant you do if you use an OnEvent attribute of a control to point to the related
event handler?
a. give the event handler any name you want
b. use the event handler to handle more than one type of event
c. declare the event handler with private scope
d. use the event handler to handle more than one controls events
ANS: C PTS: 1
2. When the user clicks a button, link button, or image button control, the page is posted back to the
server and
a. the Click event is raised
b. the Command event is raised
c. both the Click and Command events are raised
d. the Click event is raised and the Command event is raised if a value is specified for the
CommandName or CommandArgument attribute of the control
ANS: C PTS: 1
3. You can use the X and Y properties of the ImageClickEventArgs class to determine
a. where the user clicked on an image control
b. where the user clicked on an image button control
c. which image the user clicked on in a group of image controls
d. which button the user clicked on in a group of image button controls
ANS: B PTS: 1
5. The CheckedChanged event is raised for a radio button whenever the checked status of
a. any control in a group changes
b. any control in a group changes to checked
c. the control changes
d. the control changes to checked
ANS: D PTS: 1
6. Which of the following expressions would you use to get the value of the item thats selected in a list
box named lstMonth?
a. lstMonth.Items.Selected c. lstMonth.Selected.Value
b. lstMonth.Items.Selected.Value d. lstMonth.SelectedItem.Value
ANS: D PTS: 1
7. You should assign different values to the Text and Value properties of a list item if you want to
a. assign an index value to the item
b. assign a key value to the item
c. store a different value for the list item than the one thats displayed
d. none of the above
ANS: C PTS: 1
8. Which of the following techniques can you use to load items into a drop-down list?
a. Use the Add method of the list item collection to add an item with the specified Text
property at the end of the collection
b. Use the Add method of the list item collection to add an item with the specified Value
property at the end of the collection
c. Use the Add method of the list item collection to add an item with the specified Text and
Value properties at the end of the collection
d. Use the Add method with an index argument to add an item with the specified Text at the
index location in the collection
ANS: A PTS: 1
9. You typically use the ListItem Collection Editor to add items to a list
a. if the Text and Value properties of the list items are the same
b. if the Text and Value properties of the list items are different
c. if the list items wont change
d. if the list items change frequently
ANS: C PTS: 1
11. The main difference between buttons, link buttons, and image buttons is
a. the way the CausesValidation attribute works
b. the way the CommandName attribute works
c. the way the controls are displayed on a form
d. the events that are fired when a control is clicked
ANS: C PTS: 1
14. To set the focus to a specific control when a form is first displayed, you
a. set the DefaultFocus attribute for the control to True
b. set the DefaultFocus attribute for the form to the name of the control
c. use the SetDefaultFocus method for the form in the event handler for its Load event
d. use the Focus method for the form to set the focus to the control
ANS: B PTS: 1
15. The difference between check box and radio button controls is that
a. only one check box in a group can be checked at the same time
b. only one radio button in a group can be checked at the same time
c. you can only use the Checked property to check whether a check box is checked
d. you cant have just one radio button on a form
ANS: B PTS: 1
16. Which statement best describes the aspx code for the bulleted list that follows?
17. Which statement best describes this event handler for a file upload control named uplCustList?
protected void btnUpload_Click(object sender, EventArgs e)
{
int sizeLimit = 5242880; // 5,242,880 is 5MB
if (uplCustList.HasFile)
{
if (uplCustList.PostedFile.ContentLength <= sizeLimit)
{
string path = "C:\\uploads\\" + uplCustList.FileName;
uplCustList.SaveAs(path);
lblMessage.Text = "File uploaded to " + path;
}
else
{
lblMessage.Text = "File exceeds size limit.";
}
}
}
a. If a file has been successfully uploaded by the control, the file is saved to a path on the
local drive.
b. If a file has been successfully uploaded by the control and is within the acceptable size
limit, the file is saved to a path on the local drive.
c. If a file has been successfully uploaded by the control and is within the acceptable size
limit, the file is saved to a path on the local drive with a name supplied by the user.
d. If a file has been successfully uploaded by the control and is within the acceptable size
limit, the file is saved to a path on the local drive with the same name as the uploaded file.
ANS: D PTS: 1