1. If given the following delegate declaration:    publicdelegate void TestCallback(object obj); write code segments to perform the following: A)  Design a non-static method that can be contained within an instance/object of the TestCallback delegate type. This method should display values of two data fields contained within the object that is passed to the method. Make-up your own method definition that meets these requirements. B)  Create an instance of the TestCallbackdelegate (i.e. a delegate object) and initialize this object to contain an entry point of the method defined in part A) as well as a copy of the object that calls this method. C)  Create an event field and the corresponding event property of the given TestCallback delegate type. D)  Write a complete statement that will add the method that you created in question A) to be a handler of the event you created in question C). Make up your own object name that raises the event. ANSWER: A)       B)    C)       D) 2.  Write an SQL statement/command that will select all records from two tables named Cars and Services(i.e., joined tables), if the primary key is carID from the Carstable and the foreign key is carID from the Services table.These records will be sorted by the Date field from the Servicestable in the ascending order. ANSWER:         3.   Fill in the missing code segments. Please read comments.     OleDbDataAdapter dtad = new OleDbDataAdapter();     string constr = "Provider=Microsoft.ACE.OLEDB.12.0;"+ "Data Source=Database1.accdb";     OleDbConnection conobj = new OleDbConnection(___________________);     conobj.Open(); //Updates in the Parts table the value of the Quantity field by //assigning a value stored within the variable qval for the part //where Description field value is entered into the text box named //txtDescription. string sqlUpdate="_________________________________________ __________________________________________________________ __________________________________________________________";     dtad.UpdateCommand = new OleDbCommand(______________________);     _______________________________________; //executes update command     conobj.Close(); 4.   If it is assumed that a text file named parts.txt has been created and it contains many records/lines that consists of a part description and a part quantity separated by a comma as shown in the following record/line example: USB32,150 Write a code to execute the following tasks: A)  Open this file for reading and read/copy all file records into an array. Include all necessary declarations and error checking/handling when opening file. B)  Search for a part description in this array and display its quantity in a message box. Please note that the part description to search for is entered by the user into the txtPart text box. ANSWER: A)           B)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

1. If given the following delegate declaration:

   publicdelegate void TestCallback(object obj);

write code segments to perform the following:

A)  Design a non-static method that can be contained within an instance/object of the TestCallback delegate type. This method should display values of two data fields contained within the object that is passed to the method. Make-up your own method definition that meets these requirements.
B)  Create an instance of the TestCallbackdelegate (i.e. a delegate object) and initialize this object to contain an entry point of the method defined in part A) as well as a copy of the object that calls this method.
C)  Create an event field and the corresponding event property of the given

TestCallback delegate type.

D)  Write a complete statement that will add the method that you created in question A) to be a handler of the event you created in question C). Make up your own object name that raises the event.

ANSWER:

A)

 

 

 

B)

  

C)

 

 

 

D)

2.  Write an SQL statement/command that will select all records from two tables named Cars and Services(i.e., joined tables), if the primary key is carID from the Carstable and the foreign key is carID from the Services table.These records will be sorted by the Date field from the Servicestable in the ascending order.

ANSWER:

 

 

 

 

3.   Fill in the missing code segments. Please read comments.

    OleDbDataAdapter dtad = new OleDbDataAdapter();


    string constr = "Provider=Microsoft.ACE.OLEDB.12.0;"+

"Data Source=Database1.accdb";


    OleDbConnection conobj = new OleDbConnection(___________________);
    conobj.Open();

//Updates in the Parts table the value of the Quantity field by

//assigning a value stored within the variable qval for the part

//where Description field value is entered into the text box named

//txtDescription.

string sqlUpdate="_________________________________________

__________________________________________________________

__________________________________________________________";


    dtad.UpdateCommand = new OleDbCommand(______________________);


    _______________________________________; //executes update command


    conobj.Close();

4.   If it is assumed that a text file named parts.txt has been created and it contains many records/lines that consists of a part description and a part quantity separated by a comma as shown in the following record/line example: USB32,150

Write a code to execute the following tasks:

A)  Open this file for reading and read/copy all file records into an array. Include all necessary declarations and error checking/handling when opening file.
B)  Search for a part description in this array and display its quantity in a message box. Please note that the part description to search for is entered by the user into the txtPart text box.

ANSWER:

A)

 

 

 

 

 

B)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY