Chapter 3 Two Truths & a Lie

Ace your homework & exams now with Quizwiz!

Two of the following statements are true, and one is false. Identify the false statement: a. In C#, a Main() method header can be written public static void Main(). b. In C#, a Main() method header can be written static void Main(string[] args). c. In C#, a Main() method header can be written static int main(string args).

c. In C#, a Main() method header can be written static int main(string args).

Two of the following statements are true, and one is false. Identify the false statement: a. The following is a usable C# method header:private static void MyMethod(double amt, sum) b. The following is a usable C# method header:private static void MyMethod2(int x, double y) c. The following is a usable C# method header:static void MyMethod3(int id, string name, double rate)

a. The following is a usable C# method header:private static void MyMethod(double amt, sum)

Two of the following statements are true, and one is false. Identify the false statement: a. When you write the declaration for a method that accepts a parameter, you need to include the parameter's data type within the method header. b. When you write the declaration for a method that accepts a parameter, you need to include the identifier of the argument that will be sent to the method within the method header. c. When you write the declaration for a method that accepts a parameter, you need to include a local identifier for the parameter within the method header.

B: When you write the declaration for a method that accepts a parameter, you need to include the identifier of the argument that will be sent to the method within the method header.

Two of the following statements are true, and one is false. Identify the false statement: a. A method header must contain declared accessibility. b. A method header must contain a return type. c. A method header must contain an identifier.

a. A method header must contain declared accessibility.

Two of the following statements are true, and one is false. Identify the false statement: a. You indicate that a method parameter can be an array element by placing a data type and identifier in the method's parameter list. b. You indicate that a method parameter must be an array by placing parentheses after the data type in the method's parameter list. c. Arrays are passed by reference; that is, the method receives the actual memory address of the array and has access to the actual values in the array elements.

b. You indicate that a method parameter must be an array by placing parentheses after the data type in the method's parameter list.

Two of the following statements are true, and one is false. Identify the false statement: a. A method is an encapsulated series of statements that carry out a task. b. Any class can contain an unlimited number of methods. c. All the methods that will be used by your programs have been written for you and stored in files.

c. All the methods that will be used by your programs have been written for you and stored in files.

Two of the following statements are true, and one is false. Identify the false statement: a. A method can return, at most, one value to a method that calls it. b. The data type used in a method's return statement must be the same as the return type declared in the method's header. c. If a method returns a value and you call the method, you must store the value in a variable that has the same data type as the method's parameter.

c. If a method returns a value and you call the method, you must store the value in a variable that has the same data type as the method's parameter.

Two of the following statements are true, and one is false. Identify the false statement: a. An advantage to using the IDE to create GUI programs is that many methods you need are generated automatically. b. As with any other methods, when you create a Click() method associated with a button in a GUI application, you do not need to reference the parameters within the method body. c. If you want a Click() method to add two variables, you must pass them in as parameters.

c. If you want a Click() method to add two variables, you must pass them in as parameters.


Related study sets

(Life) Retirement and other concepts

View Set

Post Partum Depression (mood and affect)

View Set

Chapter 17: Neurologic Emergencies

View Set

Chapter 6 - Long Term Memory Structure

View Set

SPCH 1321 - Business Communication 2019

View Set