Get Guided CIS170 Week 4 Quiz Sample in C Hash
1. Question : (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()
private static null
public static null
private static void
public static void
2. Question : (TCO 8) Which is the correct heading for a method that accepts a double and converts it to an integer?
public static int Convert(number);
public static int Convert(int number);
public static int Convert(double number);
public static double Convert(double number);
3. Question : (TCO 8) Suppose your code has two variables declared as:
double r = 3.2;
int m = 6;
Which of the following would be a legal call to this method:get widgetatic get widget widget(get widgetetWidgets(m);
getWidgets(r)
m = getWidgets(r);
r = get widget(m);
4. Question : (TCO 7) Which is a valid overloaded version of this method:
int CalculateScore(int val1, int val2)
void CalculateScore(int val1, int val2)
int CalculateMyScore(int val1, int val2)
int CalculateScore(double val1, int val2)
double CalculateScore(int val1, int val2)
5. Question : (TCO 7) Which is not a valid name for a method or function?
Mod67_1
mod_1
16_mod
mod1
6. Question : (TCO 8) The following method has _____ input parameter(s) and returns _____ to the calling method.
Public static int GetResult(int value1, double value2)
2, an integer
2, no value
an integer, an integer
1, an integer
7. Question : (TCO 7) What does it mean to say a variable is local to a method?
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.testedtion : (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);
testMeth(myVar);
myVar++;
Console.Write(“{0} “, myVar);
Console.Read();
}
public static void testMeth(int
myVar)
{
Console.Write(“{0} “, myVar);
myVar++;
}
different memory locations, 6 6 7
the same memory location, 6 6 7
different memory locations, 6 6 8
the same memory location, 6 6 8testedtion : (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);
myVar++;
Console.Write(“{0} “, myVar);
Console.Read();
}
public static void testMeth(ref int myVar)
{
Console.Write(“{0} “, myVar);
myVar++;
}
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
10. Question : (TCO 7) Which is not a Predefined C# method?
Console.Print();
Console.Write();
Math.Cos();
Math.Sin();
11. Question : (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.
Need Help with Quiz?
Are your exams around the corner? Are you thinking, I pay someone to take my online exam? Do you want someone to help you out in these dire times of yours? Welcome to Get Exam Done. We are an academic help service that connects professional academics to struggling students. We help students with their online exams by assisting them hands-on throughout the exam. It doesn’t matter what your subject is, we have experts in all of them. So, come aboard! Let’s address your take my exam online worries. We are available 24/7. You can call us anytime, talk about your online exam problems, and get solutions. For custom, help email us at [email protected] or WhatsApp us at +1(657)366-7486