Exam 7: Sub and Function Procedures

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

An event procedure is a Function procedure that is associated with a specific object and event.

(True/False)
4.8/5
(35)

A combo box's ____ property contains the value that appears in the text portion of the control.

(Multiple Choice)
4.8/5
(33)

Write the code for a Sub procedure named CalculateAverage that receives four decimal variables (the first three by value and the last one by reference ). The procedure should use the first three variables to calculate the average and then store the result in the fourth variable.

(Essay)
4.8/5
(28)

Problems - Correcting Logic and Code Errors The following sample of code contains errors. Rewrite the incorrect statements to correct all errors. Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing ' verify that the user wants to exit the application Dim dlgButton As DialogResult dlgButton = MessageBox.Show("Do you want to exit?", "Sample Program") ' if the No button was selected, don't close the form If dlgButton = DialogResult.Yes Then e.Cancel = True End If End Sub Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load ' fill combo box with values, then select default value For intNumber As Integer From 0 Thru 10 cboNumbers.Add(intNumber.ToString) Next intNumber cboNumbers.SelectedItem = First End Sub

(Essay)
4.9/5
(33)

The number of arguments listed in the Call statement's argumentList should agree with the number of parameters listed in the parameterList in the procedure header.

(True/False)
4.7/5
(28)

When you pass a variable ____ , the computer passes only the contents of the variable to the receiving procedure.

(Multiple Choice)
4.7/5
(39)

In most cases, the last statement within a function is the ____ expression.

(Multiple Choice)
4.8/5
(26)

The ____ keyword in a function header identifies the data type of the data being returned.

(Multiple Choice)
4.9/5
(35)

A ____ is similar to a list box in that it allows the user to select from a list of choices.

(Multiple Choice)
4.9/5
(40)

The syntax ____ assigns a return value to a variable.

(Multiple Choice)
4.9/5
(39)

An application needs to calculate sales tax for purchases. You decide to simplify the code by putting the sales tax calculation in a function. The returned value from the function is then added to the Subtotal, and the result is stored in the decTotal variable. Which of the following statements will call the GetSalesTax function and return a value to be used in the Total calculation?

(Multiple Choice)
4.7/5
(40)

Case-Based Critical Thinking Questions Case 1 - MTN Outdoor You have just started working for MTN Outdoor as a programmer. Your first assignment is to review and correct various code to use sub procedures and/or functions. An application calculates an ending inventory amount based on a beginning inventory amount, sales, and returns. You need to create a function to calculate the ending inventory using three passed Integer variables: intBegin, intSales, and intReturns. Which of the following procedure headers should be used?

(Multiple Choice)
4.9/5
(27)

What are the three main reasons programmers use independent Sub procedures?

(Essay)
4.9/5
(42)

A Function procedure does not return a value after performing its assigned task.

(True/False)
4.8/5
(31)

An application allows a user to scan a bar code of an item to determine the item price. A message that contains the item name and the item price should display. You need to create a Sub procedure to display the message. Which of the following procedure headers should be used?

(Multiple Choice)
4.8/5
(35)

What is the difference between a Sub procedure and a Function procedure?

(Essay)
4.8/5
(28)

____ styles of combo boxes are available in Visual Basic.

(Multiple Choice)
4.9/5
(32)

Which of the following statements will determine the number of items in the list portion of the Department combo box?

(Multiple Choice)
4.9/5
(48)

As you do with list boxes, you use the Items collection's ____ method to add an item to a combo box.

(Multiple Choice)
4.7/5
(40)

An application uses a message box to ask users whether they want to exit the application, and the return value is stored in the dlgButton variable. Write the statement needed to stop the computer from closing the form if the user selects the No button in the message box.

(Essay)
4.7/5
(34)
Showing 21 - 40 of 60
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)