1.You are creating a client Application that will reference a Web Service.The Web Service resides in a remote server.You plan to use the remoting frame Work
Which tool should you use to obtain metadata about the remote server object that you can use to create a proxy for the server object?
a)Disco.exe
b)Soapsuds.exe
c)Wsdl.exe
d)Tlbexp.exe
Answer : b (Soapsuds.exe)
Explanation :
You should use Soapsuds.exe, which is the Soapsuds tool. You use Soapsuds to extract type information about the service from a Web Services Description Language(WSDL) file and to convert they type information needed by .NET. You can use the outputassemblyfile(-oa) parameter for Soapsouds to create an assembly file that contains a proxy for the Web Service.
You should not use Disco.exe, which is the Web Services Discovery Tool. You can use Disco.exe to search for discovery documents and to create local copies of these documents. Discovery Documents include files with the .disco extension as well as files with extensions such as .wsdl,.xsd,.discomap and .vsdisco.
You should not use Wsdl.exe, which is the Web Services Description Language tool. You can use Wsdl.exe to create WSDL files as well as to create proxy code based on the information in WSDL File.
You should not use Tlbexp.exe, which is the Type Library Export Tool. You can use Tlbexp.exe to create a type library that contains descriptions of the types defined in an assembly
2.You are part of a team that is developing a Web Service in Visual Studio.You are examining some of your worker's code, and you find the following lines:
Code:
XmlTextReader TxtRead=new XmlTextReader("BookList.xml");
XmlValidatingReader ValidateRead=new XmlValidatingReader(TxtRead);
ValidateRead.ValidationType=ValidationType.DTD;
ValidateRead.ValidationEventHandler+=new ValidationEventHandler(ValidationHandler);
While(ValidateRead.Read());
What do these lines of code do?
a)Create a XML File named BookList.xml Based on external document type definition file.
b)Validate the XML File BookList.xml against a Document Type Definition file.
c)Read the XML file BookList.xml and apply an external document type definition file to it
d)Validate the XML file BookList.xml against a schema that is cached in memory.
e)Read the XML File BookList.xml and create an external document type file definition based on it.
Answer : b (Validate the XML File BookList.xml against a Document Type Definition file)
Explanation :
These lines of code validate the XML File BookList.xml against a document Type Definition(DTD). You use the XmlValidatingReader object to accomplish this. Here an instance of XmlValidatingReader named ValidateRead has been created, with an arguement that points to the file to be validated,BookList.xml. The XmlValidatingReader will validate the document using the DTD list in the XML File's DOCTYPE Declaration.Errors in the XML File are reported through the ValidationHandler method.
The Code does read the XML file, but it doesn't create an external DTD file, nor does it apply one to the XML file.
The Code does not validate the XML file against a schema that is cached in memory, though you can do so using the XmlSchemaCollection object.
The Code doesn't create a new file named BookList.xml. The BookList.xml file must already exist for this code to run successfully.
3.You are using Visual Studio.NET to develop a Windows Service.You are begining to debug your application, and you would like to create an error log of detailed debug message as you proceed with testing.
Which of the following should you use?
a)DefaultTraceListener
b)TextWriterTraceListener
c)EventLogTraceListener
d)TraceSwitch
Answer: b (TextWriterTraceListener)
Explanation:
You should use a TextWriterTraceListener, which sends the output of the Debug or Trace class to a text stream,which you can direct to a text file or to the console window.
The EventLogTraceListener performs a similar function, but sends its output to the Windows event log. You should use the event log primarily to exceptions rather than to record detailed debug messages.
DefaultTraceListener is, as its name implies, the default trace listener. It sends its output to the attached debugger, such as Visual Studio.NET Debugger, which generally displays the information in a message box or a trace window.
TraceSwitch allows you to configure the way Trace Information is displayed. but doesn't actually display information itself.
4.You Plan to Use configuration files(web.config) for an XML Web Service as well as page directives for specific Web Pages included in the service to control globalization for your service.
Which attribute can you define in globalization element of the Web.config file for the service but not in a Page directive for an individual Page?
a)responseEncoding
b)uiCulture
c)culture
d)fileEncoding
e)requestEncoding
Answer: d (fileEncoding)
Explanation :
You can define the fileEncoding attribute only in the globalization element of a web.config file. You use the fileEncoding attribute to identify the format of data in an application's .aspx file
You can define the responseEncoding attribute in either the web.config file or in a Page directive. You use the responseEncoding attribute to designate the encoding that a server uses to send data to a client.
You can define the requestEncoding attribute in either ther web.config file or in a page directive. You use requestEncoding attribute to designate the encoding used in data received from a client by a Web Server.
You can define the culture attribute in either the Web.config file or in a Page directive. You use the culture attribute to designate the format in which language-dependent data should be displayed. For Ex, the culture setting governs how dates and currency values are displayed.
You can define the uiCulture attribute in either the web.config file or in a Page directive. You use the uiCulture attribute to designate the language that should be presented in the user interface(ui).
PART2
1.You have developed three versions of a .NET Remoting component named LicServer that you would like to deploy to a production server. You created installers for each version of the component.Each installer is coded to install a component into the Global Assembly Cache. The three versions are 1.0.0.0, 1.0.0.1, 1.0.0.2. Each component resides in a directory on the C:\ drive named after its version. You want to use the InstallUtil.exe utility to deploy each version of the component side-by-side. You enter the following command on the command line:
InstallUtil c:\1.0.0.0\LicServer.dllc:\1.0.0.1\LicServer.dllc:\1.0.0.2\LicServer.dll
If the installation of Version 1.0.0.2 fails how many components will be installed side-by-side?
a)1
b)0
c)2
d)3
Answer : b (0)
Explanation :
If installation of one assembly fails, the installation will be rolled back, That includes any installations that had already succeeded. This is due to the transactional nature of InstallUtil.exe. If you did not want all installations to fail,you would have to run the InstallUtil.exe utility for each version of the component separately.
2.You have written a class using C# and you want to generate an XSD Schema from the class definition. You want to have granular control over which properties of the class should be persisted as attributes and which ones should be persisted as elements. You also want to be able to control the namespace for the schema.
What tasks should you perform to do so?
a)Apply attributes from the System.Xml.Serialization namespace to the class and its properties. Use System.Xml.Serialization.XmlDeserializer to deserialize the class into a schema.
b)Apply attributes from the System.Xml.Serialization namespace to the class and its properties. Use System.Xml.Serialization.Xmlserializer to deserialize the class into a schema.
c)Apply attributes from the System.Xml.Serialization namespace to the class and its properties. Compile the class and use the xsd.exe tool to generate a schema from the compiled class
d)Compile the class and use the xsd.exe tool to generate a schema from the compiled class. Provide the namespace, attribute, and element options as arguements to the tool.
Answer : c (Apply attributes from the System.Xml.Serialization namespace to the class and its properties. Compile the class and use the xsd.exe tool to generate a schema from the compiled class)
Explanation:
You should apply the attributes from the System.Xml.Serialization namespace to the class and Properties. The XmlElement attribute is applied to properties to indicate that they should be serialized as elements. The XmlAttribute attribute is applied to properties to indicate that they should be serialized as attributes. The XmlRoot attribute is applied to a type to indicate that it should be serialized as the root element of the schema.
You should not use the System.Xml.Serialization.XmlDeserializer to deserialize the class into a schema. The XmlDeserializer deserializes XML Documents into instances of typed objects.
You Should use the System.Xml.Serialization.XmlSerializer to serialize the class into a schema. The XmlSerializer serializes instances of typed objects into XML Documents
You should not provide the namespace, attribute, and element options as arguements to the XSD.exe tool. When generating a schema from a class in an assembly, only the output directory and class type are available as options. These are no options that allow you to control the format of the generated schema. The format is controlled declaratively in the class using attributes from the System.Xml.Serialization
namespace.
3.You are a part of team that is using VisualStudio.NET to develop a Web Service. You are looking through some of the code that your co-workers have written, and you see a line of code that executes the ExecuteXmlReader method.
What is the purpose of this method?
a) It returns the results of an XPath query in XML Format
b) It returns the results of a SQL Query in XML Format
c) It populates a Dataset with data from an XML Document
d) It allows you see to use SQL Query commands to return data from an XML Document
Answer : b (It returns the results of a SQL query in XML Format)
Explanation :
The SqlCommand object's ExecuteXMLReader method returns XML Data from a SQL Server 2000 database. The data is stored in an XMLReader object. You must use a FOR XML clause in the SQL statement that the ExecuteXMLReader uses to direct SQL Server 2000 to deliver the data in XML Format.
The ExecuteXMLReader method doesn't return the results of an XPath query in XML Format. You use ExecuteXMLReader with a SQL query, not with an XPath query.
The ExecuteXMLReader method doesn't populate a Dataset with data from an XML Document. You use ExecuteXMLReader to return an XMLReader object, which is not the same thing as a Dataset.
The ExecuteXMLReader method doesn't allow you to use SQL Query commands to return data from an XML Document. Though it does return XML Data. you use ExecuteXMLReader with a SQL database, not with an XML Document.
4.You have written an Extensible Markup Language (XML) web Service named BackgroundCheckService that derives from a class name BasedDataEncryptionService written by a third party named Service Providers Plus. You add a Web method named GetData that is defined as follows:
[WebMethod(Description='"')]
public string GetData(object value)
{
--------------------
}
You have just downloaded the latest service Pack from service providers Plus, and you now receive build warnings when you compile your code. You discover that Service Providers Plus has added a method named GetData using the same signature as your method and its use is totally different than yours. You don't want to change your method because your Web Service has already been published and is being used by hundreds of client.
What should you do to prevent users of both classes from inadvertently calling the wrong GetData method?
a) Add the Virtual keyword to the method's declaration
b) Add the new keyword to the method's declaration
c) Add the override keyword to the method's declaration
d) Add the abstract keyword to the method's declaration
Answer : b (Add the new keyword to the method's declaration)
Explanation :
You should add the new keyword to the method's declaration. This causes your method to hide the method of the base class that has the same name.
You should not add the virtual keyword to the method's declaration. This would cause a compiler error. A Virtual method can only exist once in a class hierarchy, and it can only exist in the first top-most class that define the method.
You should not add the override keyword to the method's declaration. This would cause your method to override the method in the base class. If a client had a variable declared as a reference to BaseDataEncryptionService, they could inadvertently call your version of GetData when you know the semantics are not the same.
You should not add the abstract keyword to the method's declaration. An abstract method can only exist in an abstract base class. An abstract base class simply defines a contract that inheritors must adhere to. It is very similar to an interface, but it allows for some default implementation.
PART-3
Scenario: You need to create an XML Web Service to provide client applications access to tthe catalogs of various products. You store the product information in an XML File because the product information does not change very often.
Q:What will you do to enable the client applications to access the information stored in a relational Form?
Answer: In the Web Service, create a Web method. Use the ReadXml method of the Dataset to Read data from the XML File into a Dataset object and return the Dataset object.
The ReadXml method allows you to read data from an XML file into a Dataset.
Scenario:
You need to create an applicaton that consists of two serviced components, XMLServer and SQLServer. XMLServer provides access to data stored in XML Files, and SQLServer provides access to data that resides in the SQL Server Database. You need to create the XMLServer and SQLServer components in a system-provided process instead of creator process.
Q: How should you create the application to achieve this objective?
Answer:
using System.EnterpriseServices;
using System;
[assembly:ApplicationActivation(ActivationOption.Server)]
public class XMLServer:ServicedComponent
{
}
public class SQLServer:ServicedComponent
{
}
The value of the ApplicationActivation attribute, which is specified at the assembly level, controls whether the creator's process or a dedicated server process creates the components in an assembly.The ActivationOption.Server value for the ApplicationActivation attribute specifies that a dedicated server process create the components.
Scenario: You created an XML Web Service named MyService. MyService contains a Web method, CalculateInterest that performs lengthy caluculations and uses substantial system resources. The current implementation of the XML Web Service restricts clients from using the data-entry form until the Web method is executed. You need to implement the XML Web Service in such a way that clients need not wait for the Web method to complete execution.
Q:What are the options to accomplishe the above mentioned task?
Answer:
Use the BeginCalculateInterest and EndCalculateInterest methods, and perform asynchronous function calls.
Scenario:
You create an XML Web service, called Service1. You use the Debug.Assert method in your code to verify parameter values and ranges. You find that Service1 doesn't display assertion failure messages. Instead,Service1 returns an HTTP500 error message when an assertion fails.You need to display the assertion failure messages.
Q: How do you enable to do so?
Answer:
You need to modify the compilation element of the Web.config file by setting the debug attribute to True.
PART4
0 comments:
Post a Comment