C - Ebook Test Questions
C - Ebook Test Questions
C - Ebook Test Questions
Test Questions
1. Under which of the following environments does your program’s execution
code run?
A. MSIL
B. CLS
C. CLR
D. VB .NET
2. What is the compiler called that converts IL code into platform-specific code?
A. MSIL-converter
B. JIT
C. JTI
D. Metadata
4. Given the following program, what is the outcome when you try to compile
and run it?
using System;
class Test
{
public static int Main()
{
Console.WriteLine("Hello World!");
}
}
A. It will compile and print “Hello World!” when run.
B. It will compile and result in a runtime error indicating that the Console
is an unknown object.
C. It will fail to compile with an “error CS0161: 'Test.Main( )': not all code
paths return a value”.
D. It will fail to compile with an "error CS0161:'Test.Main( ): method cannot
return an int".
9. Which of the following languages is not part of the current .NET languages?
A. Visual Basic
B. C#
C. C++
D. FoxPro
10. In order to compile a C# program from the command line, what command
would you use?
A. cmd
B. comp
C. csc
D. daml
Test Answers
1. C. Common Language Runtime
2. B. Just-in-time compiler
3. B. Intermediate Language
4. C. Based on the declaration, the Main() method needs to return an integer.
5. B. Encapsulation means that you make your data private and expose the
methods.
6. D. When you create an object, it is called instantiation, and the class file is
the blueprint for that object.
7. A. Since this is a getter method, the method will need to return the value that
it retrieves, hence the return type of int. All getter methods should be declared
as public.
8. D. The static modifier must be present as well as the return type.
9. D.
10. C.
__________________________________________________________________________
Chapter 2
Test Questions
1. Given the following code segment, what will the value returned from the
method be?
public int ViktorMove()
{
int x = 42;
int y = 12;
int w;
object o;
o = x;
w = y * (int)o;
return w;
}
A. 504
B. 491
C. 42
3
Test Answers
1. A. Assigning 42 to an object and then multiplying with that object (cast to
be an int) is valid.
2. C. The garbage collector will only run when the application is running short on
memory.
3. A. The case statement is the replacement for multiple nested if statements.
4. D. Implements is a Visual Basic .NET keyword, not a C# keyword.
5. B. The namespace is not a declaration of a class, and must be terminated
with a semicolon (;).
6. D. x = 42 + 1 + (43 – 1) = 85
Chapter 3:
Test Questions
1. Given the following code, what will the compiler do?
class Test1
{
sealed abstract void MyMethod1A()
{
4
5 float test4c;
6 virtual public void Test4D ()
7{
8 System.Console.WriteLine("Hello");
9}
10 }
11 class Test4a: Test4
12 {
13 override public void Test4D ()
14 {
15 System.Console.WriteLine ("Goodbye");
16 }
17 }
18 class Test4b
19 {
20 public static void Main()
21 {
22 Test4a t = new Test4a();
23 Test4 t1 = t;
24 t.Test4D();
25 }
26 }
A. The compiler finds an error.
B. A runtime error occurs.
C. It prints “Goodbye.”
D. It prints “Hello.”
Test Answers
1. D. You cannot specify sealed and abstract in the same declaration.
2. A. Line 3 declares a field/data, which is illegal in an interface.
3. B. Line 12 cannot access Method3A and line 20 cannot access Method3B.
4. C. It prints “Goodbye” via polymorphic behavior.
5. A. The derived class constructor that takes an integer makes a call to the
empty parameter base constructor that prints “Test5 1.”
Chapter 4:
Test Questions
1. Given the following code segment, what is the content of the string s in line 4?
1 string s = "Hello";
2 string r;
3 r = s;
4 r += " World!";
A. “Hello World!”
B. “Hello”
C. Nothing, it is garbage collected
D. The code will not compile
C. “olleH”
D. “Hello World !”
9. The following code segment creates an event handler. What text must be
inserted in place of <<replace text here>> for the event to work?
// declare the delegate for the event
public delegate void SendFaxEventHandler();
public class Fax
{
// declare the SendFax event
public <<replace text here>> event SendFaxHandler SendFax;
// …
}
A. void
B. delegate
C. Combine
D. static
10. You are building an event handler for the SendFax event from the sFax
component, and you have written the following code. When you test the
event handler, you find that it never runs. What code must you add to your
application to make the event execute in response to the SendFax event?
private void Send_Fax()
{
Console.WriteLine("Fax is sent!");
}
A. public delegate SendFax(Send_Fax);
B. this.sFax.SendFax += new SendFaxHandler(this.Send_Fax);
C. public event SendFax(Send_Fax);
D. this.sFax.SendFax =+ new SendFaxHandler(this.Send_Fax);
Test Answers
Chapter 5:
PART I
Test Questions
1. You want to see all the methods of a particular class that you are using in your
application. Which tool would you use?
A. Class Viewer
B. Object Browser
C. Class Explorer
D. Object Explorer
2. You want to change the color of the text in the code window. Which menu item
would you select?
A. View | Options
B. Tools | Customize
C. View | Customize
D. Tools | Options
3. Which key combination will allow you to compile your console application
and leave the console window open?
A. CTRL-F5
B. ALT-F5
C. F5
D. SHIFT-F5
4. To create a class file that can be added to a library, you would select which
project type?
A. ASP.NET Web Application
B. Class Library
C. Console Application
D. Web Control Library
Test Answers
1. B. Since the class is in your application, you don’t need to use the Class Viewer.
2. D.
3. A.
4. B
Chapter 6:
Test Questions
1. What is the name given to the type of assembly that contains localized
resources?
A. Spoke
B. Hub
C. Sputnik
D. Satellite
10
2. What is the correct name for a resource file with images for the English culture,
in the United States subculture?
A. images.US-en.resources
B. images.en-US.resources
C. resources.images.en-US
D. images.en-US.dll
5. What tool is used to manage the assemblies in the Global Assembly Cache?
A. gacmgr.exe
B. gacutil.exe
C. gassy.exe
D. al.exe
Test Answers
1. D.
2. B.
3. B.
4. C.
5. B.
Chapter 7:
Test Questions
1. What is the code for the German language?
A. ge
B. gb
C. de
D. dk
4. Which of the following code segments will correctly display the string resource
11
6. When localizing a web application, you find that you need to encode Unicode
characters that are sent to the client. What attribute would you set?
A. ResponseEncoding="UTF-8"
B. Encoding="UTF-8"
C. ResponseCode="UTF-8"
D. EncodedResponse="UTF-8"
7. What happens when the Resource Manager fails to find the localized resource
for a locale?
A. It uses the closest locale.
B. It throws an exception.
C. Nothing, the resource will be blank.
D. It uses the fallback resource.
9. Do you have to produce all the locale-specific assemblies before deploying the
application?
A. Yes, the assemblies must be present for the final compile of the application.
B. Yes, the fallback manifest must be built from all the satellite assemblies.
C. Yes, the .NET Framework must update the registry with all the information
at deployment.
D. No, the satellite assemblies can be deployed at will after initial deployment.
10. In the following code segment, what is the significance of the "Strings" literal?
static ResourceManager rm = new ResourceManager("Strings",
Assembly.GetExecutingAssembly());
A. Arbitrary name for the assembly.
B. The base name of the resource to be loaded.
C. The base name of the assembly to be loaded.
D. Alias for the Resource Manager.
11. Where in the object model is the information relating to the date format stored
for a specific locale?
A. ResourceManager
B. CultureInfo
C. LocalFormat
D. Reflection
12
12. Your application is called AccountingOne.exe. What must the name of the
French string resource be?
A. AccountingOne.resources.dll
B. strings.resources
C. strings.fr.resources.dll
D. strings.fr.resources
14. Your application is called AccountingOne.exe. What must the name of the
satellite assemblies be?
A. Accountingone.resources.dll
B. accounting.Resources.dll
C. AccountingOne.resources.dll
D. Accounting.resources.dll
Test Answers
1. C.
2. B.
3. B.
4. D.
5. B.
6. A.
7. D.
8. C.
9. D.
10. B.
11. B.
12. D.
13. C.
14. C.
Chapter 8:PART II
Test Questions
1. Which command will cause an XML file to be generated from documentation
comments?
A. csc MyClass.cs /doc:MyClass.cs
B. cscd MyClass.cs /doc:MyClass.xml
C. cscd MyClass.cs /doc:MyClass.cs
D. csc MyClass.cs /doc:MyClass.xml
C. </tape>
D. <name>XML is cool!</name>
5. Visual Studio .NET provides a tool to generate HTML from the XML
documentation file. It is found where?
A. Tools | Generate XML
B. Tools | Generate HTML
C. Tools | Build Comment Pages
D. Tools | Build Comment Web Pages
Test Answers
1. D.
2. B. This line needs to be at the end.
3. B. There must be matching opening and closing tags: <name>Marj Rempel
4. D.
5. D.
6. A and C. You can use double or single quotes.
7. D.
8. C.
9. D.
10. B.
Chapter 9:
Test Questions
1. You have been asked to debug a Web-based ASP.NET application. For some
reason, the debugging information is not presented. What could be missing?
A. <%@ Page Debug="true" %>
B. <%@ Application Debug="true" %>
C. <%@ Page Trace="true" %>
D. <%@ Application Trace="true" %>
2. You want to examine and change the value of a variable in your C# application.
You are developing using Visual Studio .NET. What window will allow you to
change the value during execution?
A. Locals window
B. Call Stack window
15
C. Immediate window
D. Watch window
5. The correct syntax for adding a trace listener to the Listeners collection is:
A. TraceListeners.Add (new
TextWriterTraceListener("myfile.txt");
B. Trace.Listeners.Add (new
TextWriterTraceListener("myfile.txt");
C. Trace.Add (new TraceListener ("myfile.txt");
D. TraceListener.Add (new TraceListener("myfile.txt");
7. How would you create a breakpoint in your code within Visual Studio .NET?
A. Press F9.
B. Right-click in the margin and select Insert Breakpoint.
C. Choose Debug | New Breakpoint from the menu system.
D. All of the above.
E. None of the above.
Test Answers
1. A.
2. C. The Immediate window allows you to set the value of variables
during execution.
3. C.
4. C.
5. B.
6. D.
7. D.
Chapter 10:
Test Questions
1. What does the following SQL statement return, assuming that all tables and
column names are correct?
SELECT FirstName, StreetAddress
FROM Employees
16
JOIN AddressBook
ON Employees.EmpID = AddressBook.EmpID
A. Nothing, the JOIN syntax is wrong.
B. All the records from the Employees table, and only the matching ones from
the StreetAddress table.
C. All the records from the StreetAddress table, and only the matching records
from the Employees table.
D. Only the matching records from the two tables.
2. What is a transaction?
A. A banking term.
B. A concept used to describe a step in the business process.
C. A combination of DML steps that must succeed or the data is returned to its
initial state.
D. A combination of DDL steps that must succeed or the data is returned to its
initial state.
6. What is a DiffGram?
A. An XML file containing both the original and current values for the data.
B. An XML file containing the difference between original and current data.
C. A DataSet loaded with two XML files, resulting in the difference
being current.
D. A DataSet loaded with an XML file and the original values from
the data source.
11. What is the SQL argument that sorts the data returned by an SQL SELECT
statement?
A. GROUP BY
B. SORT BY
C. SORTED
D. ORDER BY
12. What combination of methods are used to improve the speed of the Fill()
method of the DataAdapter?
A. BeginFillData() and EndFillData()
B. StartFillData() and EndFillData()
C. BeginLoadData() and EndLoadData()
D. StartLoadData() and EndLoadData()
13. The following SQL INSERT statement fails. What is the most probable reason
for the failure?
INSERT INTO Employees VALUES (42,'Bob','Carol', 12)
A. Syntax error in the INSERT statement.
B. The columns in the Employees table are not in the indicated order
(int, char, char, int).
C. The Employees database does not have a default table defined.
D. The SELECT INTO permission is not set.
D. Three errors.
Test Answers
1. D. The syntax is correct so all the matching rows will be returned.
2. C. Transaction work with DML (INSERT, UPDATE, DELETE) statements.
3. A. The XxxConnection defines how the application will connect and
authenticate to the data source.
4. D. The DataTable represents a rowset.
5. B. The DataTable object uses HasError to indicate conflicts.
6. A. DiffGrams are XML documents.
7. C.
8. A. The SqlDbConnection object is used with Microsoft SQL Server 7.0
and higher.
9. A. The SqlDbConnection object is used with Microsoft SQL Server 7.0
and higher.
10. C. Transactions are focused on the connection.
11. D.
12. C.
13. B. INSERT statements must match the data types of the inserted columns.
14. D. The namespace System.Data.SqlClient is missing resulting in an error
on the definition of cnNw and dawn, as well as an error when dawn.Fill()
is called.
15. A. The lack of a WHERE clause empties the table.
Chapter 11:
Test Questions
1. What definition correctly defines a label server control with the name set to
lblHoop?
A. <asp:Label name="lblHoop" runat="server" />
B. <Label id="lblHoop" runat="server" />
C. <asp:label id="lblHoop" runat="server" />
D. <server label name="lblHoop" runat="asp" />
2. What ASP.NET object encapsulates the user’s data as it is sent from a form
in a page?
A. The Session object.
B. The Application object.
C. The Response object.
D. The Request object.
E. The Server object.
3. What important standard is used to connect client browsers with web servers?
A. HTTP
B. TCP/IP
C. ASP.NET
D. HTML
19
4. What ASP.NET object is used to get information about the web servers
hostname?
A. The Session object.
B. The Application object.ART III
C. The Response object.
D. The Request object.
E. The Server object.
5. When writing server-side code, what marks are used to indicate the code block?
A. <% %>
B. <!-- -->
C. <@ language="c#" @>
D. <asp:script runat="server" />
7. What is the name of the process the browser uses to find the address of
a web server?
A. DMZ
B. DNS
C. Active Directory
D. Database lookup
8. How many rules are there regarding a well formed XML document?
A. Nine
B. Three
C. Six
D. Two
10. What language is the standard web script language ECMAScript based on?
A. JavaScript
B. Java
C. Perl
D. Jscript
11. What is the behavior of a web browser when it receives an invalid element?
20
12. What ASP.NET object encapsulates the state of the client and the browser?
A. The Session object.
B. The Application object.
C. The Response object.
D. The Request object.
E. The Server object.
13. What object would you use if you need to support Netscape Navigator and
Microsoft Internet Explorer?
A. ActiveX control
B. Intrinsic controls
C. XML
D. Java applet
14. What method(s) must be used with the Application object to ensure
that only one process accesses a variable at a time?
A. Synchronize()
B. Lock() and UnLock()
C. Lock() and Unlock()
D. SingleUse()
Test Answers
1. C.
2. D.
3. B.
4. E.
5. A.
6. A.
7. B.
8. C.
9. B. The opening and closing elements do not match, <name> </Name>,
XML is case sensitive.
10. A.
11. D.
12. A.
13. D.
14. B.
15. B.
Test Questions
21
1. When working with ASP.NET server controls, it is important to use the right
event handlers to capture the event for the application to function properly.
What event would you use to capture the selection of a new item in a
DropDownList control?
A. The Click event.
B. The SelectionChanged event.
C. The SelectedIndexChanged event.
D. The ChangedSelection event.
2. What code segment represents the event handler registration for the click event
of the btnA Button control?
A. this.btnA.Click.Register(new System.EventHandler
(this.setList));
B. this.btnA.Click.Add(new System.EventHandler
(this.setList));
C. this.btnA.ClickEvent += new System.EventHandler
(this.setList);
D. this.btnA.Click += new System.EventHandler(this.setList);
3. When an ASP.NET server control is added to a Web Form, Visual Studio .NET
adds one item to the class for the form. What item is added?
A. The event registration.
B. A protected class member for the control.
C. A default event handler for the click event.
D. A default class that inherits from the control’s base class.
4. When a browser requests an .aspx file and the file is displayed, what is
actually returned to the browser from the server?
A. HTML
B. XML
C. ASPX
D. ASP
6. What attribute must be set on a validator control for the validation to work?
A. Validate
B. ValidateControl
C. ControlToBind
D. ControlToValidate
9. Given an ASP.NET Web Form called WebForm1, what class does the WebForm1
class inherit from by default?
A. System.Web.Form
B. System.Web.GUI.Page
C. System.Web.UI.Page
D. System.Web.UI.Form
10. What layout mode is the default when a new Web Form is created?
A. GridBagLayout
B. GridLayout
C. FlowLayout
D. FormLayout
Test Answers
1. C.
2. D.
3. B.
4. A.
5. C.
6. D.
7. B.
8. C.
23
9. C.
10. B.
11. A.
12. A.
13. D.
14. C.
15. B.
Chapter 13:
Test Questions
1. What must be done before you can consume a web service?
A. Build a proxy library by using the TblImp.exe utility.
B. Build a proxy library by using the Disc.exe utility.
C. Build a proxy library by using the csc.exe utility.
D. Build a proxy library by using the wsdl.exe utility.
2. You need to use the web service TempConvService. Where should you
place the proxy file?
A. In the lib directory off the root directory of the application.
B. In the root directory of the application.
C. In the bin directory off the root directory of the application.
D. In the bin directory of .NET Framework.
PART III
3. You need to use the web service TempConvService. What page directives
correctly expose the web service?
A. <%@ Page Language="c#" Debug="true" %>
<%@ Import = "TempConvService" %>
B. <%@ Page Language="c#" Debug="true" %>
<%@ Import namespace="TempConvService" %>
C. <%@ Page Language="c#" Debug="true" %>
<%@ Import ProxyNameSpace="TempConvService" %>
D. <%@ Page Language="c#" Debug="true" %>
<%@ Import namespace="bin/TempConvService" %>
5. You need to call a method located in a web service named TService that has
been correctly registered in your application. The method is in the class Tconv
and is named CtoF() with the following signature:
24
6. You have been given the task of designing a web service to expose the data
that is stored in a database on the server. In order to successfully build the
web services, you need to import some namespaces. What is the minimum
namespace you need to import?
A. System.Web
B. System.WebServices
C. System.Web.Services
D. System.Web.ServiceModel
7. You have designed an event for the class you are working on, and the event is
declared as follows:
// declare the delegate for the event
public delegate int MugEmptyHandler(int RefillVolume);
// declare the event
public static event MugEmptyHandler OnMugEmpty;
When you try to register the event in the client code by using the following
line, you receive a syntax error:
this.OnMugEmpty += new MugEmptyHandler(this.Mug_Empty);
You need to make the OnMugEmpty event functional. What will you do?
A. Change the declaration of the event to indicate the parameter.
B. Change the declaration of the event to indicate the return type.
C. Change the declaration of the delegate to have no parameters.
D. Change the declaration of the delegate to have a void return type.
8. You are building an event handler for the SendFax event from the sFax
component, and you have written the following code:
private void Send_Fax()
{
Console.WriteLine("Fax is sent");
}
When you test the event handler, you find that it never runs. What code must
be added to your application to make the event execute in response to the
SendFax event?
A. public delegate SendFax(Send_Fax);
B. this.sFax.SendFax += new SendFaxHandler(this.Send_Fax);
C. public event SendFax(Send_Fax);
D. this.sFax.SendFax =+ new SendFaxHandler(this.Send_Fax);
9. Your manager has asked you to describe what you would use application
variables for. What statement best describes the use of application variables?
A. Application variables are used to keep state for each connected user.
B. Application variables are used to keep state for the web site.
C. Application variables are used to keep state for all the applications on
the server.
D. Application variables are used to keep state for all application objects in
25
10. You are using Visual Studio .NET to set up a reference to a COM component,
but the reference operation fails. What is one possible solution?
A. Register the COM component with .NET using TlbImp.exe.
B. Register the COM component using wsdl.exe.
C. Move the COM component to the bin directory of the application.
D. Register the COM component in the Registry using Regsvr32.exe.
11. What information do you need to have in order to successfully reference a web
service using the Add Reference dialog box?
A. The URI for the web service’s .asmx file.
B. The URL for the web service’s .asmx file.
C. The URL for the web service’s disco file.
D. The URI for the web service’s disco file.
12. You have defined some web service methods, but when you test the web
service, you do not have the methods available. The web service is defined
as follows:
[WebMethod]
private void email(string to, string[] message, int option)
{
…
}
What will you do to solve the problem?
A. Replace the attribute with [WebServiceMethod].
B. Make the method public.
C. Change the string[] to an object array.
D. Change the return type to int.
PART III
13. You find that after running the following command line commands from the
root directory of your web site that the web service is not available:
>wsdl /l:cs /o:Address.cs http://localhost/Address/Address.asmx?WSDL
/n:AddressService
>csc /out:AddressProxy.dll /t:library /r:system.web.dll, system.dll,
system.xml.dll, system.web.services.dll, system.data.dll Address.cs
What will you do to make the web service available with the least amount of
code and work?
A. Run the following command:
regsvr32 /.NET AddressProxy.dll
B. Rerun the csc command specifying /o:bin/AddressProxy.dll.
C. Rebuild the AddressProxy.dll file using the /AutoPost option.
D. Rebuild your application after adding the reference to the web service.
14. You have designed a web form that has one listbox control. You have
implemented the SelectedIndexChanged event handler, and you have
verified that all required declarations are in place and that the event handler is
registered. During testing of the form, you find that the event does not execute.
What is the most efficient way to make the event execute?
A. Set the AutoPostBack attribute of the listbox control to False.
B. Set the AutoPostBack attribute of the @ Page directive to True.
C. Set the AutoPostBack attribute of the listbox control to True.
D. Change from the listbox control to the DropDownList control.
Test Answers
1. D.
26
2. C.
3. B. The namespace of the web service must be imported.
4. D. The entry point must be the name in the library, the signature is what
C# will use.
5. D. The fully qualified method name is TService.Tconv.CtoF(), and the return
variable must be declared.
6. C.
7. D. Multi cast delegates must be declares with a void return type
8. B. The event must be registered.
9. B.
10. D. The COM component must be registered in the Registry before it is
available in Visual Studio .NET
11. B.
12. B.
13. B. The proxy file should be put in the bin directory.
14. C.
Chapter 14:
Test Questions
1. What HTML element is the asp:Label control rendered as when the target is
Internet Explorer?
A. <label>
B. <span>
C. <div>
D. <table>
2. What HTML element is the asp:Label control rendered as when the target is
Netscape Communicator?
A. <label>
B. <span>
C. <div>
D. <table>
3. What is the result when a Web Form containing the following line is compiled
and executed?
<asp:Button id="theButton" onClick="theEvent" />
A. The button control is created; theEvent is the Click event handler.
B. Compiler error; the control must be set to runat="server".
C. Compiler error; onClick is not a valid attribute.
D. Runtime exception; the control must be set to runat="server".
5. How do you specify the parameters for the ads in the AdRotator control?
A. By programmatically setting the properties.
B. By using an initialization file in .xml format.
C. By using an initialization file in .txt format.
D. By using an initialization file in .ini format.
8. You have correctly added the <%@ Register %> directive and the user-control
definition in the <asp:Form> tag, but when you run the application it fails.
What is the most likely cause of the failure?
A. The protected class variable for the control is missing from the codebehind
module.
B. The event registration is not performed; you must manually add it to the
InitializeComponent event handler.
C. There must be a call to the control’s constructor in the Page_load()
method.
D. The control must be added to the Web Form’s Controls collection.
9. After building a custom control, you test it by adding an ASP.NET web application
to the solution. You add a correct <%@ Register %> directive and a proper
declaration of the control in the <asp:Form> tag to the Web Form, but when
you execute the application you get an error. What is the most likely reason for
the problem?
A. The custom control must be compiled first.
B. The web application must have a reference to the control.
C. The custom control must be registered with Windows first.
D. The assembly from the custom control is not in the application’s bin
directory.
10. You have successfully created a custom control and a web application project to
test the control. The application runs with no problems, but when you look at
the Design view of the Web Form, the control is displayed using an error display.
What is the most efficient way to resolve the error display?
A. Move the control to the web application’s bin directory, and recompile the
application.
B. Add a reference to the control to the web application.
C. Change the Bindable attribute for the Default property in the control
to have a value of True.
D. Manually enter the 128-bit GUID for the control in the application’s
configuration file.
12. Your manager has asked you if ASP.NET can be used with dynamic control
creation, and if it requires any extra software to make dynamic controls possible.
28
Test Answers
1. B.
2. B.
3. D.
4. C.
5. B.
6. A.
7. C.
8. A.
9. D.
10. B.
11. C.
12. A.
Chapter 15:
Test Questions
1. What property is used to control how the user can press ALT-F to set the focus to
a control?
A. AccessKey
B. ControlOrder
C. TabOrder
D. TraceOrder
2. You have created a localized web application that supports English, French,
German, and Spanish. After building the resource files, you code all the strings
to come through the ResourceManager.GetString() method. You test
the application by using the browser on your development computer, and as
you switch languages in the Regional Settings, everything functions as expected.
After deploying the application, you receive a message from a client saying that
the application does not change when the client accesses it with a computer
configured to use the French locale. You need to fix the application. What will
you do?
III
A. Rebuild the resource assembly.
B. Add code to change the current thread’s culture to the user’s culture.
C. Add code to change the location of the resource assembly.
D. Instruct the user to upgrade to a newer browser.
C. User’s setting.
D. Neutral.
7. You need to customize the error messages from your web application. What
file will you modify to customize the error messages?
A. Web.config
B. Error.config
C. Application.config
D. global.asax
8. What property is set in order to display the text in reverse flow order?
A. rtl
B. ltr
C. dir
D. reverse
9. You have configured custom error pages for your application. When you test
the pages from a co-worker’s computer, they display properly, but when
displayed in your browser on the development computer, they display
incorrectly. What will you do to correct the display of the error pages on
your computer?
A. Install Internet Explorer 6.0.
B. Change the mode attribute to localhost in the Web.config file.
C. Change the mode attribute to RemoteOnly in the Web.config file.
D. Change the mode attribute to On in the Web.config file.
10. After adding messages to the trace log, you need to locate the output. What
section contains the messages a developer has added to the trace log?
A. Trace Information.
B. Control Tree.
C. Cookies.
D. Headers Collection.
E. Server Variables.
11. What file would you modify to implement application-wide error processing
for all unhandled errors?
A. Web.config
B. Error.config
C. Application.config
D. global.asax
12. What property is used to control the order in which the controls are accessed?
A. AccessKey
30
B. ControlOrder
C. TabIndex
D. TraceOrder
14. What control is used to validate that two fields are equal?
A. RequiredFieldValidator
B. RegularExpressionValidator
C. CompareValidator
D. The equals() method of the field.
15. What method is used to insert a highlighted entry in the trace output?
A. Trace.Write()
B. Trace.HighLight()
C. Trace.Error()
D. Trace.Warn()
Test Answers
1. A.
2. B.
3. B.
4. D.
5. B.
6. D.
7. A.
8. C.
9. D.
10. A.
11. D.
12. C.
13. A.
14. C.
15. D.
Chapter 16:
Test Questions
1. What is the SQL equivalent of the DataSet relation object?
A. XOR JOIN
B. CROSS JOIN
C. OUTER JOIN
D. INNER JOIN
2. Why should you close all database objects and set them to NULL before leaving
the method where the objects were created?
A. To ensure that the object’s destructors are called.
B. To ensure that the connection to the database is closed as soon as possible.
C. To ensure that the objects can be reused.
D. Good coding practice.
31
7. You are the developer of a Web Form, and you need to display data from a
Microsoft SQL Server 6.5 in a DataGrid on your form. What DataAdapter is
the most appropriate?
A. sqlDataAdapter
B. oleDbDataAdapter
C. odbcDataAdapter
D. adoDataAdapter
8. What is the purpose of the last string ("{0}") in the following code segment?
DataBinder.Eval(dS1, "Tables[SP_SelUsers].DefaultView.[0].LastName",
"{0}");
A. It is the formatting string for the bound data.
B. It is the default value that will be used when the data is NULL.
C. It is the parameter sent to the stored procedure SP_SelUsers.
D. It is the placeholder for a DataBinding object.
9. What is the correct namespace for use with the SQL .NET Data Provider objects?
A. System.SQL
B. System.Data.SqlConnections
C. System.Data.SqlClient
D. System.SqlConections
10. What is the correct statement to use for declaring that an xxxCommand object is
used with a table?
A. aCmd.CommandType = CommandType.Table;
B. aCmd.CommandType = Table;
32
C. aCmd.CommandType = "Table";
D. aCmd.CommandType = "CommandType.Table";
11. How many sqlDataReader objects can be open on one Connection at one
time?
A. 4
B. 3
C. 2
D. 1
13. You need to connect to a Microsoft SQL Server version 6.5. What Connection
object is the best choice?
A. sqlConnection
B. oleDbConnection
C. ODBCConnection
D. You must upgrade; there is no connection object for this database.
14. You are using the try... catch block seen in the following code segment,
but no exceptions are ever caught by the catch block. What is the problem?
sqlConnection cn =new sqlConnection(strSQL);
sqlDataSet ds;
try
{
cn.Open();
//perform the data processing steps
...
}catch(OleDbException e){
...
}
A. The exception class is wrong; it should be SqlErrors.
B. The exception class is wrong; it should be SqlSyntaxExceptions.
C. The exception class is wrong; it should be SqlExceptions.
D. The exception class is wrong; it should be SQLExcptions.
15. You are designing a Web Form that needs to have data available for as long as
eight hours at a time. Your manager has raised some concern that the database
server will be unable to provide services to a large number of connected users.
What object in the ADO.NET architecture will you bring to your manager’s
attention as a possible solution?
A. SQL disconnected recordsets.
B. oleDbDataReader
C. ODBCRecordSet
D. oleDbDataSet
Test Answers
1. D.
2. B.
3. D.
4. C.
5. A.
33
6. C.
7. B.
8. A.
9. C.
10. A.
11. D.
12. B.
13. B.
14. C.
15. D.
Test Questions
1. You are the developer of a web application that is retrieving historical sports
information from a database server and displays it to the users of your application.
What cache strategy will give you the best performance?
A. Use the output cache.
B. Use the cache object.
C. Use the ASP.NET central cache.
D. Use the client cache.
2. You are the developer of a web application and have decided to use the output
cache in ASP.NET. Which of the following statements correctly defines the Web
Form if you want to use the output cache, cache all items for 14 minutes, and
store different versions of the cached objects for each customer ID?
A. <%@ OutputCache Duration="840" VaryByCustom="true" %>
B. <%@ OutputCache Duration="14" VaryByCustom="true" %>
C. <%@ OutputCache Duration="840" VaryByParam="Customer ID" %>
D. <%@ OutputCache Duration="14" VaryByParam="Customer ID" %>
4. You are configuring security for a web application that will be used on your
34
6. You are deploying a web application using the XCOPY method, and you are
now selecting the files that should be included in the deployment. What file
extensions must be included in the deployment? Select all that apply.
A. .resx
B. .aspx
C. .cs
D. .ini
7. You have just installed IIS on your desktop computer that is running Windows
2000 Professional. Directly after the installation, you try to create a web application
and you are given error messages indicating that the Internet server is incompatible
with the .NET Framework. You need to create a web application, so what is the
fastest way to be able to do so?
A. Configure the FrontPage Server Extensions.
B. Repair the .NET Framework installation from the Visual Studio .NET Windows
Component update CD.
C. There is no solution. Windows 2000 does not support .NET Framework web
application development.
D. Re-boot the computer.
8. What is required in order to be able to install and use SSL on a web server?
A. Export permission.
B. The SSL add-on CD.
C. Server certificate.
D. Encryption key.
9. You have been asked to describe what authentication and authorization are.
What statements best describe the two terms? Select two answers.
A. Authentication is the process of validating permissions for resources.
B. Authentication is the process of validating security credentials.
35
10. True or false. The Web.config file can be used to store configuration data for
properties of some controls.
A. True.
B. False.
12. What is the effect of the following code snippet from the Web.config file?
...
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>PART III
A. Anonymous access is denied.
B. Only anonymous access is allowed.
C. Users in the default group are denied access.
D. There will be a syntax error when the application is executed.
13. You are deploying the web application you have been developing to a
production server. Your application uses a number of resource assemblies and
also one utility assembly that has been developed for the web application. You
deploy the application by using a file-archiving utility to package all the .aspx
and Web.config files into the archive, and the application is installed on
the production server by un-packing the archive in the target directory. The
deployment did not generate any error messages; but when you are testing the
application, you find that it does not work. None of the localized resources
display anything, and there are a large number of errors displayed. You need
to make the application function normally—what is the most efficient way to
achieve that goal?
A. Enable tracing for the application, trace to an XML file, analyze the output,
and correct the source of the problems.
B. Copy the /bin directory from the development system to the production
server.
C. Install Visual Studio .NET on the production server; enable debugging; and
single-step through the application, correcting all problems as they appear.
D. Abort the deployment, and inform the customer that you will be back as
soon as you have found the problem.
14. True or false. The GAC cannot store multiple versions of the same assembly.
A. True.
B. False.
15. You are configuring your web application to require digest-based authentication.
What must you have in place before you can use digest-based authentication?
A. A DNS server.
B. Active Directory.
C. Strong encryption keys.
D. A strongly named Web.config file.
36
Test Answers
1. A. The mostly static nature of the data makes the output cache a best strategy.
2. C. The Duration parameter takes seconds, and the correct attribute is
VaryByParam.
3. B. The Web.config file will override the Machine.config file.
4. A. When the clients are not all Windows clients, use forms-based authentication.
5. C. Secure Sockets Layer (SSL) will encrypt the clear-text basic authentication
method.
6. B.
7. B. The .NET Framework needs to be repaired.
8. C. You need to provide a server certificate.
9. B and D.
10. A. True.
11. C.
12. A. users="?" is the shorthand for anonymous users.
13. B. The assemblies were never deployed, and they are in the /bin directory.
14. B. False.
15. B. Digest-based authentication requires the use of Active Directory.
Test Questions
1. Which of the following methods are ways to create a Windows Form?
A. Visual inheritance.
B. Building a derived class from System.Windows.Forms.Form.
C. Extending a prebuilt form.
D. Selecting a form class from the Inheritance Picker.
E. All of the above.
2. Select the reasons why you would use Windows Forms over Web Forms.
A. You need the processing to occur on the server.
B. You need the processing to occur on the client.
C. You need access to local resources.
D. You need a consistent graphical interface.
E. You need platform independence.
4. You want to add a control to your form that allows you to set a particular
option on or off. Which control would you choose?
A. Button
B. CheckedListBox
C. CheckBox
D. ListBox
E. RadioButton
6. What is the outcome of the following code? Assume that this code has been
produced by Visual Studio .NET with a few minor changes by the developer.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication4
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
38
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button1.Location = new System.Drawing.Point(96, 80);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(104, 24);
this.button1.TabIndex = 0;
this.button1.Text = "Click Me";
this.button1.Click += new System.EventHandler(this.button1_Click);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] { this.button1});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
[STAThread]
PART IV
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show ("Hello World!");
}
}
A. Program compiles and displays “Hello World!” when button is clicked.
B. Program compiles, but clicking the button does nothing.
C. Program compiles but causes a runtime error.
D. Program does not compile.
7. When you set the Localization property of a form to True, which of the
following happens?
A. You allow the application to accept localization resources.
B. The form is translated into the language specified in the Language
property.
C. The property asks you for the translation language.
D. The program prompts you to provide a language resource.
8. By setting the Text property on the form, you will cause the value of the Text
property to display on which part of the form?
A. Bottom-right corner
B. Top-right corner
C. Title bar
39
D. Status bar
9. What causes the following Load event to fire? Assume that the form is the only
form in the application.
private void Form1_Load (object sender, System.EventArgs e)
{
Form1.Hide();
}
A. The user starts the application.
B. The Show() method is called.
C. The user ends the application.
D. A call is made to Form1_Load from another method.
10. What would the outcome of an application that contained this code be?
private void Form1_Load (object sender, System.EventArgs e)
{
Form1.Hide();
}
A. The application would not compile.
B. The program would run but no form would display.
C. The program would run and display the form.
D. A runtime error would occur.
11. What would the outcome of an application that contained this code be?
private void Form1_Load (object sender, System.EventArgs e)
{
this.Hide();
}
A. The application would not compile.
B. The program would run but no form would display.
C. The program would run and display the form.
D. A runtime error would occur.
B. KeyDown
C. MousePress
D. MouseMove
E. MouseEnter
Test Answers
1. E.
2. B, C, and D.
3. D.
4. C.
5. D. Program does not compile. The error message states that there is a missing
event handler.
6. A.
7. A.
8. C.
9. A and B. The user starts the application or a call is made to the Show()
method.
10. A. The application will not compile because the Form1_Load method would
need a reference variable to the actual form.
11. C.
12. B.
13. B. Deactivate(). It is an event not a method.
14. C.
15. D.
Chapter 19:PAR
Test Questions
1. If you want to ask the user to select between two or more mutually exclusive
options, you would employ which of the following controls?
A. TabControl
B. Button
C. RadioButton
D. CheckBox
TabControl. What will happen when you try to run this code?
TabPage tpMyNewTabPage = new TabPage();
tpMyNewTabPage.Text = "Add Students";
tpMyNewTabPage.Size = new System.Drawing.Size (536, 398);
Button b = new Button();
tpMyNewTabPage.Controls.Add (b);
A. The program compiles and executes properly.
B. The program compiles but the tab page does not show.
C. The program compiles and causes a runtime error.
D. The program does not compile because of a syntax error.
4. You want to validate the user input that is retrieved in a text box. Which control
will assist you in displaying the error message without moving off the form?
A. RichTextBox
B. NotifyIcon
C. HelpProvider
D. ErrorProvider
PART IV
5. You want to validate the user input that is retrieved in a text box. Which event
will assist you in the validation of the data?
A. UponValidation
B. Validation
C. Validating
D. OnValidation
6. Which of the following lines of code will produce a message box for the user?
A. MessageDialogBox.Show ("This is your message");
B. MessageDialogBox.Show ("Message", "This is your message");
C. MessageBox.Show ("This is your message);
D. MessageBox.Show ("Message", "This is your message");
8. To produce a dialog box similar to the Windows Print dialog box, which of the
following controls would you use?
A. PrintPreviewDialog
B. PrintDialog
C. PrintBox
D. SetupPrintDialog
D. SelectionMode
10. What is wrong with the following piece of code? Assume no other code has
been written and you are creating the status bar dynamically.
this.sbMyStatusBar.Panels[1].Text = "Panel 1";
this.sbMyStatusBar.Panels[2].Text = "Panel 2";
this.sbMyStatusBar.Panels[3].Text = "Panel 3";
A. Nothing is wrong with the code.
B. It will cause a runtime error.
C. There will be a syntax error found.
D. The Text property is incorrect for a StatusBar.
12. Which line of code will set the Link data for a LinkLabel?
A. this.linkLabel1.Text = "http:\\www.microsoft.com";
B. this.linkLabel1.Link = "http://www.microsoft.com";
C. this.linkLabel1.HyperLink = "http://www.microsoft.com';
D. None of the above.
13. Which segment of code will set the selected text in a RichTextBox to bold?
A. myFont = new Font (oldFont, Font.Bold = Bold);
this.rtfTest1.SelectionFont = myFont;
B. myFont = new Font (oldFont, FontStyle.Bold);
this.rtfTest1.SelectionFont = myFont;
C. myFont = new Font (oldFont, FontStyle.Bold);
this.rtfTest1.SelectedText = myFont;
D. myFont = new Font (oldFont, Font.Bold);
this.rtfTest1.SelectedText = myFont;
14. Which property will allow the user to enter more than one line in a text box?
A. MaxLines
B. MultipleLines
C. MultiLines
D. MultiLine
15. Which control would you use to group a lot of controls together?
A. GroupControl
B. GroupBox
C. FrameControl
D. FrameBox
Test Answers
1. C.
2. D. The syntax error is in the Caption property of the TabPage—it should be
the Text property.
3. B. You must add the tab page to the Controls collection of the tab control.
4. D. The ErrorProvider will place the error message next to the text box.
5. C. The Validating event allows you to validate the user input.
6. C.
7. A. The collection is called MenuItems, and you must create MenuItem objects.
8. B.
43
9. D.
10. B. A runtime error will occur since the Panel collection of the StatusBar is
zero-based.
11. C. Show is a property, not a method.
12. D. None of the above. You must use this line of code:
System.Diagnostics.Process.Start ("http://www.microsoft.com");
13. B. The property is SelectionFont, and the Font constructor takes
FontStyle.Bold.
14. D.
15. B.
PART IV
Chapter 20:
Test Questions
1. Which code segment will populate a DataSet?
A. sqlDataProvider1.Fill (dsUsers1);
B. sqlDataProvider.Fill (dataAdapter1);
C. sqlDataAdapter.Fill (dsUsers1);
D. sqlDataAdapter.Fill (dataAdapter1);
PART III
2. What type of commands can you create?
A. Text, stored procedures, and tables.
B. Text, stored procedures, and TableRows.
C. Text, stored procedures, and TableDirect.
D. Text, stored procedures, and TableColumns.
6. You want to return XML data from a Microsoft SQL Server 7.0 database.
Which method would you execute?
A. ExecuteXmlReader()
B. ExecuteXmlData()
C. ExecuteOleReader()
D. ExecuteOldData()
B. Data is filtered.
C. Data is bound to a control.
D. Data is returned to the data source.
E. All of the above.
F. None of the above.
9. What will happen when the following code is executed? Assume the connection
is created properly and works fine.
try
{
studentConnection.Open();
studentCommand = studentConnection.CreateCommand();
studentCommand.CommandType = CommandType.StoredProcedure;
studentCommand.CommandText = "SELECT * FROM Student";
studentAdapter = new SqlDataAdapter (studentCommand);
studentSet = new DataSet();
studentAdapter.Fill (studentSet, "FirstName");
this.txtFirstName.DataBindings.Add ("Text", studentSet, "FirstName");
}
catch (SqlDbException s)
{
MessageBox.Show ("Oops, something bad happened");
}
finally
{
studentConnection.Close();
studentConnection = null;
}
}
A. The program will not compile.
B. The program will compile but will throw an exception upon execution.
C. The program will compile but will not display data.
D. The program will display the data and close the connection properly.
10. What will happen when the following code is executed? Assume the connection
is created properly and works fine.
try
{
studentConnection.Open();
studentCommand = studentConnection.CreateCommand();
studentCommand.CommandType = CommandType.Text;
studentCommand.CommandText = "SELECT * FROM Student";
studentAdapter = new SqlDataAdapter (studentCommand);
studentSet = new DataSet();
studentAdapter.Fill (studentSet, "Name");
this.txtFirstName.DataBindings.Add ("Text", studentSet, "FirstName");
PART III
}
45
catch (SqlDbException s)
{
MessageBox.Show ("Oops, something bad happened");
}
finally
{
studentConnection.Close();
studentConnection = null;
}
}
A. The program will not compile.
B. The program will compile but throws an exception upon execution.
C. The program will compile but will not display data.
D. The program will display the data and close the connection properly.
11. You are the consultant for HMR Inc. They have a large network that includes
a Microsoft SQL Server 2000 database. You have coded a connection and
command object to retrieve data from the Student database, but you keep
getting an exception. What is wrong with the following code?
try
{
studentConnection.Open();
studentCommand = studentConnection.CreateCommand();
studentCommand.CommandType = CommandType.Text;
studentCommand.CommandText = "SELECT * FROM Student";
studentAdapter = new OleDbDataAdapter (studentCommand);
studentSet = new DataSet();
studentAdapter.Fill (studentSet, "FirstName");
this.txtFirstName.DataBindings.Add ("Text", studentSet, "FirstName");
}
catch (OleDbException s)
{
MessageBox.Show ("Oops, something bad happened");
}
finally
{
studentConnection.Close();
studentConnection = null;
}
}
A. The connection cannot be closed in the finally block.
B. You are using the wrong data adapter.
C. You are using the wrong data field.
D. You are using the wrong exception object.
E. Both A and C.
F. Both B and D.
12. Which of the following object types allow you to view read-only,
forward-only data?
A. DataAdapter
B. DataSet
C. DataReader
D. DataCommand
14. Why does the data not display using the following code?
studentConnection.Open();
studentCommand = studentConnection.CreateCommand();
studentCommand.CommandType = CommandType.Text;
studentCommand.CommandText = "SELECT * FROM Student";
studentAdapter = new SqlDataAdapter (studentCommand);
studentSet = new DataSet();
this.txtFirstName.DataBindings.Add ("Text", studentSet, "FirstName");
A. The command object is instantiated incorrectly.
B. The dataset object is instantiated incorrectly.
C. The data binding is done incorrectly.
D. The dataset has not been populated.
15. What have you forgotten to do if you see the following dialog box when
running your program?
A. Provide the correct database credentials.
B. Handle data exceptions.
C. Populate the dataset.
D. Read Chapter 20.
Test Answers
1. C.
2. C.
3. D.
4. B.
5. A.
6. A.
7. D.
8. E.
9. B. The command type is Text not StoredProcedure.
10. B. The exception is caused by the column named Name.
11. F.
12. C.
13. A.
14. D.
15. B. (Well, it could be D!!)
Chapter 21:III
Test Questions
1. Where should a web service proxy file be located?
A. In the \bin directory of My Documents.
B. In the \lib directory of the application.
C. In the \bin directory of the application.
D. In the \lib directory of My Documents.
47
5. Which command-line tool will generate the proxy for a COM component?
A. isdlam.exe
B. ildasm.exePART IV
C. tlbimp.exe
D. wsdl.exe
6. Which of the following will display the Web Services on a remote IIS server
(named www.hmr.com) in an assembly called MyServices?
A. http://hmr.com/MyServices/ServiceName
B. http://www.hmr.com/MyServices/ServiceName
C. url://hmr.com/MyServices/ServiceName
D. url://www.hmr.com/MyServices/ServiceName
7. Which of the following code segments can be found in a web service proxy
class that exposes a method called CallMe?
A. public class CallMeService()
{
// class code here
}
B. publicintCallMeService()
{
objectresults=this.Invoke("CallMeService",newobject[0]);
48
return((string)(results[0]));
}
C. publicintCallMeService()
{
object[]results=this.Invoke("CallMeService",newobject[0]);
return((string)(results[0]));
}
D. publicintCallMeService()
{
object[]results=this.Invoke("CallMe",newobject[0]);
return((string)(results[0]));
}
9. You need to call the function, CallMe(), located in the user32.dll library.
The signature of the function is as follows:
string CallMe (string Name, string Address, string Phone
Which code segment will make the function available to your application?
A. [DllImport("CallMe.dll")]
public static extern string CallMe (string Name, string
Address, string Phone)];
B. [[DllImport("CallMe.dll", EntryPoint="CallMe")]
public static extern string CallMe (string Name, string
Address, string Phone)];
C. [DllImport("user32.dll", EntryPoint="CallMe")]
public static extern string CallMe (string Name, string
Address, string Phone)];
D. [DllImport("user32.dll")]
public static extern string CallMe (string Name, string
Address, string Phone)];
10. You have an assembly that includes a web service named ListCollege.
The ListAll() method is a public method that takes an integer value
(studentID) and returns a Boolean value—True if the student was found,
False if no student was found. Which code segment will correctly call this
method?
A. ListCollege.ListAll la = new ListCollege.ListAll();
bool response = la.ListAll(studentID);
B. ListCollege.ListAll la = new ListCollege.ListAll();
la.ListAll();
C. ListCollege.ListAll la = new ListCollege.ListAll();
bool response = la.ListAll();
D. ListCollege.ListAll la = new ListCollege.ListAll();
la.ListAll(studentID);
12. Which URL will provide access to the web service called MyWebService,
located in the WebServices web on the local machine?
A. http://localhost/MyWebService/WebServices.asmx?WSDL
B. http://localhost/WebServices/WebServices.asmx?WSDL
C. http://localhost/MyWebService/MyWebService.asmx?WSDL
D. http://localhost/WebServices/MyWebService.asmx?WSDL
IV
13. A discovery file used to locate Web Services would have which extension?
A. .discovery
B. .discover
C. .vdisco
D. .disco
14. When you test a web service, what do you expect to see as output?
A. The web service running.
B. The web site.
C. The XML of the web proxy.
D. The XML of the web service.
15. Which attribute must be added to create an exposed web service method?
A. [System.WebServices.WebMethod]
B. [System.Web.Services]
C. [System.Web.Services.Web.WebMethod]
D. [System.Web.Services.WebMethod]
Test Answers
1. C.
2. A. The method must be declared as public.
3. D.
4. B.
5. D.
6. B.
7. D. The method name must be CallMe and the result must be an array.
8. A.
9. C.
10. A.
11. B.
12. D.
13. C.
14. C.
15. D.
Chapter 22:
Test Questions
1. Which file must be included in the assembly in order to provide a list of
licensed controls within the application?
A. xxxx.LIC
B. xxxx.LCX
C. xxxx.LICX
D. xxxx.Licenses
2. You are planning to create a new control that will be used in place of the
Button control. The new control will blink and change color whenever the
50
user moves the mouse over the control. Which control type would you use?
A. Derived control from the Button class.
B. Derived control from the Control class.
C. Derived control from the UserControl class.
D. Customized control using GDI+.
3. Which of the following techniques will expose a new procedure for a newly
created control?
A. public string newProperty;
B. private string newProperty;
C. public string newValue;
public string newProperty
{
get
{
return newProperty;
}
set
{
newValue = newProperty;
}
D. public string newValue;
public string newProperty
{
get
{
return newValue;
}
set
{
newValue = Value;
}
E. private string newValue;
public string newProperty
{
get
{
return newValue;
}
set
{
newValue = Value;
}
4. Which set of steps will enable you to test your new control? Assume that a
Windows Control Library application has been created, and a single control
has been built by extending an existing control.
PART IV
A. Version A
i. Build the project.
ii. Run the project, which will open Internet Explorer to host your control.
B. Version B
i. Build the project.
ii. Add a new Windows Forms project.
iii. Set the new project as the startup project.
iv. Run the project.
51
C. Version C
i. Build the project.
ii. Add a new Windows Control Library project.
iii. Set the new project as the startup project.
iv. Run the project.
D. Version D
i. Build the project.
ii. Add a new Web Forms project.
iii. Set the new project as the startup project.
iv. Run the project.
5. You are planning to create a control that will display two text boxes, ask the
user to enter a value in each box, and compare the contents for equality.
Which type of control would you build?
A. Derived control from the Button class.
B. Derived control from the Control class.
C. Derived control from the UserControl class.
D. Customized control using GDI+.
6. Which name is given to the controls that make up part of a composite control?
A. Extenders
B. Constituents
C. Hosts
D. Children
7. Why would you use properties instead of variables to expose attributes for your
new control?
A. Properties can be displayed in the Property Explorer.
B. Properties can be made public, and variables must be private.
C. Variables expose a security risk.
D. Variables are, by default, hidden from view.
9. Which segment of code will instantiate and populate a new License object?
A. MyLicense = new License (typeof (StudentValidate, this));
B. MyLicense = License.Create(typeof(StudentValidate, this));
C. MyLicense =
LicenseManager.Create(typeof(StudentValidate, this));
D. MyLicense =
LicenseManager.Validate(typeof(StudentValidate, this));
10. Which of the following advantages of .NET controls is most significant when
compared to prior releases of ActiveX components?
A. .NET controls extend the Control class.
B. .NET controls manage versioning better.
C. .NET controls can be created one of three different ways.
D. .NET controls replace ActiveX controls.
52
11. Which of the following can you use to add a Toolbox bitmap to your control?
A. [ToolboxBitmap(typeof(NewControl),
@"C:\MyIcons\NewControlIcon.ico")]
B. [ToolboxBitmap(typeof(NewControl)]
C. [ToolboxBitmap(@"C:\MyIcons\NewControlIcon.ico")]
D. All of the above.
E. None of the above.
PART IV
12. Which set of steps will enable you to test your new control? Assume that
a Windows Control Library application has been created, and a composite
control has been built by creating a UserControl and adding the
constituent controls.
A. Version A
i. Build the project.
ii. Run the project, which will open Internet Explorer to host your control.
B. Version B
i. Build the project.
ii. Add a new Windows Forms project.
iii. Set the new project as the startup project.
iv. Run the project.
C. Version C
i. Build the project.
ii. Add a new Windows Control Library project.
iii. Set the new project as the startup project.
iv. Run the project.
D. Version D
i. Build the project.
ii. Add a new Web Forms project.
iii. Set the new project as the startup project.
iv. Run the project.
13. Which object can you use from the PaintEventArgs object in order to draw
on your new control?
A. Graphics object.
B. Drawing object.
C. GDI+ object.
D. Control object.
15. Which of the following class definitions will correctly define a new control
from an existing control?
A. public class NewLabel: System.Windows.Forms.Label
{
private System.ComponentModel.Container components = null;
private string varValue;
public NewLabel()
{
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
private string LabelColor
{
get
{
return varValue;
}
set
{
varValue = value;
}
}
}
B. public class NewLabel: System.Windows.Forms.Label
{
private System.ComponentModel.Container components = null;
PART IV
private string varValue;
public NewLabel()
{
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
public string LabelColor
{
get
{
return varValue;
}
54
set
{
varValue = value;
}
}
}
C. public class NewLabel: System.Windows.Forms.Label
{
private System.ComponentModel.Container components = null;
private int varValue;
public NewLabel()
{
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
private string LabelColor
{
get
{
return varValue;
}
set
{
varValue = value;
}
}
}
D. public class NewLabel: System.Windows.Forms.Control
{
private System.ComponentModel.Container components = null;
private int varValue;
public NewLabel()
{
InitializeComponent();
}
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (components != null)
components.Dispose();
}
base.Dispose(disposing);
}
private string LabelColor
{
get
{
55
return varValue;
}
set
{
varValue = value;
}
}
}
Test Answers
1. C.
2. A.
3. E.
4. B.
5. C.
6. B.
7. A.
8. B.
9. D.
10. B.
11. D.
12. B.
13. A.
14. D.
15. B.
Chapter 23:PART IV
Test Questions
1. Which tool allows you to install an assembly into the GAC?
A. Ngen.exe
B. Mscorcfg.msc
C. Setup.exe
D. sn.exe
3. Which template must be chosen from the Add New Project dialog box’s
Templates list in order to have an application downloaded from an IIS
(Internet Information Server) server?
A. Windows Setup Project.
B. CAB Project.
C. IIS Project.
D. Web Setup Project.
4. You have followed the steps in creating a Windows Installer Setup project, and
after deployment you notice that it does not install properly on the client.
Which of the following could be the problem?
A. You forgot to run the sn.exe utility.
B. The shortcut was not configured properly.
56
IV
9. Which command would you use to list the existing files in the native image
cache?
A. Ngen.exe /list
B. Ngen.exe /cache
C. Ngen.exe /debug
D. Ngen.exe /show
10. What kind of project can you create from the Setup and Deployment Projects list?
A. Web Setup project.
B. GAC project.
C. Setup project.
D. CAB project.
E. B, C, and D.
F. A, C, and D.
13. What can you expect to find in an assembly? Choose all that apply.
A. Security hash.
B. Locale specifications.
C. Registry GUID.
D. Version numbers.
E. Program ID.
14. Which line must exist in the AssemblyInfo.cs file in order to “sign”
the assembly?
A. [assembly: AssemblyKeyFile("")]
B. [key: AssemblyKeyFile("")]
C. [assembly: AssemblyKeyFile("myKeys.snk")]
D. [key: AssemblyKeyFile("myKeys.snk")]
Test Answers
1. A.
2. B.
3. D.
4. C.
5. A.
6. B, C.
7. E.
8. B.
9. D.
10. F.
11. C.
12. B.
13. A, B, D.
14. C.
15. A.
Chapter 24:PART IV
Test Questions
1. You are responsible for adding localization to an existing Windows Form.
What class will determine the locale of the runtime environment?
A. ResourceManager
B. Localization
C. Globalization
D. CurrentUICulture
2. Which tool can you use to configure the security settings for an application?
A. mscorcfg.msc
B. ngen.exe
C. caspol.exe
D. caspol.msc
58
5. Which of the following code segments will produce an ellipse on the form?
A. Graphics g = new Graphics();
g.DrawEllipse(myPen, 10, 10, 10, 10);
B. Graphics g = new Graphics();
g.DrawEllipse (10, 10, 10, 10);
C. Graphics g = this.CreateGraphics();
g.DrawEllipse (myPen, 10, 10, 10, 10);
D. Graphics g = this.CreateGraphics();
g.DrawEllipse (10, 10, 10, 10);
6. Where would you find the machine.config file on a Windows 2000 machine?
A. <system drive>\Program Files\Microsoft .NET\Framework\
CONFIG\
B. <system drive>\Winnt\Microsoft.NET\Framework\<version>\
CONFIG\
C. <system drive>\Winnt\CONFIG
D. <system drive>\Documents and Settings\Framework\CONFIG
7. Which of the following XML segments will redirect the bindings of a component?
A. <runtime>
<assemblyBinding >
<redirectBinding name="MyComponent"
oldVersion="1.0.0.01" newVersion="1.0.0.02" />
</assemblyBinding>
</runtime>
B. <runtime>
<assemblyBinding >
<oldVersion="1.0.0.01" newVersion="1.0.0.02" />
</assemblyBinding>
</runtime>
C. <runtime>
<assemblyBinding >
<dependentAssembly>
<assemblyIdentity name="MyComponent" />
<redirectBinding oldVersion="1.0.0.01"
newVersion="1.0.0.02" />
</dependentAssembly>
</assemblyBinding>
</runtime>
D. <runtime>
<assemblyBinding >
<dependentAssembly>
<assemblyIdentity name="MyComponent" />
59
<bindingRedirect oldVersion="1.0.0.01"
newVersion="1.0.0.02" />
</dependentAssembly>
</assemblyBinding>
</runtime>
10. Which code segment represents the most efficient way to manipulate a string?
A. string s = new string("Hello");
for (int j = 0; j <10; j++)
{
s = s + NameCollection(j);
}
B. String s = new String ("Hello");
for (int j = 0; j < 10; j++)
{
s = s + NameCollection(j);
}
C. StringBuilder s = new StringBuilder ("Hello");
for (int j = 0; j < 10; j++)
{
s.append(NameCollection(j));
}
D. StringBuffer s = new StringBuffer ("Hello");
for (int j = 0; j < 10; j++)
{
s.append(NameCollection(j));
}
14. Which code segment would test the validity of a role-based user?
A. AppDomain.CurrentDomain.SetPrincipalPolicy
(PrincipalPolicy.WindowsPrincipal);
if (WindowsBuiltInRole == Administrator)
{
// do something here
}
B. AppDomain.CurrentDomain.SetPrincipalPolicy
(PrincipalPolicy.WindowsPrincipal);
WindowsPrincipal w = (WindowsPrincipal)
Thread.CurrentPrincipal;
if (w.WindowsBuiltInRole == Administrator)
{
// do something here
}
C. AppDomain.CurrentDomain.SetPrincipalPolicy
(PrincipalPolicy.WindowsPrincipal);
WindowsPrincipal w = (WindowsPrincipal)
Thread.CurrentPrincipal;
if (w.IsInRole(WindowsBuiltInRole == Administrator))
{
// do something here
}
D. AppDomain.CurrentDomain.SetPrincipalPolicy
(PrincipalPolicy.WindowsPrincipal);
WindowsPrincipal w = (WindowsPrincipal)
Thread.CurrentPrincipal;
if (w.IsInRole(WindowsBuiltInRole.Administrator))
{
// do something here
}
Test Answers
1. D.
2. A.
3. B.
4. B.
5. D.
6. B.
7. D.
8. C.
9. A.
10. C.
61
11. D.
12. D.
13. A.
14. D.
15. A.
Chapter 25:
Test Questions
1. What is the result of opening the following XML file in Internet Explorer?
<Books>
<Book>
<Title>
All-in-One Certification Guide
</Title>
</Book>
</Books>
A. The file will not open because it is not well-formed XML.
B. Figure 25-13.
C. Figure 25-14.
D. An XML file cannot be opened by Internet Explorer.
PART V
2. Which line of code will write an event out to an Event Log file?
A. EventLog.CreateEventSource (strLogName, strMessage);
B. EventLog.WriteEntry (strMessage,
EventLogEntryType.Error);
C. eventLogInstance.WriteEntry (strMessage,
EventLogEntryType.Error);
D. EventLog.Source = eventLogInstance.WriteEntry
(strMessage, EventLogEntryType.Error);
3. Which namespace must be added to the XML web service in order to write to
an event log?
A. System.EventLog
B. System.Events
C. System.Diagnostics
D. System.Diagnostics.Event
5. Which of the following SOAP messages will result in a valid message transfer?
Choose all that apply.
A. <SOAP:Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header>
<t:Transaction xmlsn:t="http://localhost" /t:Transaction>
</SOAP:Header>
<SOAP:Body>
<m:MyMethodCall xmlns:m="http://localhost" />
</SOAP:Body>
<SOAP:Body>
<m:MyMethodCall2 xmlns:m="http://localhost" />
62
</SOAP:Body>
</SOAP:Envelope
B. <SOAP:Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header>
<t:Transaction xmlsn:t="http://localhost" /t:Transaction>
</SOAP:Header>
<SOAP:Body>
<m:MyMethodCall xmlns:m="http://localhost" />
</SOAP:Body>
</SOAP:Envelope
C. <SOAP:Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header>
<t:Transaction xmlsn:t="http://localhost" /t:Transaction>
</SOAP:Header>
</SOAP:Envelope
D. <SOAP:Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<m:MyMethodCall xmlns:m="http://localhost" />
</SOAP:Body>
<SOAP:Body>
<m:MyMethodCall2 xmlns:m="http://localhost" />
</SOAP:Body>
</SOAP:Envelope
E. A and C.
F. A and D.
G. A, B, and D.
6. Which of the following describes the elements that make up a SOAP message?
A. Envelope, Header, Body, Fault.
B. Envelope, Header, Body, Error.
C. Envelope, Body, Fault.
D. Envelope, Header, Fault.
7. Which of the following technologies are used to describe a web service in terms
of the messages that it creates and the messages that it accepts?
A. XMLS
B. XSLT
C. CORBA
D. WSDL
9. Which segment of code will cause the web service method to be invoked?
A. localhost.Service1 MyWebService = new localhost.Service1();
MyWebService.Method();
B. proxy.Service1 MyWebService = new proxy.Service1();
MyWebService.Method();
C. Service1 MyWebService = new Service1();
MyWebService.Method();
D. WebService MyWebService = new WebService();
MyWebService.Method();
63
10. How would you add a web service component to your Visual Studio .NET
application?
A. Project | Add Web Component
B. Project | Add Component
C. Project | Add Web Service
D. Project | Add Service
11. A static discovery file will usually have a file extension of which of the
following?
A. .vsdisco
B. .vdisco
C. .sdisco
D. .disco
13. Which of the following technologies is a file that defines the structure and
data types for XML documents?
A. XSD
B. XMLD
C. XSLT
D. XSL
14. You are creating an application that will employ the services of an application
that resides on a remote server. Which of the following protocols should be
used to encode the message to the remote server?
A. SOAP
B. XML
C. RPC
D. DCOM
15. A WSDL document is a file that contains definitions for which of the following?
A. Types, Messages, Bindings.
B. Types, Messages, portTypes, bindings, services.
C. Types, portTypes, bindings, services.
D. Messages, portTypes, bindings, services.
Test Answers
1. B. Only the XML code will be displayed.
2. C. You need an instance of the class EventLog in order to write to the log file.
3. C.
4. D.
5. G. A SOAP message must have a <BODY> element and may have
a <HEADER> element.
6. A.
7. D.
8. C.
9. A.
10. C.
11. D.
12. D.
64
13. D.
14. A.
15. B.
Chapter 26:PART V
Test Questions
1. You have created a serviced component that will interface with COM+ services.
You want to install the component in the Global Assembly Cache. Which utility
will allow you to do this?
A. gacutil.exe
B. regsvsc.exe
C. install.exe
D. sc.exe
PART V
2. You are creating a Windows service for Windows ME. You want to install the
service in the Registry. What utility will do this for you?
A. gacutil.exe
B. regsvsc.exe
C. sc.exe
D. installer.exe
E. None of the above.
4. Which of the following code modules will create a serviced component that
will work with COM+ services?
A. using System.EnterpriseServices;
using System.Reflection;
[assembly: ApplicationName("Price")]
namespace Price
{
public class Price: ServicedComponent
{
public Price()
{
}
public void SomeMethod()
{
// perform the database operations here
}
}
B. using System.EnterpriseServices;
using System.Reflection;
[assembly: ApplicationName("Price")]
[assembly: AssemblyKeyFileAttribute("PriceKeys.snk")]
namespace Price
{
public class Price
{
65
public Price()
{
}
public void SomeMethod()
{
// perform the database operations here
}
}
C. using System.EnterpriseServices;
using System.Reflection;
[assembly: ApplicationName("Price")]
[assembly: AssemblyKeyFileAttribute("PriceKeys.snk")]
namespace Price
{
public class Price: ServicedComponent
PART V
{
public Price()
{
}
public void SomeMethod()
{
// perform the database operations here
}
}
D. using System.Reflection;
[assembly: ApplicationName("Price")]
[assembly: AssemblyKeyFileAttribute("PriceKeys.snk")]
namespace Price
{
public class Price
{
public Price()
{
}
public void SomeMethod()
{
// perform the database operations here
}
}
5. You have created a serviced component that will interface with COM+ services.
You want to register the component manually. Which utility will allow you
to do this?
A. gacutil.exe
B. regsvsc.exe
C. install.exe
D. sc.exe
6. You have created a serviced component that will interface with COM+ services.
You want to register the component automatically. Which utility will allow you
to do this?
A. gacutil.exe
B. regsvsc.exe
C. xcopy.exe
D. sc.exe
7. Which of the following code segments will send an event message to the
66
8. Where would you find the Add Installer link within Visual Studio .NET?
A. Under the Project menu.
B. Under the Build menu.
C. In the Toolbox.
D. In the Properties Explorer window.
9. Which of the following methods will install a Windows service? Choose all
that apply.
A. xcopy.exe
B. regedit.exe
C. setup.exe
D. service.exe
11. Which Registry key would lead you to find the installed Windows service?
A. HKEY_LOCAL_MACHINE\Services
B. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services
C. HKEY_LOCAL_MACHINE\System\Services
D. HKEY_LOCAL_MACHINE\CurrentControlSet\Services
12. You want to configure your new Windows service. Which of the following tools
will allow you to set configuration properties for the service? Choose all that apply.
A. regedt32.exe
B. sc.exe
C. regsrvs.exe
D. net.exe
13. Which class will allow you to programmatically work with your Windows service?
A. ServiceController
B. ServiceConfiguration
C. ServiceStatus
D. ServiceControl
14. Which method of the ServiceController class will allow you to send
a command to the service?
A. Stop()
B. Start()
C. Pause()
D. ExecuteCommand()
15. Which of the following services represent the services that together provide
an enterprise application?
A. Business, Logic, Application
B. Application, Business, Data
C. Presentation, Business, Data
D. Presentation, Logic, Data
Test Answers
1. A.
68
Chapter 29:V
Test Questions
1. What namespace must be used in order to use the DOM for XML support?
A. System.Data.Xml
B. System.Xml
C. System.Xml.DOM
D. System.DOM
2. You need to be able to retrieve data from a DataSet object that has four
DataTable objects. There are currently UniqueConstraint and
ForeignKeyConstraint object on the DataTable objects to enforce the
data rules. You find that you can retrieve data from the individual DataTable
objects, but you are not able to retrieve data from the combination of
DataTable objects in a parent/child manner. What should you do to be able
to retrieve the data in a parent/child manner?
A. Set the EnforceParentChild parameter of the DataSet to True.
B. Set the EnforceRelation parameter of the Relations collection
to True.
C. Add DataRelation objects to the Relations collection to make the
DataSet present the data in a parent/child manner.
D. Add a primary key and a foreign key to each of the DataTable objects that
should present the data in a parent/child manner.
3. You need to retrieve data from a Microsoft SQL Server 2000. Currently you are
using an OleDbConnection object to connect to the database server. You
need to be able to retrieve the data from the database server in XML format.
Which approach would be the most efficient? Select all that apply. Each answer
constitutes part of the whole answer.
A. Change to the SQL .NET provider.
B. Use the ExecuteXmlReader() method of the XxxCommand object.
C. Use the DOM to create the XML document.
D. Use the XmlDocument.Load() method to create the XML document.
5. You have been given a project that loads data into a DataTable, and you find
that the project will not compile. You localize the problem to the statements
that load the data into the DataTable, as shown in this code segment:
DataTable dtProducts = ds.Tables["Products"];
dtProducts.Rows.Add(new RowSet{42,
"Universal Answer", 0, 0, "", 1242.34, 1, 0, 0, 0});
dtProducts.Rows.Add(new RowSet{12,
"Whitby Herring", 0, 0, "", 4.12, 150, 0, 0, 0});
dtProducts.Rows.Add(new RowSet{7,
"Mimico Tuna", 0, 0, "", 42.12, 65, 0, 0, 0});
What is the most efficient way of making the project compile?
A. Replace the curly braces {} with square brackets [].
B. Remove the new keyword from the Add() method.
C. Replace the reference to RowSet in the Add() method with Object[].
D. Change the Add() method to the Load() method.
6. You are parsing an XML document using an XmlReader. You find that the
resulting node tree is very large compared to the number of elements and
attributes in the XML document. Why would the result of the parsing produce a
large node tree?
A. The WhitespaceHandling parameter is set to WhitespaceHandling.All.
B. The WhitespaceHandling parameter is set to WhitespaceHandling.None.
C. The WhitespaceHandling parameter is set to WhitespaceHandling.Auto.
D. The WhitespaceHandling parameter is set to WhitespaceHandling.Special.
7. Which of the following classes supports XML schemas? Select all that apply.
A. XmlReader
B. XmlDocument
C. XmlValidatingReader
D. XmlNodeReader
8. You are developing an application that will connect to a Microsoft SQL Server
6.5, and you need to select the appropriate ADO.NET connection object for this
database server. What ADO.NET connection object is the most appropriate?
A. XxxConnection
B. SqlConnection
C. OleDbConnection
D. OdbcConnection
10. What is the result when the following XML document is parsed?
<?xml version="1.0"?>
<towns>
<town>
<name>Mimico</town>
</town>
<town>
<name>Whitby</town>
</name>
</towns>
70
11. 11. Given the following code segment, what will happen if the call to
doc.Load(reader) throws an XmlException?
try
{
Console.WriteLine("\nXML file: {0} is validating", xmlFile);
reader = new XmlValidatingReader(new XmlTextReader(xmlFile));
reader.ValidationType = ValidationType.DTD;
// register the delegate for the event
reader.ValidationEventHandler += new ValidationEventHandler
(this.ValHand);
Console.WriteLine("Validating using DTD");
XmlDataDocument doc = new XmlDataDocument();
doc.Load(reader); // Line with XmlException
}
catch (Exception e)
{
Console.WriteLine("Exception: {0}", e.ToString());
}
catch (XmlException e)
{
Console.WriteLine("XmlException: {0}", e.ToString());
}
A. The line "XmlException: …" is printed to the console.
B. The line "Exception: …" is printed to the console.
C. The program will terminate with a general failure.
D. The program will continue without any extra output.
12. What is the correct way of creating a DataTable in a DataSet? Select all that
apply. Each answer constitutes one part of the answer.
A. DataTable dtOrders = new DataTable("Orders");
B. DataTable dtOrders = DataTable("Orders");
C. DataTable dtOrders;
D. ds.Tables.Add("Orders");
14. When you build the schema of a DataSet, you need to model the data types
of the data that will reside in the DataColumn objects. What data type would
you use to represent a date?
A. date
B. day
C. System.DateTime
D. variant
15. True or False. HTML must be well formed to be used with XML.
A. True.
B. False.
71
Test Answers
1. B.
2. C. The DataSet must have a DataRelation object for each pair of
DataTable objects that should present their data in a parent/child manner.
3. A and B. Only the SQL .NET provider has support for XML from the server, and
the ExecuteXmlReader() method makes that XML available.
4. B. False, the resulting document must be a well-formed XML document.
5. C. You must use an Object array.
6. A.
7. C.
8. C. The SqlConnection works only with Microsoft SQL Server 7.0 or higher.
9. B, C.
10. B.
11. B. The first catch block that matches the exception will execute.
12. D. You add the DataTable to the DataSet.
13. A.
14. C.
15. A.