C1S170 Week 4 Sample Quiz in C# – 35/35 marks
_____ CalculateTaxes()
private static null
public static null
private static void
public static void
2. Question : (TCO 8) Which is a 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:
public static double getWidgets(int num)
getWidgets(m);
getWidgets(r)
m = getWidgets(r);
r = getWidgets(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.
8. Question : (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 8
9. Question : (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.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.