Exam 1

Ace your homework & exams now with Quizwiz!

Where would you typically place the code below? if (PreviousPage != null) { TextBox txtAmount = (TextBox)PreviousPage.FindControl("txtTotalCost"); lblCartAmount.Text = txtAmount.Text; }

In the page's Load event handler

To provide for unobtrusive validation, you can install the ____________________ package for unobtrusive validation.

NuGet

If the user enters data into one or more controls on a page that uses cross-page posting, you can use the _____________________ property to retrieve the data entered by the user.

PreviousPage

You can use snippets to help you enter all but one of the following. Which one is it?

XML Code

By default, ASP.NET sends the session ID to the browser in

a cookie

What character entity is created by the   character?

a space

If you're working alone on an application and you don't have access to a server computer, you're using

a standalone environment

Server controls: Determines whether the validation specified by the validation controls is done when a button control is clicked. The default value is True.

CausesValidation

The CheckedChanged event is fired whenever the status of a _____________ control changes.

Checked box

What event does Visual Studio generate code for when you double-click a button in the Form Designer?

Click

If a browser has JavaScript enabled, the validation controls do their validation on the _________.

Client

The img element that follows gets the image file from the images folder, which is <p><img src="../images/logo.gif" alt="Murach Logo"></p>

at the same level as the current folder

dec decTakeHome = 147m; string s = "$$$1,000.00"; foreach (char c in s) { if (c == '$') { int i = s.IndexOf(c); s = s.Remove(i, 1); decTakeHome++; lblTotalTakeHome.Text = s; lblTotalTakeHome.Text = (Convert.ToDecimal(lblTotal_TakeHome.Text) + decTakeHome).ToString("c"); } } What is the value of lblTotalTakeHome.Text after the statements above are executed?

"$1,150.00"

Code Example (based on in-class exercise) dec decTakeHome = 147m; string s = "$1,000.00"; foreach (char c in s) { if (c == '$') { int i = s.IndexOf(c); s = s.Remove(i, 1); decTakeHome++; lblTotalTakeHome.Text = s; lblTotalTakeHome.Text = (Convert.ToDecimal(lblTotal_TakeHome.Text) + decTakeHome).ToString("c"); } } What is the value of lblTotalTakeHome.Text after the statements above are executed?

$1,148.00

If a decimal variable named total has a value of 1234.56, what string will result from the following statement? string s = total.ToString("c2")

$1,234.56

Code Example 4-1 decimal a = 2.5m; decimal b = 4.0m; decimal c = 12.7m; int i = 4; int j = 8; int k = 17; (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? int x = i / j;

0

decimal a = 2.5m; decimal b = 4.0m; decimal c = 12.7m; int i = 4; int j = 8; int k = 17; (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? int x = i / j;

0

decimal a = 2.5m; decimal b = 4.0m; decimal c = 12.7m; int i = 4; int j = 8; int k = 17; (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? decimal x = i / j;

0.0

string s = "$1,000.00"; foreach (char c in s) { if (c == '$') { int i = s.IndexOf(c); s = s.Remove(i, 1); lblTotalTakeHome.Text = s; lblTotalTakeHome.Text = (Convert.ToDecimal(lblTotalTakeHome.Text) + decTakeHome).ToString("c"); } } What is the value of s after the code above is executed?

1,000.00

What is the value of sum after the following code is executed? int sum = 0; int lastnumber = 5; lstFor.Items.Clear(); for (int number = 1; number < lastnumber; number++) { sum += number; lstFor.Items.Add("Number:" + number + "Sum==>" + sum); }

10

How many times will the statements in the following while loop be executed? int number = 1; int sum = 0; int lastnumber = 10; lstWhile.Items.Clear(); while(number <= lastnumber) { sum += number; lstWhile.Items.Add("Number:" + number + "Sum==>" + sum); number++; }

10 times

What is the value of the futureValue variable after the statements in the following do-while loop have been executed one time? decimal monthlyInterestRate = .01m; int months = 10; decimal futureValue = 1000m; int i = 1; do { futureValue = futureValue * (1 + monthlyInterestRate); i++; } while (i < months);

1010

If orderTotal has a value of 50 and quantity has a value of 10, what is the value of discount after these statements are executed? if (quantity == 1) discount = 0; else if (quantity >= 3 && quantity < 10) discount = orderTotal * .1; else if (quantity > 10 && quantity <= 25) discount = orderTotal * .2; else discount = orderTotal * .3;

15

What is the value of sum after the following code is executed? int sum = 0; int lastnumber = 5; lstFor.Items.Clear(); for (int number = 1; number <= lastnumber; number++) { sum += number; lstFor.Items.Add("Number:" + number + "Sum==>" + sum); }

15

Code Example 4-1 decimal a = 2.5m; decimal b = 4.0m; decimal c = 12.7m; int i = 4; int j = 8; int k = 17; (Refer to Code Example 4-1.) What is the value of x after the following statements are executed? int x = 27; x -= i;

23

How many times will the statements in the following loop be executed? int number = 1; int sum = 0; int lastnumber = 5; lstWhile.Items.Clear(); do { sum += number; lstDoWhile.Items.Add("Number:" + number + "Sum==>" + sum); number++; } while (number < lastnumber);

4 times

How many times will the statements in the following while loop be executed? int number = 1; int sum = 0; int lastnumber = 10; lstWhile.Items.Clear(); while(number <= lastnumber) { sum += number; lstWhile.Items.Add("Number:" + number + "Sum==>" + sum); number++; number++; }

5 times

You can use all but one of the following techniques to run an application with debugging. Which one is it?

Right-click the starting page in the Solution Explorer and choose View in Browser.

Server controls: Indicates that the control will be processed on the server by ASP.NET.

Runat

To get the value of the selected item in any list control, you can use the ____________ property of the control.

SelectedValue

When would you typically use the RedirectPermanent method to display another page?

When the page has been moved or renamed

If you set the AutoPostBack property of a control to True, the page is posted back to the server

Whenever the value of the control changes

In a do-while loop, the Boolean expression is tested

after the loop is executed

When the user clicks a button, link button, or image button control, the page is posted back to the server and

both the Click and Command events are raised

Write C# code that refers to the third item in a check box list control named cblProducts.

cblProducts.Items[2]

To check whether a specific data type has been entered into a control, you can use a ______________ validator.

compare

If you want to run your own validation code for a control on the server, you can use a ____________ validator.

custom

Which of the following techniques can you use to load items into a drop-down list named ddlCarType?

ddlCarType.Items.Add("Toyota");

When the code that follows is loaded into the browser, it <h2>About this book</h2>

displays "About this book" in the default h2 format

The <a> element that follows <a href="update.html">Update</a>

displays "Update" as a link

You can use the Source view of the Web Forms Designer to

edit the asps code for a page

Consider the following code. We use the FindControl method to ____________. if (PreviousPage != null) { TextBox txtAmount = (TextBox)PreviousPage.FindControl("txtTotalCost"); lblCartAmount.Text = txtAmount.Text; }

get data from a previous page

The <a> element that follows goes to a web page <a href="books/javscript.html">JavaScript and DOM Scripting</a>

in a folder that is subordinate to the current page

When you use a custom validator, the validation is performed

in the ServerValidate event handler for the validator

Unlike a static web page, a dynamic web page

is generated by a program running on an application server

The benefit of using unobtrusive validation is that

it reduce the amount of JavaScript that's generated

When unobtrusive validation is used, the validation on the client is performed using a JavaScript library called ____________.

jQuery

Which statement is equivalent to the following statements? int intNumberWages = Convert.ToInt16(lblNumberWages.Text); intNumberWages++; lblNumberWages.Text = intNumberWages.ToString();

lblNumberWages.Text = (Convert.ToInt16(lblNumberWages.Text) + 1).ToString();

A ___________________ control makes it easier to add a group radio buttons to a form.

radio button list

To determine if an item in a check box list is selected, you

refer to the item by its index value and test its Selected property

string s = "$$1,000.00"; foreach (char c in s) { if (c == '$') { int i = s.IndexOf(c); s = s.Remove(____, ____); lblTotalTakeHome.Text = s; lblTotalTakeHome.Text = (Convert.ToDecimal(lblTotal_TakeHome.Text) + decTakeHome).ToString("c"); } } If we want to remove all "$" signs from the string "s" what should be added to the s = s.Remove (____, ____) statement above?

s = s.Remove(i, 1);

C# statements must end with a

semicolon-;

The IntelliSense feature of Visual Studio can help you enter all but one of the following. Which one is it?

snippets

by default, the <br> tag

starts a new line of text

You should assign different values to the Text and Value properties of a list item if you want to

store a different value for the list item than the one that's displayed

To determine if an item in a radio button list is selected, you

test the list's SelectedValue property

The title element in the head section of an HTML document specifies the text

that's displayed in the title bar of the browser

The CheckedChanged event is raised for a radio button whenever the checked property of

the button changes to checked

You should use HTML elements instead of server controls when

the contents of the controls aren't going to change

Which of the following can be tested by a regular expression validator?

the format of a social security number

Which statement is equivalent to the following statement? total = total + tax;

total +=tax;

In an Internet development environment, you use an FTP server to

transfer files between the client computer and the web server

If you want to display all of the error messages for the validators in one portion of a web page, you can use a ______________________ control.

validation summary


Related study sets

Lssn 13 Ch 11 How Genes are Controlled (Finals)

View Set

Marketing 3650 Ch. 7 Practice Test

View Set

Chapter 5, 6, 8 SmartBook Questions

View Set

Chapter 7: Working with the BASH Shell

View Set

OCE CHAPTER 14 (EXAM 5: 12, 14, 15)

View Set

Rights Interest & Estates: Ownership

View Set

Module 2 Chapter 32 Care of Critically Ill Pt. With Respiratory Problems

View Set

Honan, Chapter 28: Nursing Management: Patients With Urinary Disorders

View Set