1. (TCO 8) Which words belong in the blank to indicate that the method Calculate
ID: 3682434 • Letter: 1
Question
1. (TCO 8) Which words belong in the blank to indicate that the method CalculateTaxes() returns no value to the calling method, and that the method has no restrictions on accessibility? _____ CalculateTaxes() (Points : 3) private static null public static null private static void public static void
Question 2.2. (TCO 8) Which is a correct heading for a method that accepts two integers and returns their difference? (Points : 3) public static int CalcDiff(number1, number2); public static void CalcDiff(int number1, number2); public static int CalcDiff(int number1, number2); public static int CalcDiff(int number1, int number2);
Question 3.3. (TCO 8) Suppose your code has two variables declared as: double myNumber = 2.17; int myInt = 6; Which of the following would be a legal call to this method: public static double getWidgets(int num1, double num2) (Points : 3) double getWidgets(myInt, myNumber); getWidgets (myInt, myNumber); myInt = getWidgets(myNumber); double newWidget = getWidgets(myInt, myNumber);
Question 4.4. (TCO 7) Which is a valid overloaded version of this method: void SendGrade(double val1) (Points : 3) void SendMyGrade(double val1) int SendMyGrade(double val1) char SendGrade(double val1) int SendGrade(int val1)
Question 5.5. (TCO 7) Which is not a valid name for a method or function? (Points : 3) MyMod5 mod_1 mod_@7 MyMod_7
Question 6.6. (TCO 8) The following method has _____ input parameter(s) and returns _____ to the calling method. Public static double GetResult(int value1, ref double value2) (Points : 3) 1, an integer 2, no value 2, a double 4, no value
Question 7.7. (TCO 7) What does it mean to say a variable is local to a method? (Points : 3) Only Main() and the method where the variable is declared can see and use it. Only the method where
the variable is declared can see and use it. No methods can see or use it. Every method can use it.
Question 8.8. (TCO 8) Because Main() and testMeth() store myVar in _____, the output of this code will be _____. static void Main() { int myVar = 6; Console.Write("{0} ", myVar); myVar++; testMeth(myVar); myVar++; Console.Write("{0} ", myVar); Console.Read(); } public static void testMeth(int myVar) { Console.Write("{0} ", myVar); myVar++; } (Points : 3) different memory locations, 6 7 8 the same memory location, 6 7 8 different memory locations, 6 7 9 the same memory location, 6 7 9
Question 9.9. (TCO 8) Because Main() and testMeth() store myVar in _____, the output of this code will be _____. static void Main() { int myVar = 6; Console.Write("{0} ", myVar); myVar++; testMeth(ref myVar); Console.Write("{0} ", myVar); Console.Read(); } public static void testMeth(ref int myVar) { Console.Write("{0} ", myVar); myVar++; } (Points : 3) different memory locations, 6 7 7 the same memory location, 6 7 7 different memory locations, 6 7 8 the same memory location, 6 7 8
Question 10.10. (TCO 7) Which is not a Predefined C# method? (Points : 3) Console.ReadLine(); Console.PrintLine(); Math.Cos(); Math.Sqrt(); Question 11. 11. (TCO 8) Write a C# program to calculate 2% interest on a savings account balance. Main() stores a balance of $1000.00 in an appropriate variable and passes it by-value to a method called “calcInterest.” calcInterest calculates the interest and returns it to Main() by-value. (Note: interest = .02 * balance). Main() prints out the balance and the interest. (Points : 5)
Explanation / Answer
1) public static void
2) public static int CalcDiff(int number1, int number2);
3) getWidgets (myInt, myNumber);
4) int SendGrade(int val1)
5) mod_@7
6) returns a double
7) Only Main() and the method where the variable is declared can see and use it.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.