Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 15 pages
Exam (elaborations)

ISTM 250 - CONCEPTUAL EXAM 2 QUESTIONS WITH VERIFIED SOLUTIONS LATEST UPDATE 2026

Document preview thumbnail
Preview 2 out of 15 pages

ISTM 250 - CONCEPTUAL EXAM 2 QUESTIONS WITH VERIFIED 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) private string GetMessage(string fullName, decimal currentBalance) - Answers private string GetMessage(string fullName, decimal currentBalance) Which of the following is a shorter way to code the following GetTotal() method? private decimal GetTotal(decimal subtotal, decimal tax) { return subtotal + tax; } private decimal GetTotal(subtotal, tax) { return subtotal + tax } private decimal GetTotal(decimal subtotal, decimal tax) { subtotal + tax } private decimal GetTotal(decimal subtotal, decimal tax) return subtotal + tax; private decimal GetTotal(decimal subtotal, decimal tax) = subtotal + tax; - Answers private decimal GetTotal(decimal subtotal, decimal tax) = subtotal + tax; Which of the following declares a method named GetTotals() that returns a tuple that has two members named TotalQty and TotalAmt? private [int TotalQty, decimal TotalAmt] GetTotals(int year) {} private (int TotalQty, decimal TotalAmt) GetTotals(int year) {} private [TotalQty, TotalAmt] GetTotals(int year) {} private (TotalQty, TotalAmt) GetTotals(int year) {} - Answers private (int TotalQty, decimal TotalAmt) GetTotals(int year) {} Which of the following statements would be used to wire the Click event of a button named btnClear to an event handler named ClearControls()? Clear.Click += System.EventHandler(this.ClearControls); Clear.Click += new System.EventHandler(this.ClearControls); this.ClearControls += System.EventHandler(Clear.Click); this.ClearControls += new System.EventHandler(Clear.Click); - Answers Clear.Click += new System.EventHandler(this.ClearControls); Given a text box named txtNum, which of the following statements may cause a format exception? string s = txtNum.Text; if (txtNum.Text == null) newValue = 0; if (txtNum.Text == "") newValue = 0; d = Convert.ToDecimal(txtNum.Text); - Answers decimal d = Convert.ToDecimal(txtNum.Text); The process of checking user entries to make sure they're valid is called - Answers data validation The list of methods that were called before an exception occurred is called the - Answers stack trace Exceptions are objects that are created from the _________________ class or one of its subclasses. - Answers Exception If a value that's assigned to an int variable is too large to be stored in it, what type of exception occurs? - Answers OverflowException If a text box entry can't be converted to a numeric data type, what type of exception occurs? - Answers FormatException To display a dialog box, you can use the Show() method of - Answers the MessageBox class In a try-catch statement, a catch block for the Exception class can be used to catch - Answers any exceptions that aren't caught by previous catch blocks Two properties of an object created from the Exception class are - Answers Message and StackTrace When you catch an exception, which of its properties can you use to get a description of it? - Answers Message When you catch an exception, what method can you use to get the type of the exception? - Answers GetType() In a try-catch statement, the finally block is executed - Answers whether or not an exception occurs or a catch block is executed What statement causes an exception to occur? - Answers throw You typically do not throw an exception - Answers when invalid data is detected When validating data entered into the text boxes of a form, it is notcommon to check whether - Answers all text entries are non-numeric An OverflowException can be avoided by a type of data validation known as - Answers range checking You may want to code generic methods for data validation because - Answers they allow you to reuse your data validation code To determine the cause of an exception, you can use the name of the exception class that's displayed use the error message that's displayed use the information in the stack trace all of the above - Answers all of the above The code within a catch block is executed when - Answers the code in the try block throws an exception Which method of the Decimal class returns a false value if the entry can't be converted instead of throwing an exception? - Answers TryParse() Consider the code that follows. What does it do? string value = "2"; try { int num = Convert.ToInt32(value); } MessageBox.Show("Valid integer"); catch(FormatException) { MessageBox.Show("Invalid integer"); } - Answers The code doesn't compile Consider the following code: private void btnCalculate_Click(object sender, System.EventArgs e) { decimal weightInPounds = 0m; try { weightInPounds = Convert.ToDecimal(txtPounds.Text); if (weightInPounds 0) { decimal weightInKilos = weightInPounds / 2.2m; lblKilos.Text = weightInKilos.ToString("f2"); } else { MessageBox.Show("Weight must be greater than 0.", "Entry error"); txtPounds.Focus(); } } catch(FormatException) { MessageBox.Show("Weight must be numeric.", "Entry error"); txtPounds.Focus(); } } What type of data validation does this program do? - Answers range checking and valid data type checking Consider the following code: private void btnCalculate_Click(object sender, System.EventArgs e) { decimal weightInPounds = 0m; try { weightInPounds = Convert.ToDecimal(txtPounds.Text); if (weightInPounds 0)

Content preview

ISTM 250 - CONCEPTUAL EXAM 2 QUESTIONS WITH VERIFIED
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)

Document information

Uploaded on
September 7, 2026
Number of pages
15
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$11.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
joshuawesonga22
3.5
(14)
Sold
121
Followers
2
Items
15186
Last sold
3 days ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions