1. (TCOs 1, 6) C# keywords include _____ and _____. (Points : 5)

        case, for

        catch, trying

        int, nullset

        try, dynamic

 

 

Question 2.2. (TCOs 1, 6) Set a variable to a value with the symbol _____, and test equality with _____. (Points : 5)

        =, =

        ==, ==

        ==, =

        =, == 

 

 

Question 3.3. (TCOs 1, 6) Since data stored in _____ is lost when the computer’s power is turned off, that type of memory is considered to be _____. (Points : 5)

        RAM, volatile

        auxiliary storage, volatile

        RAM, nonvolatile

        auxiliary storage, nonvolatile

 

 

Question 4.4. (TCOs 2, 3) Which escape sequence is used to display a backslash within a string literal on the output console? (Points : 5)

        Special characters cannot be added to string literals.

        \n

        \\

        Return character   

 

 

Question 5.5. (TCOs 2, 3) The keyword “void” means that a method _____. (Points : 5)

        does not return a value

        is invalid

        releases memory after it is called

        clears all variables it is passed

 

 

Question 6.6. (TCOs 2, 3) A computer uses ____ numerals to represent and manipulate data. (Points : 5)

        two

        eight

        10

        16

 

 

Question 7.7. (TCO 4) Given that a is 5, b is 6, and c is 8, which of the following is false? (Points : 5)

        c >= 8

        a >= 0

        a <= (b * 2)

        (1 + a) != b 

 

 

Question 8.8. (TCO 4) A home improvement store is giving a discount of 20% on all purchases of more than $250. Which of the following is the appropriate structure to use to program the statement? (Points : 5)

        Loop

        Method

        Decision

        Sequence 

 

 

Question 9.9. (TCO 5) Your program keeps asking for Student IDs until he/she enters “AAAAA.” In this context, the “AAAAA” is used as a(n) _____. (Points : 5)

        accumulator

        counter

        integer data type

        sentinel value

 

 

Question 10.10. (TCO 5) (TCO 5) The _____ structure is a _____ loop, meaning that its conditional expression is tested after the statements inside its body execute. (Points : 5)

        do-while, posttest

        do-while, pretest

        while, posttest

        while, pretest

 

 

 

Page 2 

 

 

 

Question 1.1. (TCOs 7, 8) Which of the following is a valid overloaded version of this method?

 

char CalculateGrade(double val1, double val2)

  (Points : 5)

        char CalculateGrade(int val1)

        char CalculateMyGrade(int val1, double val2)

        char CalculateMyGrade(double val1)

        double CalculateGrade(double val1, double val2)

 

 

Question 2.2. (TCOs 7, 8) Which is probably a call to an accessor method? (Points : 5)

        SetNoOfYards(double yds);

        double yds = GetNoOfYards();

        CarpetCalculator plush = new CarpetCalculator();

        double yards = yds.calcYards();

 

 

Question 3.3. (TCOs 7, 8) Which is not a valid name for a method or function? (Points : 5)

        mod1

        mod 1

        MyMod1

        mod_1

 

 

Question 4.4. (TCOs 9, 10) In Design mode, set the words that will appear in a textbox by modifying its _____ property in the Properties window. (Points : 5)

        label

        font

        name

        text

 

 

Question 5.5. (TCOs 9, 10) When the user of your fast-food ordering GUI selects the “checkBoxBurger” CheckBox, the string “Burger” should appear in the “listBoxOrder” ListBox. To implement this functionality, write _____ in the ckBoxBurger_CheckedChanged() event handler. (Points : 5)

        if

(ckBoxBurger.isChecked)

  {

    listBoxOrder.Items.Add("Burger");

  }

 

        if (ckBoxBurger.Checked)

  {

    listBoxOrder.Add("Burger");

  }

 

        if (ckBoxBurger.isChecked())

  {

    listBoxOrder.Text = "Burger";

  }

 

        if (ckBoxBurger.Checked)

  {

    listBoxOrder.Items.Add("Burger");

  }

 

 

 

Question 6.6. (TCOs 9, 10) The first time a programmer double clicks on a button object in design mode, the button’s default event handler method _____ is added to the code. (Points : 5)

        Click()

        Clicked()

        Double_Click()

        Double_Clicked()

 

 

Question 7.7. (TCOs 11, 12) To pass the first and second elements of the myData array to the DisplayItems method, replace the commented line below with _____.

 

    static void

Main()

    {

      int[] myData = {1,2,3,4};

        //call DisplayItems

    }

    public static void DisplayItems(params

int[] item)

    {

      for (inti=0; i<item.Length; i++)

        Console.Write("{0} ",item[i]);

    }

  (Points : 5)

        DisplayItems(myData, 1, 2);

        DisplayItems(myData[0],myData[1]);

        DisplayItems(myData, 0, 1);

        DisplayItems(myData[1],myData[2]);

 

 

Question 8.8. (TCOs 11, 12) The size of an _____ can be determined when the program is written or at run time, whereas the size of an _____ must be determined when the program is written. (Points : 5)

        arraylist, array

        array, arraylist

        array, array class

        array class, array

 

 

Question 9.9. (TCOs 11, 12) Given the following declaration, what is/are the value(s) of age[1,0]?

 

int[,] age = { {2, 3, 6, 7},

{5, 8, 9, 4} };

  (Points : 5)

        2

        5

        5 2

        2 5

 

 

Question 10.10. (TCO 13) Before your C# program attempts to append data to a file, it should first _____. (Points : 5)

        callFile.Append to ensure the file can be written to.

        callFile.Create() to create the file.

        callFile.Exists() to make sure the file exists.

        callFile.Write() to make sure the file can be written to.

 

 

Question 11.11. (TCO 13) The following C# statement will _____.

 

Console.WriteLine(Directory.Exists(Directory.GetCurrentDirectory()));

  (Points : 5)

        print out “true”

        print out “true” if there are files in the current directory

        print out “true” if the current directory has subdirectories

        throw an exception

 

 

Question 12.12. (TCO 13) To print out the time and date a file called “plans.txt” was last written to, write _____. (Points : 5)

        Console.WriteLine(File.GetAccessInfo(“plans.txt”);

        Console.WriteLine(GetAccessTime(“plans.txt”);

        Console.WriteLine(File.GetLastWriteTime("plans.txt"));

        Console.WriteLine(GetLastWriteTime (“plans.txt”);

 

 

 

 

 

1.(TCO 3) Show the source code for a C# console application names ‘Sibs’ that prints your frist name on the first line, your last name on the second line, and the number of siblings you have on the third line

Declare and initialize an appropriate variable for your number of siblings

Include at leat three descriptive comments

Stat how you would use the error list window to identify and correct errors in your code(points: 20)

 

2.(TCO 5) Using WHILE loop, write the C# code required to print every second integer starting with 0 until the number is greater than 200(i.e.. 0, 5, 10, 15 etc ) Describe another type loop that can also be used to implement this functionality which would be more efficient? (points: 20)

 

6.(TCO 11) Write a C# program to store an array of these integers 23,45,67,89 and 10. Use an appropriate loop to multiply all of the values in the list. Print out the result (Points: 20)

 

    • 12 years ago
    complete solution A++
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      1.docx