programming c#

1. XML, as well as HTML, elements are classified either as ____________________ elements, such as theparagraph element, or as ____________________ elements, such as the image element.
2. Whereas in a desktop environment the items (such as a TextBox) that make up the UI are referred to
as controls and their characteristics are called properties (such as the Text property), in a web app, such
the items that comprise the UI are referred to as ____________________s and their characteristics are
specified as ____________________ s.
3. A ____________________ web page requires some processing at the ____________________ and/or
the ____________________. What is displayed is consequently a function of user interaction and/or
data to be displayed, and the file will typically have the extension of ____________________ when
Windows-based software is used for storing, processing, and delivering such pages.
4. A ____________________ page is the starting page for a website (determined by server
configuration). In a Windows environment, typical file names are ____________________ or
____________________, depending on where the processing takes place (i.e., on the client-side or
remotely).
5. The following statement about the methods/properties of StreamReader class is true when reading
data from a text file: A. The ReadLine() method returns a string array that consists of the individual data
items from a single line in the text file. B. The ReadLine() method reads the line at the current read
position, and the current read position after reading would be the same as the read position before
reading. C. The ReadLine() method returns a single string that consists of the individual data items from
a line in the text file. D. When the current read position is at the end of file, the EndOfStream property
has the value false.
6. The following code creates a 2-dimensional array, and then displays one element of the array in a
ListBox named lstDisplay: int[,] sales = {{ 16, 32, 23, 40 }, { 144, 182, 1679, 205 },{ 54, 49, 72, 63 } };
lstDisplay.Items.Add(sales[1, 2]); The output displayed in the lstDisplay would be
____________________.
7. Consider the following line of code.
strGreeting = “Hey,” + strName + “, it is the ” + strDay + “st day of “; strGreeting += strMonth + “. I feel ”
+ strFeeling + “!”;
Then, suppose that the value displayed in a Label named greetingLabel as a result of processing the
statement greetingLabel.Text = strGreeting is as follows.
Hey, Jojo Beans, it is the 21st day of March. I feel great!
That means the values of the variables in that line of code are as follows.
strName: ____________________
strDay: ____________________
strMonth: ____________________
strFeeling: ____________________
Then, by using the String.Format() method to replace all that concatenation, you would rewrite the
above lines of code as the following single line of code.
____________________________________________________________
____________________________________________________________
8. The following is a sample of the order data (Customer#, Order#, OrderQty, UnitPrice) stored in a text
file named Orders.txt: 0155, 76533, 3, 10.95 0140, 75446, 12, 8.50 0150, 75550, 1, 89.95 0145, 75648,
25, 2.50 Consider the following code that reads data from the above file:
StreamReader
OrdersReader = new StreamReader(“Orders.txt”);
string[] fields;
while
(OrdersReader.EndOfStream == false)
{
currentLine = OrdersReader.ReadLine();
fields = currentLine.Split(‘,’);
}
lstDisplay.Items.Add(fields[2]); The output displayed in the
list box, lstDisplay, would then be ____________________.
9. A form contains a SaveDialog control named examsSaveDialog. The SaveDialog control is to be used
to let the user select a file so that data can be written into the file. A StreamWriter named
examStreamWriter is used to write data into the selected file. The code contains the following
statements to let the user select a file, and to use the selected file name to create the StreamWriter
object, examStreamWriter: ExamsSaveDialog.ShowDialog(); StreamWriter examStreamWriter = new
StreamWriter (XXXXXX, True);
In the above code “XXXXXX” represents a missing part of the statement, which should be replaced by
____________________________________________________________.
10. In the context of OOP, an object has ____________________ that describe the characteristics of that
object and ____________________, which are the behaviors associated with that object.
11. A(n) ____________________ is a pattern or blueprint for creating an object, whereas the actual
object created from that pattern is referred to as a(n) .
12. The combining of an object’s characteristics and behaviors into a package is called
____________________.
13. The hiding of the internal details of an object is referred to as ____________________. 14. The
ability to create one type of object from another is called ____________________.
15. Each object is an instance of the ____________________ from which it is created. 16.
____________________ are the actions to which an object can respond.
17. The Class statement begins with ____________________ ____________________.
18. The ____________________ of a class are represented by backing fields and Property procedures.
19. The name of the default constructor for a class named Animal is ____________________.
20. Validation procedures are an example of code that might appropriately be entered into the
____________________ block in a Property procedure.
21. ____________________ is the extension corresponding to the file created when you use Visual
Studio create a class.
22. When you want to write data to a text file, you create a file object using the
____________________Writer class. 23. In C#, ____________________ literals are enclosed in single
quotation marks (i.e., apostrophes).
24. The following form named WriteToTextFiles lets the user save student data into a Text file by
clicking the Save button after entering each student’s data.
The code shown below is intended to write the name and the two scores from TextBoxes into the file,
Exams.txt: private void WriteToTextFiles_Load(object sender, EventArgs e)
{
ExamsWriter =
new StreamWriter(“Exams.txt”, true);
}
private void btnSave_Click(object sender, EventArgs e)
{
string name, score1, score2;
name = txtName.Text;
score1 = txtScore1.Text;
score2 = txtScore2.Text;
ExamsWriter.WriteLine(name + “,” + score1 + “,” + score2);
}
private void WriteToTextFiles_FormClosing(object sender, FormClosingEventArgs e)
{
ExamsWriter.Close();
}
In the above code, ExamsWriter is created in the Load event of the form. It is used in click event of the
button and closed in the FormClosing event. The code is missing the following statement to declare the
variable ExamsWriter. StreamWriter ExamsWriter;
The appropriate place(s) to declare the variable, ExamsWriter is
____________________________________________________________.
25. If a text file’s name is stored in the strFile variable and you want to assign that file’s contents to a
variable named strData, what single statement is needed in order both to declare that variable and
instantiate it with the contents of strFile?
____________________________________________________________
26. Subscript notation provides ___________________ access to the individual characters in a string. A.
class-level B. global C. read-only D. write-only
27. The _______________________________________ method is the appropriate character testing
methods to be used for determining if a sentence uses proper capitalization.
28. ________________________________________ is the method that returns the lowercase
equivalent of a character.
29. The methods _______________________________________ and
________________________________________ return an int value indicating the position of the
substring being searched for in the string object.
30. We use the ____________________ method to insert spaces on the left of a given string as needed
ensure that the resulting string occupies a specified number of character positions and is rightjustified.
31. Look at the following code sample.
string tree = “Pear”;
char letter = tree[2]; 32. This
results in the value of ____________________ being stored in the letter variable?
33. A relational ____________________ is an organized collection of related information often stored in
a single computer file, essentially as a collection of related files (or ____________________), each of
which is a collection of records (or ____________________), each of which is a collection of
____________________ (or attributes) that describe the subjects corresponding to those records.
34. In order to use the OleDb classes referenced above, the C# statement we must use to import the
namespace containing those classes is as follows.
___________________________________________________________________________
35. For database applications written in C#, the _________________________ object specifies where
the actual database resides, as well as other parameters for managing the communication between the
application and the database.
36. Essentially all DBMS consist of an application generation component, as well as the following.
A data ____________________ component
A data ____________________ component
A data ____________________ component
37. Write a method that will read an input file, initialInputs.txt, add “File20170223: ” at the beginning of
each line, and then write each line to a brand new file, revisedData.txt. This procedure should be
entirely self-contained, so no values need to be passed to it.
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
38. Refer to the PART table structure below for this and the next three questions. In the space
below the figure, write the SQL needed to list the part number, description, and on-hand value for all
parts in item class SG; sort the results according to price from highest to lowest.
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
39. Write the SQL needed to modify the description and item class for part number 987g to “Blender”
and “AP”, respectively.
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
40. To add a record for a screwdriver, priced at $1,234.56, with a part number of 123x, and belonging to
item class HW, the SQL you would need to use is as follows.
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
41. The three steps involved in essentially all database processing, regardless of the DBMS or interface
involved are
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
42. When a program (e.g., a desktop application or a web application) includes a query that generates a
recordset, what additional step must take place, once the process summarized above has been
completed?
___________________________________________________________________________
43. The two OleDb classes we are using to access a database, whether simply to read from it or to
modify the data in the database are as follows, along with their corresponding methods (and one
property), indented below the class names.
___________________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
___________________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
44. In order to handle the results of a query that generates a recordset, the OleDb
_________________________ class is what we have used in our examples, and the corresponding three
methods we are calling are
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
45. The scope of a parameter A. is the method in which the parameter is declared. B. includes the
calling program and the method in which the parameter is declared C. is the form that contains the
method in which the parameter is declared D. All of the above
46. The differences between passing an argument by value and passing by reference include all of the
following, except: A. When an argument is passed by value, changing the value of the corresponding
parameter in the called method, does not change the value of the argument B. When an argument is
passed by reference, the reference to the argument is passed to the corresponding parameter in the
called method C. When an argument is passed by reference, changing the value of the corresponding
parameter in the called method, does not change the value of the argument D. When an argument is
passed by reference, the called method may change the value of the argument.
47. The first part of the following code shows a method named ComputeSum(). The second part shows
the Click event handler of a Button, which calls the method: private void btnExamScore_Click(object
sender, EventArgs e)
{ int exam1 =150, exam2 =100, sum = 0; ComputeSum(exam1, exam2, ref
total);
lstDisplay.Items.Add(exam1 + ” ” + exam2 + ” ” + sum); }
private void ComputeSum(int exam1, int exam2, ref int sum)
{
sum = exam1 +
exam2; exam1 = 0; exam2 = 0;
} The output displayed in the ListBox when you click the button
would be: A. 150 100 0 B. 0 0 250 C. 0 0 0 D. 150 100 250
48. A method would be more re-usable if A. data are shared between the calling program and the
method (that is called) using class level variables. B. the outputs (computed results) of the method are
displayed by the method, rather than passed to the calling program. C. if the outputs (computed results)
of the method are passed to the calling program. D. if all arguments are passed by value to the method
49. A method named ComputeTrainingRate() computes the training heart rate (float type) as shown
below. In the header of the method, “xxxxx” represents the missing part of the header. private void
ComputeTrainingRate(xxxxx)
{
trainingRate = 0.6F * (220 – age – restingRate) + restingRate;
} The calling program would pass the resting rate and age (both float type) to ComputeTrainingRate(),
get the value of training rate through a parameter and display trainingRate. The completed header for
ComputeTrainingRate() should be: A. private void ComputeTrainingRate(ref float restingRate, ref float
age, ref float trainingRate) B. private void ComputeTrainingRate(ref float restingRate, ref float age, float
trainingRate) C. private void ComputeTrainingRate(float restingRate, float age, trainingRate) D. private
void ComputeTrainingRate(float restingRate, float age, ref float trainingRate)
50. It is desired to use a scrollbar, hsbUnits, to let the user select whole numbers only in the range 0 to
10. The following statement about the scrollbar is true: A. The LargeChange property of the scroll bar
should be set to 10 B. The Value property of the scrollbar should be set to 10 C. The Maximum property
should be set to 10 D. The Checked property should be set to 10
51. A scrollbar, hsbUnits, is used to let the user select whole numbers in the range 0 to 10. The value of
the scrollbar is to be displayed automatically in a Label named lblNum whenever the value of the
scrollbar is changed (either by the user by clicking inside the scrollbar, or by the code – for example,
when the scrollbar is reset by clicking a “Clear” button). The code required to display the value should
be entered in the following event handler: A. hsbUnits_ValueChanged() B. lblNum_ValueChanged() C.
The Click event of a button. D. hsbUnits_Scroll()
52. The following statement would make the RadioButton, rdbDefault, selected: A.
rdbDefault.CheckState = Checked B. rdbDefault.Checked = true C. rdbDefault.Check() D. rdbDefault.Text
= “Checked”
53. A CheckBox named chkDiscount on a form that process orders is used to let the user specify
whether or not the order is eligible for discount. If eligible, a 20% discount is to be computed. Assume
that, when the form is open, the CheckState property of the CheckBox is set to Indeterminate. Further,
there is no code in the form to verify that the user made a selection. The discount is to be computed
only if the user checked the CheckBox. The appropriate code to compute discount would be: A. if
(chkDiscount.Checked == true) discount = 20; B. if (chkDiscount.CheckState == CheckState.Checked)
discount = 20; C. if (chkDiscount.CheckState == CheckState.Indeterminate) discount = 20; D. All of the
above
54. A form has two GroupBoxes, the first GroupBox contains three RadioButtons, and the second
GroupBox contains four RadioButtons. What is the maximum number of RadioButtons that can be
selected by the user from the entire form at run time? A. 1 B. 2 C. 3 D. 4
55. A signup form for the activities of a club requires the user to specify whether the user is a member of
the club. The prompt for the user on the form is: “Are you a member of the club? “ A control(s) is to
be placed to the right of the above prompt to let the user specify the membership status. Based on
generally accepted standards, which one of the following controls should be used? A. A CheckBox B. A
RadioBbutton C. A TextBox D. Two RadioButtons; one with an “Yes” label and the other with a “No”
Label
56. It is desired to develop a form that allows the user to select one section of an introductory CIT
course from a list of all sections. The number of sections varies from semester to semester within the
range 3 to 8. The prompt for the user on the form would be: “Please select a section:” Based on
generally accepted standards, which of the following control(s) should be used to let the user select a
section? A. A set of RadioButtons B. A TextBox C. A set of CheckBoxes D. A ComboBox
57. The following statement about reference variables is true: A. A reference variable holds the actual
value assigned to that variable B. A reference variable holds only the memory location of the object
assigned to the variable. C. The variable, quantity, declared as follows, is an example of a reference
variable: int quantity; D. All of the above
58. It is desired to develop a form that allows the user to select one or more days of a week from a list
of all seven days of the week. The prompt for the user on the form would be: “Please select one or
more days:” Based on generally accepted standards, which of the following controls should be used to
let the user select one or more days? A. A set of RadioButtons B. A ListBox C. A set of CheckBoxes D. A
ComboBox
59. A form displays a list of sports in a ListBox named lstSports. A user selects Basketball and Soccer
from the list at run time as shown below:
What would be the value of lstSports.Items(2)? A. 2 B. Basketball C. Cricket D. Soccer
60. Consider the following code: int[] testScore = { 85, 92, 87, 67, 83, 91, 73, 98, 83, 84 };
examScore = testScore;
testScore[1] = 99; lstDisplay.Items.Add(examScore[1]);
int[]
61. The value displayed in lstDisplay would be: A. 0 B. 85 C. 92 D. 99
62. How should you specify which item is selected by default in a combo box? A. Set the IsSelected
property to False for the ComboBoxItem control. B. Set the IsSelected property to True for the
ComboBoxItem control. C. Set the IsSelected property to False for the ComboBox control. D. Set the
IsSelected property to True for the ComboBox control.
63. Consider the following code that uses a ListBox named lstDisplay to display an element of an array:
string[] weekDay = {“Sun”, “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”};
string[] DaysOfWeek = new
string[7];
Array.Copy(weekDay, 0, DaysOfWeek, 0, 7);
weekDay[1] = “Monday”;
lstDisplay.Items.Add(DaysOfWeek [1]);
What would be the value displayed in lstDisplay? A. Mon B. Monday C. Sun D. Sunday 64. Consider the
following code that uses a ListBox named lstDisplay to display an element of an array: string[] weekDay
= { “Sun”, “Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat” };
string[] DaysOfWeek = new string[7];
for (int index = 0; index

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER