SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Barbara Dolye
Chapter:
Methods And Behaviors
Exercise:
Exercises
Question:16 | ISBN:9781285096261 | Edition: 4

Question

If a method is to be used to enter two values that will be used later in the program,
which of the following would be the most appropriate heading and call?
a. heading: public void InputValues(out int val1, out int val2)
call: InputValues(out val1, out val2);
b. heading: public void InputValues(int val1, int val2)
call: InputValues(val1, val2);
c. heading: public void InputValues(ref int val1, ref int val2)
call: InputValues(ref val1, ref val2);
d. heading: public int int InputValues( )
call: val1 = InputValues( );
val2 = InputValues( );
e. none of the above

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

The correct answer is: a. heading: public void InputValues(out int val1, out int val2)
call: InputValues(out val1, out val2);

Explanation:

The method heading "void InputValues(out int val1, out int val2)" is used to enter two values that will be used later in the program  by call the method InputValues(out val1, out val2);

So, the correct answer is (a).

0 0

Discussions

Post the discussion to improve the above solution.