Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.) A mandatory parameter ______________ a.) Is any argument sent to a method b.

ID: 3551864 • Letter: 1

Question

1.) A mandatory parameter ______________

a.)    Is any argument sent to a method                        b.) is preceded by the keyword man

c.)    Requires an argument to be sent from a method call        d.) All of the above are true


2.)   Which is not a type of method parameter in C#?

a.)    Value                     b.) reference

c.) forensic                 d.) output


3.) Which type of method parameter receives the address of the variable passed in?


a.)    A value parameter                  b.) a reference parameter

c.) an output parameter                d.) two of the above


4.) When you declare a value parameter, you precede its name with ___________


a.)    Nothing                b.) a data type

c.) the keyword val and a data type              d.) the keyword ref and its data type


5.) Assume that you declare a variable as int x =100; and correctly pass in to a method with the declaration private static void IncreaseValue(ref int x). There is a single statement within the IncreaseValue() method: x = x + 25;. Back in the Main() method, after the method call, what is the value of x?


a.)    100                       b.) 125

c.) It is impossible to tell.                   D.) the program will not run


6.) Assume that you declare a variable as int x =100; and correctly pass in to a method with the declaration private static void IncreaseValue(int x). There is a single statement within the IncreaseValue() method: x = x + 25;. Back in the Main() method, after the method call, what is the value of x?


a.) 100                       b.) 125


c.) It is impossible to tell.                   d.) The program will not run



7.) Which of the following is a difference between a reference parameter and an output parameter?

a.) A reference parameter receives a memory address; an output parameter does not.

b.) A reference parameter occupies a unique memory address; an output parameter does not.

c.) A reference parameter requires an initial value; an output parameter does not.

d.) A reference parameter does not require an initial value; an output parameter does.


8.) A parameter array____________

a.) Is declared using the keyword params

b.) Can accept any number of arguments of the same data type

c.) Both of these are true

d.) Neither of these is true

9.) Assume that you have declared a method with the following header: private static void DisplayScores(params int[] scores) Which of the following methods calls is valid?

a.) DisplayScores(20);

b.) DisplayScores(20, 33);

c.) DisplayScores(20, 30, 90);

d.) All of the above are valid


10.) Correctly overloaded methods must have the same ___________

a.) A return type

b.) Identifier

c.) Parameter list

d.) All of the above


11.) Methods are ambiguous when they ______________

a.) Are overloaded

b.) Are written in a confusing manner

c.) Are indistinguishable to the compiler

d.) Have the same parameter type as their return type


12.)Which of the following pairs of method declarations represent correctly overloaded methods?

a.) private static void MethodA(int a)

private static void MethodA(int b, double c)

b.) private static voidMethodB(double d)

private static void MethodB()

c.) private static doubleMethodC(int e)

private static double MethodC(int f)

d.) Two of these are correctly overloaded methods.

13.)Which of the following pairs of method declarations represent correctly overloaded methods?

a.)     private static voidMethod(int a)

private static voidMethod(int b)

b.)    private static voidMethod(double d)

private static intMethod()

c.)    private static doubleMethod(int e)

private static intMethod(int f)

d.)   Two of these are correctly overloaded methods.

14.) The process of determining which overloaded version of a method to execute is overload ___________

a.)    Confusion

b.)    Infusion

c.)    Revolution

d.)   Resolution

15.) When one of a method

Explanation / Answer



1.C

2. C

3. B

4. B

5. B

6. A

7. D

8. C

9. D

10. B

11. C

12. D

13. D

14. D

15. B

16. C


In this if the c part had data type for double it would have been legal call.

And hence the answer would have been D.

17. C

18. A

19. D

20. B