Chapter 6, T/F

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A mathematical expression such as A * B cannot be passed as an argument to a method containing a value parameter.

False

A parameter variable can be accessed by any statement outside the method in which the parameter variable is declared.

False

Every method must have a nonempty parameter list.

False

If you are writing a method and you want it to receive arguments when it is called, you must equip the method with one or more access modifiers.

False

If you provide a default argument for the first parameter in a list, you do not need to provide default arguments for the remaining parameters.

False

In a general sense, a class is a collection of statements that performs a specific task.

False

Passing an argument by reference guarantees that the argument will not be changed by the method it is passed into.

False

Suppose you're using the debugger to step through a method, and you want to immediately return to the place in the program where the method was called. The Step Return command will accomplish this.

False

The debugger's Step Over command lets you view all statements inside a method being called by the current program statement.

False

The method header is always terminated with a semicolon.

False

The top-down design process is sometimes called stepwise engineering.

False

When calling a method and passing a variable as an argument, always write the data type and the variable name of the argument variable in the method call.

False

When the keyword void appears in the method header, it means the method will return a value.

False

ested if statements can be useful for modularizing input validation.

False

void methods are useful for simplifying complex conditions that are tested in decision and repetition structures.

False

A mathematical expression such as A * B cannot be passed as an argument to a method containing a reference parameter.

True

A method definition has two parts: a header and a body.

True

A method that has an output parameter must set the output parameter to some value before it finishes executing.

True

Default arguments must be literals or constants.

True

If a specific task is performed in several places in a program, a method can be written once to perform that task and then be executed any time it is needed.

True

In a method header, the name is always followed by a set of parentheses.

True

In general, the same naming rules that apply to variables also apply to methods.

True

Methods usually belong to a class, so you must write a method's definition inside the class to which it is supposed to belong.

True

Suppose you set a breakpoint inside a method named X. When you reach a statement that calls method X, the Step Over command will stop at the breakpoint.

True

The debugger's Step Into command lets you view all statements inside a method being called by the current program statement

True

The statements that make up the method body are enclosed inside a set of curly braces.

True

When a method is called, the program branches to that method and executes the statements in its body.

True

When a method is declared with the private access modifier, it can be called only by code inside the same class as the method.

True

When you call a method that has a reference parameter, you must also write the keyword ref before the argument.

True

When you call a method that has an output parameter, you do not need to assign an initial value to the argument variable.

True

When you call a method that has an output parameter, you must also write the keyword out before the argument.

True

When you pass an argument to a ref parameter, that argument must already be set to some value.

True

You can pass int arguments into int parameters, but you cannot pass double or decimal arguments into int parameters.

True

You can pass string literals as arguments to methods containing string parameters.

True

You can write methods that return any data type.

True

You have to write the data type for each parameter variable in a parameter list.

True


Ensembles d'études connexes

Marketing Segmentation and Target Market

View Set

Sport Management Exam 1 Chapters 1-5

View Set

Lacharity Chapter 5: Safety and Infection

View Set

Dispensing from ADS Cabinets (Ch 9)

View Set

Maternal Newborn Success: High Risk Antepartum Reveiw Questions

View Set

University Academic Integrity Quiz

View Set