Exam 8: Advanced Method Concepts

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

To ensure that the original value of an argument passed to a method remains unchanged after returning from the method, you should use a reference parameter or an output parameter.

Free
(True/False)
4.9/5
(33)
Correct Answer:
Verified

False

What modifier is used to indicate that a parameter is used for output?

Free
(Multiple Choice)
4.9/5
(26)
Correct Answer:
Verified

D

What Visual Studio IDE feature can be used to discover information about methods you are using?

Free
(Multiple Choice)
4.9/5
(37)
Correct Answer:
Verified

B

What type of parameter requires that the argument used to call the method must have an assigned value?

(Multiple Choice)
4.8/5
(40)

What is a method considered to be when there is a potential for a situation in which the compiler cannot determine what method to use?

(Multiple Choice)
4.8/5
(45)

Under what circumstances can you return a reference from a method?

(Multiple Choice)
4.9/5
(36)

You cannot use the out or ref keywords when passing an array to a method.

(True/False)
4.8/5
(36)

When naming an argument in a method call using its parameter name, what must come before the value?

(Multiple Choice)
4.8/5
(38)

When adding optional parameters in a parameter list, what is a valid requirement?

(Multiple Choice)
5.0/5
(41)

Given the following program, write the InputMethod() method.It should read two values from the user and assign them to the int variables first and second, which are then printed out in the code shown below. using static System.Console; class InputMethodDemo { static void Main() { int first, second; InputMethod(out first, out second); WriteLine("After InputMethod first is {0}", first); WriteLine("and second is {0}", second); } }

(Essay)
4.9/5
(37)

Describe the similarities and differences among method versions when the method is overloaded.

(Essay)
4.8/5
(33)

A method can return at most one value to a method that calls it.

(True/False)
4.8/5
(38)

What type of parameter can be given a default value?

(Multiple Choice)
4.7/5
(37)

What statement regarding reference parameters is accurate?

(Multiple Choice)
4.9/5
(35)

Given the following two method signatures, explain the reasoning behind how the C# compiler determines which method version to invoke for the call MyMethod(12): private static void MyMethod(int a) private static void MyMethod(int a, char b = 'B')

(Essay)
4.9/5
(40)

What is the difference between a reference parameter and an output parameter?

(Essay)
4.7/5
(30)

Suppose that you create overloaded method versions with the following declarations: private static void MyMethod(double d) private static void MyMethod(float f) Would MyMethod() run if it is called with an integer argument? Describe how C# determines which, if either, method should run when MyMethod() is called.

(Essay)
4.9/5
(25)

Write the DisplayStrings() method called in the code below using a parameter array declared in the method header.The method should write its arguments in a single line, followed by a newline.What will the output be after running Main()? using static System.Console; class ParamsDemo { static void Main() { string[] names = {"Mark", "Paulette", "Carol"}; DisplayStrings("Ginger"); DisplayStrings("George", "Maria", "Thomas"); DisplayStrings(names); } }

(Essay)
4.9/5
(35)

When declaring a method, how any params keywords are permitted?

(Multiple Choice)
4.8/5
(37)

What should you utilize when you don't know how many arguments you might eventually send to a method?

(Multiple Choice)
4.9/5
(37)
Showing 1 - 20 of 39
close modal

Filters

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