Chapters 4, 5, 6, 13, 16

Ace your homework & exams now with Quizwiz!

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

$1,234.56

To concatenate two or more strings into one, you use this character:

&

Write an arithmetic expression that calculates the percent increase (or decrease) of the sales for the current year by using the values that are stored in two variables named lastYTDSales and thisYTDSales.

(thisYTDSales - lastYTDSales) / lastYTDSales * 100

Dim a As Decimal = 2.5D Dim b As Decimal = 4.0D Dim c As Decimal = 12.7D Dim i As Integer = 4 Dim j As Integer = 8 Dim k As Integer = 17 (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? Dim x As Decimal = i / j

0.0

Dim a As Decimal = 2.5D Dim b As Decimal = 4.0D Dim c As Decimal = 12.7D Dim i As Integer = 4 Dim j As Integer = 8 Dim k As Integer = 17 (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? Dim x As Integer = k Mod j

1

Which of the following is a valid Decimal literal?

30.0d

Dim a As Decimal = 2.5D Dim b As Decimal = 4.0D Dim c As Decimal = 12.7D Dim i As Integer = 4 Dim j As Integer = 8 Dim k As Integer = 17 (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? Dim x As Integer = j / CInt(a)

4

Dim a As Decimal = 2.5D Dim b As Decimal = 4.0D Dim c As Decimal = 12.7D Dim i As Integer = 4 Dim j As Integer = 8 Dim k As Integer = 17 (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? Dim x As Integer = k / (j - i)

4

Select VendorName, InvoiceNumber, InvoiceDate, InvoiceTotal From Vendors Inner Join Invoices On Vendors.VendorID = Invoices.VendorID Where InvoiceTotal >= 500 Order By VendorName Desc (Refer to code example 13-1.) How many columns will the result set have?

4

Dim a As Decimal = 2.5D Dim b As Decimal = 4.0D Dim c As Decimal = 12.7D Dim i As Integer = 4 Dim j As Integer = 8 Dim k As Integer = 17 (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? Dim x As Decimal = a + b

6.5

If you want to code a procedure that can only be called from the class that the procedure is in, you code ____________________ as the access modifier in the procedure declaration.

Private

What keyword do you code at the beginning of a procedure that's only available within the current class?

Private

Code the declaration for a private procedure named GetMessage that returns a string value and requires one Decimal parameter named currentBalance.

Private Function GetMessage(currentBalance As Decimal) As String

Code the declaration for a private procedure named DisplayMessage that requires a string parameter named name and a Decimal parameter named balance in that order, but doesn't return any data.

Private Sub DisplayMessage(name As String, balance As Decimal)

You can return a value from a function by assigning the value to the function name or by coding the value on a ____________________ statement.

Return

If the following GetInterest procedure uses a Decimal variable named interest to store the interest amount, which statement can you use to return the interest amount?

Return interest

Which of the following statements is not true about the following code? Dim total As Decimal = 0.0d Private Sub btnCalculate_Click(Sender As Object, e As EventArgs) Handles btnCalculate.Click Dim calculateCount As Integer = 0 . . End Sub

The variable calculateCount has module scope.

The Boolean data type stores a

True or False value

To modify the data in one or more rows of a table in a database, you use the SQL _______________ statement.

Update

What is the value of the cityState string after these statements are executed?

Wisconsin

Which of the following is not an advantage of passing arguments by name?

You don't have to know the name of the associated parameter

A system that divides the processing between the clients and the server is called

a client/server system

To store the databases of a client/server system, the server requires

a database management system

A reference type stores

a reference to an object

The SQL statements that insert, update, and delete data are known as ___________________ queries.

action

ADO.NET's disconnected data architecture

allows the database connection to be closed after each operation

Select VendorName, InvoiceNumber, InvoiceDate, InvoiceTotal From Vendors Inner Join Invoices On Vendors.VendorID = Invoices.VendorID Where InvoiceTotal >= 500 Order By VendorName Desc (Refer to code example 13-1.) If VendorName contains string data and InvoiceTotal contains decimal values, how will the result set be ordered?

alphabetically starting with Z

To assign a more precise numeric data type to a less precise numeric data type, you can code

an explicit cast

A join that returns records from related tables only if their related fields match is called

an inner join

An inner join combines data from two or more tables in which the related fields _____________.

are equal

The type of rounding that causes a number that's midway between two whole numbers to always be rounded to the even number is called _______________ rounding.

banker's

When a call statement passes a variable as an argument to a procedure by reference, the called procedure can change the value of the variable in the _________________ procedure.

calling

If you pass a variable by reference, the called procedure

can change the value of the variable in the calling procedure

Which of the following statements is not true? An ADO.NET dataset object

can store command objects

If you pass a variable by value, the called procedure

can't change the value of the variable in the calling procedure

Variables named according to camel notation

capitalize the first letter of every word after the first word

Write one statement that appends a comma, a space, and the value that's stored in a string variable named state to the existing variable named cityAndState.

cityAndState &= ", " & state

Each reference data type is defined by a _____________.

class

The fields in a relational database are called ______________________.

columns

Use the equals operator to write a statement that adds 1 to the value stored in a variable named count and assigns the result to the count variable.

count = count + 1

When you use the .NET data provider objects to retrieve data from a database, you can store the data in an object called a

dataset

To generate an event handler for a control event, you can display the Events list for the control and then

double-click on the event

When you use strict type semantics, you have to use ______________ casts for all narrowing conversions.

explicit

To format a number in number, currency, or percent format, you can use the Visual Basic ________________ for formatting.

functions

In the statement that follows, the value 123.45 is called a __________________.

literal value

A variable declared outside of any procedure has ___________________ scope.

module

A string literal that's continued onto two or more lines is called a ____________ string literal.

multi-line

When you call a procedure with a parameter list, the arguments in the argument list

must be declared with data types that are compatible with the parameters

The signature of a procedure is formed by the

name of the procedure and its parameter list

What type of data will the following procedure return?

nothing will be returned

If a row in one table is related to one or more rows in another table, the tables are said to have a

one-to-many relationship

If you declare a variable within a procedure, the variable will be available

only within that procedure

The values operated on by operators in an expression are called __________________.

operands

When you call a procedure, you must include the ________________ required by the procedure.

parameters

To override the order of precedence in an arithmetic expression, you can use

parentheses

What does a relational database use to uniquely identify each row in a table?

primary keys

Write an arithmetic expression that calculates the yearly interest earned on an amount that's stored in a Decimal variable named principalAmount at an interest rate that's stored in a Decimal variable named interestRate. (The interest rate is stored as a Decimal fraction like .055 for a rate of 5.5%.)

principalAmount * interestRate

A variable declared within a procedure has ___________________ scope.

procedure

To generate a calling statement and a procedure from existing code, you can use a feature called ________________.

refactoring

To use an event handler for more than one event, Visual Basic

refers to all the events that are handled in a single Handles clause

Each record in a relational database is called a ________________.

row

When you use a SQL statement to return a single value from a database, the value is called a _______________ value.

scalar

Code a single statement that creates a SQL Server parameter named ProductCode with the value in a variable named productCode and adds it to the collection of parameters in a command named selectCommand.

selectCommand.Parameters.AddWithValue("ProductCode", productCode)

Once you display the list of events for a control, you can wire an existing event handler to any event by

selecting the event handler from the drop-down list for the event

When you use the methods of the Math class, you don't create an object from the class. Instead, you use the _____________ methods of the class.

shared

Each value data type is defined by a ________________.

structure

Which of the following code examples passes an argument by name?

subtotal:=subtotal

The hardware components of a typical multi-user system are

the clients, the server, and the network

For each parameter in the parameter list for a procedure, you must code

the name of the parameter followed by the data type of the parameter

If you declare a parameter for a procedure as optional,

the parameter must be assigned a constant value as its default

You can use the AddHandler and RemoveHandler statements

to add or remove event wiring at run time

If you use banker's rounding with the Round method of the Math class, a positive number that ends in 5 is always rounded

to the nearest even number

Code a statement that calls a Function procedure named SalesTax, adds the result of this procedure to an existing variable named subtotal, and stores the result in an existing variable named total. Assume that the SalesTax procedure accepts the subtotal as a parameter, and use the Me keyword to indicate where the procedure can be found.

total = subtotal + Me.SalesTax(subtotal)

How could you rewrite the following sequence of statements as a single statement, assuming the temp1 variable is not required after these statements are executed?

total = total * (1.0 - discountPct)

The result set retrieved by the following Select statement contains rows that have Select Balance, Number From Accounts Where Balance < 0

two of the columns from the Accounts table where Balance is less than 0

Concurrency occurs when

two or more users retrieve and then try to update data in the same row of a table at the same time

Values that change during the execution of a program are usually stored in _________________.

variables

Converting data from a data type with a narrower range of possible values to a data type with a wider range of possible values is referred to as a _______________ conversion.

widening

To wire an event handler to an event, Visual Basic uses a ______________ clause in the procedure declaration.

Handles

Which of the following statements would you use to call a private procedure named InitializeVariables that accepts no parameters and doesn't return a value?

InitializeVariables()

To add a row to a table in a database, you use the SQL _______________ statement.

Insert

Which built-in data type stores only whole numbers?

Integer

Which of the following is not true about a table adapter?

It can contain a single query

Code a statement that calls a procedure in the current form named SetButtons that accepts a Boolean value, but does not return a value. Pass the value "False" to this procedure, and use the Me keyword to indicate where the procedure can be found.

Me.SetButtons(False)

Dim a As Decimal = 2.5D Dim b As Decimal = 4.0D Dim c As Decimal = 12.7D Dim i As Integer = 4 Dim j As Integer = 8 Dim k As Integer = 17 (Refer to Code Example 4-1.) What is the value of x after the following statements are executed? Dim x As Integer = 27 x -= i

23

Dim a As Decimal = 2.5D Dim b As Decimal = 4.0D Dim c As Decimal = 12.7D Dim i As Integer = 4 Dim j As Integer = 8 Dim k As Integer = 17 (Refer to Code Example 4-1.) What is the value of x after the following statement is executed? Dim x As Integer = i + j

12

Dim a As Decimal = 2.5D Dim b As Decimal = 4.0D Dim c As Decimal = 12.7D Dim i As Integer = 4 Dim j As Integer = 8 Dim k As Integer = 17 (Refer to code example 4-1.) What is the value of x after the following statement is executed? Dim x As Decimal = Math.Round(c)

13

What does the following SQL statement add to the Terms table? Insert Into Terms (TermsDueDays) Values (90)

A row with a value of 90 for the TermsDueDays column

Which built-in data type is the most precise type for storing monetary values?

Decimal

Assuming total is a decimal variable and totalString is a string variable, which of the following statements is valid code for converting totalString to total?

Decimal.TryParse(totalString, total)

Given Decimal variables named length and width that contain the dimensions of a rectangle, write a statement that calculates the rectangle's area and saves the result in a new integer variable named area. (Be sure to cast the result from Decimal to Integer.)

Dim area As Integer = CInt(length * width)

Given two Decimal variables named a and b, write a statement that assigns the smaller of the two to a new Decimal variable named c.

Dim c As Decimal = Math.Min(a, b)

Given Double variables a and b that contain the lengths of the two short sides of a right triangle, write a statement that uses a method of the Math class to calculate the length of the third side. Save the result in a new Double variable named c. The formula is:

Dim c As Double = Math.Sqrt((a * a) + (b * b))

Write a statement that declares a variable named count as an integer type with a starting value of 10.

Dim count As Integer = 10

Assuming that a variable named sales contains a string that represents a valid Decimal number, which of the following statements is valid code for converting the sales string to a Decimal value?

Dim d As Decimal = Decimal.Parse(sales)

If you have an Integer variable named yrs and two Decimal variables named prin and rate, which statement can you use to call the procedure with the following procedure declaration?

Dim interest As Decimal = GetInterest(yrs, rate, prin)

Write a statement that declares a variable named isValid as a Boolean type with a starting value of False, and do that in the shortest way.

Dim isValid As Boolean

Given the following enumeration, which valid statement assigns the enumeration's first value to the variable named terms assuming that strict type semantics are in force? Enum Terms Net30Days Net60Days Net90Days End Enum

Dim terms As Integer = CInt(Terms.Net30Days)

Which of the following statements would you use to pass a variable named message by reference to a procedure named DisplayMessage?

DisplayMessage(message)


Related study sets

chapter 8: receivables, bad debt expense, and interest revenue

View Set

"The Black Cat" Literary Devices

View Set

Chapter 2 - Accounting for Materials

View Set

Quantitive Reasoning Ch. 13 Terms

View Set

Volunteer Standards of Conduct (Ethics) Training PART 3

View Set

02 Naked Eye Observations Study Set

View Set