Help With C# Questions
1 Functions or modules found in other languages are similar to _____in C#.
2 Which of the following is placed in a method heading to indicate that no value will be returned?
3 Which of the following modifiers is the most restrictive?
4 Which of the following identifiers follows the standard naming convention for a method?
A. Calculate Final Grade
5 Which of the following would be the most appropriate way to invoke the predefined
Floor( ) method found in the Math class?
public static double Floor(double)
A. answer = Floor(87.2);
B. answer = Math.Floor(87.2);
6 Given the following statement, what would be the best heading for the DetermineAnswer() method?
result = DetermineAnswer(27.83, aValue);
A. public void DetermineAnswer(27.83, aValue)
B. public int DetermineAnswer()
C. public int DetermineAnswer(double v l , int v2)
D. public double int DetermineAnswer()
E. public void DetermineAnswer(double v l , int v2)
7 After completing the called method's body, control is returned:
A. back to the location in the calling method that made the call
B. to the last statement in the method that made the call
C. to the first statement in the method that made the call
D. to the Main ( ) method
E. to the method that is listed next in the printed source code
8 Which of the following is a valid method call for DetermineHighestScore?
void DetermineHighestScore(int vall, int va12)
A. void DetermineHighestScore(int vall, int va12)
B. DetermineScore( int vall, int va12 )
C. DetermineHighestScore(vall, va12)
D. DetermineHighestScore(2, 3.5)
E. GetHighestScore( )
9 What is the signature of the following method?
public void SetNoOfSquareYards(double squareYards)
noOfSquareYards = squareYards;
A. public void SetNoOfSquareYards (double squareYards)
B. public SetNoOfSquareYards(double squareYards)
D. public SetNoOfSquareYards(double)
E. SetNoOfSquareYards (double)
10 Variables declared inside a method should be defined as _______
A. private member data
B. local variables
11 Given the call to the method ComputeCost ( ) shown below, which of the following would be the most appropriate heading for the method?
someValue = ComputeCost(27.3);
A. public static void ComputeCost(double aValue)
B. public static int ComputeCost()
C. public static double ComputeCost (int someValue)
D. public static int ComputeCost(double aValue)
E. public static int ComputeCost (int aValue)
12 The following isprobably an example of a ________
A. call to a value-returning method
B. call to a void method
C. method heading
D. method definition
E. call to a method with multiple arguments
13 If you follow the standard C# naming conventions, the local variable names:
A. follow the camel case convention
B. should use an action verb phrase
C. begin with an uppercase character
D. are named like namespace identifiers
E. are defined inside parenthesis of the method header
14 Which of the following would be a valid call to a method defined as shown below?
public static int void InitializeValues()
A. void InitializeValues();
C. int returnValue = InitializeValues();
15 Given the following method definition, what would be a valid call?
public static int GetData(out int aValue, ref int bValue)
A. somelntValue = GetData(aValue, bValue);
B. somelntValue = GetData(out aValue, ref bValue);
C. somelntValue = GetData(out, ref);
D. somelntValue = GetData(int out aValue, int ref bValue)
E. GetData(out aValue, ref bValue);
16 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 vall, out int va12)
call:InputValues (out vall, out va12 );
B. heading:public void InputValues (int vall, int va12 )
C. heading:public void InputValues (ref int vall, ref int va12)
call:InputValues (ref vall, ref va12);
D. heading:public int int InputValues()
call:val1 = InputValues();
va12 = InputValues();
E. none of the above
17 Which of the following is not a modifier in C#?
18 Given the following task, which would be the most appropriate method heading?
A method displays three integer values formatted with currency.
A. public static int int int DisplayValues()
B. public static int DisplayValues (int v l , int v2, int v3)
C. public static void DisplayValues()
D. public static void DisplayValues(int vl:C, int v2:C, int v3:C)
E. public static void DisplayValues(int vI, int v2, int v3)
19 Given the following task, which would be the most appropriate method heading?
A method receives three whole numbers as input.
The values represent grades.
They should be unchangeable in the methoD. The method should return the average with a fractional component.
A. static double DetermineGrade(int grade 1 , int grade2, int grade3)
B. static int DetermineGrade(int gradel, int grade2, int grade3)
C. static int int int DetermineGrade(double finalAverage)
D. static double DetermineGrade(ref int gradel, ref int grade2, ref int grade3)
E. static void DetermineGrade()
20 Given the following task, which would be the most appropriate method heading?
Results have been calculated for taxAmount and totalSales.
Write a method heading that accepts these values as input for display purposes.
A. public static DisplayResults()
B. public DisplayResults(double)
C. public static void DisplayResults()
D. public static void DisplayResul ts (double taxAmount, double totalSales)
E. public static void DisplayResul ts (taxAmount, totalSales)
21 Use the following method headings to answer the questions below:
public static int DetermineResult(int valuel, ref double value2)
public static void DisplayResult(int valuel, double value2)
public static int GetValue()
A. How many parameters does each method have?
B. What is the return type for each of the methods?
C. Which of the preceding methods will have a return statement as part of its body?
22 What will be produced from the following predefined Math class method calls?
D. Console.WriteLine( Math.Sqrt(81));
E. Console.WriteLine(Math.Min(-56, 56));
Re: Help With C# Questions
What help do you want?
Are you hoping we'll just give you the answers so that you won't have to do the legwork yourself and (shock horror) actually do some work and learn stuff?
|All times are GMT +5.5. The time now is 06:39.|