SOLUTIONS LATEST UPDATE 2026
What will the following method return?
private string GetName(int customerID, bool readOnly) - Answers a string
What keyword do you code at the beginning of a method if you only want it to be
available within the current class? - Answers private
What keyword do you code for the return type of a method that doesn't return any
data? - Answers void
For each parameter in the parameter list for a method, you must code: - Answers the
data type of the parameter followed by the name of the parameter
When you call a method, the arguments you pass to it - Answers must be declared
with data types that are compatible with the parameters
The signature of a method is formed by the - Answers name of the method and its
parameter list
If you pass a variable by reference, the called method - Answers can change the value
of the variable in the calling method
If you pass a variable by value, the called method - Answers can't change the value of
the variable in the calling method
If you declare a parameter for a method as optional, - Answers the parameter must be
assigned a default value
Which of the following code snippets passes an argument by name?
subtotal:subtotal
subtotal:=subtotal
subtotal=subtotal
subtotal=:subtotal - Answers subtotal:subtotal
Which of the following is not an advantage of passing arguments by name? -
Answers You don't have to know the name of the associated parameter
To generate an event handler for a control event, you can display the Events list for
the control and then - Answers double-click on the event
Once you display the list of events for a control, you can wire an existing event
handler to any event by - Answers selecting the event handler from the drop-down
list for the event
To generate a method call and a method from existing code, you can use a feature
called - Answers refactoring
When coding an expression-bodied method, what operator do you code after the
method signature? - Answers lambda operator (=>)
To define a tuple as the return type for a method, you define its members by
separating them with commas and enclosing them in... - Answers parentheses - ()
To delete an event handler, you not only have to delete its method but also its -
Answers event wiring
If you have an int variable named yrs and two decimal variables named prin and rate,
which statement can you use to call the method with the following method
declaration?
private decimal GetInterest(int years,
decimal interestRate, decimal principle)
decimal interest = GetInterest(yrs, rate, prin);
decimal interest = GetInterest(rate, prin, yrs);
, int interest = GetInterest(yrs, rate, prin);
int interest = GetInterest(rate, prin, yrs); - Answers decimal interest = GetInterest(yrs,
rate, prin);
If the following GetInterest() method uses a decimal variable named interest to store
the interest amount, which statement can you use to return the interest amount?
private decimal GetInterest(int years,
decimal interestRate, decimal principle)
Return Interest;
return dec interest;
return decimal interest;
return interest; - Answers return interest;
Which of the following statements would you use to call a private method named
InitializeVariables() that accepts no parameters and doesn't return a value?
InitializeVariables(void);
void InitializeVariables();
InitializeVariables();
void InitializeVariables(void); - Answers InitializeVariables();
Which of the following statements would you use to pass a variable named message
by reference to a method named DisplayMessage?
DisplayMessage(reference message);
DisplayMessage(ref message);
DisplayMessage(message reference);
DisplayMessage(message ref);
DisplayMessage(message); - Answers DisplayMessage(ref message);
Which statement calls a method in the current form named SetButtons() and passes it
a false value?
this.SetButtons(false);
this.SetButtons(disable);
this.SetButtons(bool false);
this.SetButtons(value=false); - Answers this.SetButtons(false);
Which of the following declares a method named GetMessage() that returns a string
value and requires one decimal parameter named currentBalance and is only available
within the current form?
private void GetMessage(currentBalance)
private string GetMessage(currentBalance)
private string GetMessage(decimal currentBalance)
protected string GetMessage(decimal currentBalance) - Answers private string
GetMessage(decimal currentBalance)
Which of the following declares a private method named GetMessage() that returns a
string value and requires a string parameter named fullName and a decimal parameter
named currentBalance?
private string GetMessage(fullName : currentBalance)
private string GetMessage(fullName, currentBalance)
private string GetMessage(string fullName : decimal currentBalance)