Web Services MCQs

Web Services MCQs

These Web Services multiple-choice questions and their answers will help you strengthen your grip on the subject of Web Services. You can prepare for an upcoming exam or job interview with these 80+ Web Services MCQs.
So scroll down and start answering.

1: You are developing a Web service in ASP.NET. Which of the following .net classes will be extended by your service?

A.   System.Web.WebService

B.   System.Web.Service

C.   System.Web.Services.Service

D.   System.Web.Services.WebService

E.   None of the above

2: Before you deserialize, you want to make sure that the XML you are about to deserialize will map into the class with which you instantiated this serializer. Which of the following methods will you use to verify this?

A.   Deserizable

B.   Compatible

C.   Equals

D.   CanDeserialize

E.   None of the above

3: Creating a hash with a public key encryption is the ability to verify the integrity of data without necessarily encrypting it. Which of the following are correct with regard to HASH?

A.   The hash is a nearly unique digest of the message

B.   The hash is encrypted using the public key of the sender

C.   The encrypted hash serves as a signature of the sender and is sent separately from the decrypted message

D.   The hash is the opposite of the usual process used in encryption, in which the public key is used to encrypt, and the plain text is not sent

4: Client access is accomplished via custom proxy classes that use the WebRequest and HttpWebRequest classes. Which kinds of .NET applications use these proxy classes?

A.   Windows form

B.   Web form

C.   Web service

D.   All of the above

5: Which of the following namespaces is used for encoding style in SOAP?

A.   http://www.w3.org/2001/06/soap/soapEncoding

B.   http://www.w3.org/2001/06/soap-encoding

C.   http://www.w3.org/2001/06/soapEncoding

D.   http://www.w3.org/2001/06/soap/soap-encoding

6: Mike is writing a RPC-encoded client for his Web service. Which attribute will he use for RPC implementation?

A.   [RpcSoapMethod(

B.   [RpcMethod(

C.   [SoapRpcMethod(

D.   [SoapRpcAction(

E.   None of the above

7: Which of the following are correct with regard to operations of WS-Routing?

A.   WS-Routing enables the specification of a message's forward message path

B.   WS-Routing does not support the specification of a reverse message path

C.   WS-Routing provides the capability to give messages unique identifiers, and then specify the other messages to which they relate

D.   All of the above

8: The Web service infrastructure comes with a special SOAP-based extension feature that enables you to extend the functionality of your Web service or Web service client. Which of the following will you do to notify a soap extension?

A.   You will register the extension in the machine.config file

B.   You will register the extension with the application's configuration file

C.   You will pass method-specific information to the extension via the attribute

D.   You will do all of the above

9: Often you will want child elements of XML to be in the same namespace as their parent XML elements, and this makes sense for a lot of XML documents. However, sometimes child elements will be in other namespaces. For example, it is possible to have namespaces with the same name but different namespaces (and thus with different meanings). Which of the following statements correctly binds a namespace with an element?

A.   [XmlElement(Namespace:=

B.   [XmlElement(ns=

C.   [XmlElement(Namespace=

D.   None of the above

10: Which of the following are correct with regard to WS-Inspection?

A.   WS-Inspection is a simple XML format for gathering together available services

B.   WS-Inspection describes the service policy

C.   WS-Inspection has the ability to link to UDDI registrations that give more information about a listed service

D.   WS-Inspection documents have a root element with the local name WSInspection

E.   All of the above

11: The fundamental idea behind SOAP is that two applications; regardless of the operating system, the programming language, or any other technical implementation detail, may openly share information using nothing more than a simple message encoded in a way that both the applications understand. Which of the following aspects are required to implement this?

A.   The types of information that are being exchanged

B.   The way that information is to be expressed as XML

C.   The way to actually send that information

D.   None of the above

12: Which of the following classes is the base class for Soap Extensions?

A.   System.Web.Services.Protocols.SoapExtension

B.   System.Web.Services.Protocols.SoapExtensions

C.   System.Web.Services.SoapExtension

D.   System.Web.Services.SoapExtensions

E.   None of the above

13:

Which of the following is correct with regard to the statements given below?

Statement 1: A logical name is a URI that necessarily represents the exact location to which a message is sent.

Statement 2: A logical name can have a very different location than the one implied by its logical name, or even multiple physical locations.

A.  

Statement 1 is true but statement 2 is false  

B.  

Statement 1 is false but statement 2 is true 

C.  

Both the statements are true


D.  

Both the statements are false


14: Which of the following child elements of a Fault element is used to express application-specific details about the error that occurred?

A.   details

B.   description

C.   detail

D.   comment

15:

Refer to the statements given below and identify the incorrect element:

Client.Authentication

Invalid credentials

http://acme.com

A.  

s:Faults>

B.  


C.  


D.  

None of the above


16: Which of the following should you know to send a message correctly while using Web service?

A.   The IP address and other endpoint information

B.   The response schema to expect if there is a response

C.   Possible headers that may be expected in the request or response, and the schema for those

D.   All of the above

17: The namespace, System.Security.Cryptography has an abstract class, from which specific implementations of various symmetric, or private keys, and encryption algorithms are derived. Which of the following is that abstract class?

A.   Symmetric-Security

B.   Symmetric-Algorithm

C.   Symmetric-Encryption

D.   None of the above

18: Which of the following represents a structure in a SOAP message?

A.   person> Joe Smith

B.  

C.  

D.   None of the above

19: You need to serialize an array named 'Street'. You want to set the array name as 'StreetName' after serialization. Which of the following codes will serialize the array correctly?

A.   public String[] Street;[XmlArray(

B.   [XmlArray(

C.   public String[] Street; [XmlArrayName(

D.   None of the above

20:

Mike has built the following document literal web service client class by hand. This code contains an invalid syntax in one line. Identify this line.

1. [WebServiceBinding("MyBinding", "http://MyNS")]

2. public class CustomWebMethods : SoapHttpClientProtocol

3. {

4.      public CustomWebMethods()

5.      {

6.            this.Url = "http://localhost:8080";

7.      }


8.      [DocumentMethod("http://mySoapAction")]

9.      public int Add( int x, int y)

10.     {

11.            Object[] args = {x, y};

12.            Object[] responseMessage = this.Invoke( "Add", args );

13.            return ((int)(responseMessage[0]));

14.      }

15.}

A.  

Line 1 

B.  

Line 2

C.  

Line 8 

D.  

Line 12

E.  

Line 13

F.  

None of the above

21: Which of the following are correct with regard to asynchronous pattern?

A.   Asynchronous pattern decreases the performance of your application

B.   While using asynchronous pattern, you add two methods: StartYourMethod and EndYourMethod (where YourMethod is the actual name of your method)

C.   The

D.   Unless you have a compelling reason to do otherwise, always use the asynchronous pattern when you consume Web services in your production code

22: Mark is developing a Web service that handles RPC-encoded operations. He wants to make all the methods of the service RPC-encoded, but does not want to put any attribute for each method. Which class attribute should he use to make all methods of a class RPC-encoded?

A.   SoapRpcMethodsAttribute

B.   SoapRpcServiceAttribute

C.   SoapRpcServiceMethodsAttribute

D.   SoapRpcService

E.   None of the above

23: You use UDDI operations to find something when you do not know specifically what you are looking for. Which of the following UDDI operations fall in this category?

A.   find_binding

B.   find_business

C.   find_service

D.   find_Model

E.   All of the above

24: Which of the following does the acronym UDDI stand for?

A.   Universal Description, Discovery, and Investigation

B.   Universal Description, Discovery, and Integration

C.   Universal Discovery, Definition , and Integration

D.   None of the above

25:

Which of the following is correct with regard to the statements given below?

Statement 1: RPC-encoded clients are very similar to document-encoded ones.

Statement 2: RPC-encoded clients need to set the Use property of the [SoapRpcMethod("http://mySoapAction")] attribute to indicate that this client is encoded, and not literal XML.

A.  

Statement 1 is true but statement 2 is false

B.  

Statement 1 is false but statement 2 is true

C.  

Both the statements are true


D.  

Both the statements are false


26: Which of the following information does a server need to publish in order to meet a client's needs?

A.   Description Information

B.   Service Location

C.   Service Schema

D.   Service Classification

E.   All of the above

27:

Refer to the following statements and identify the lines that are invalid:

1. <%@ Service Class="TestClass" Language="C#" %>


2. using System;

3. using System.Web.Service;


4. public class TestClass {


5.   [WebMethod]

6.     public int Add( int a, int b)

7.     {

8.          return a+b;

9.     }

10. }

A.  

line 1


B.  

line 3


C.  

line 4


D.  

line 5


E.  

All of the above


28: You have created a Web service named 'Service1'. The client application of 'Service1' has a textbox called 'textbox1' and you want to set the value of textbox1.text as UserAgent of 'Service1'. Which code will you apply to accomplish this?

A.   localhost.Service1.UserAgent = this.textBox1.Text;

B.   localhost.Service1 s = new localhost.Service1(); s.UserAgent = this.textBox1.Text;

C.   localhost.Service1.UserAgent ua = new localhost.Service1.UserAgent(); ua.value = this.textBox1.Text;

D.   None of the above

29: The two major features in .NET are the ability to create XML Web Services Servers and XML Web Services Clients. Which of the following is the engine that drives most of these features?

A.   XML Schema

B.   SOAP Engine

C.   XML Serialization

D.   None of the above

30: WSDL is an XML-based language for describing Web services. Which of the following are correct regarding the functioning of WSDL?

A.   WSDL forces a clean separation between data (as found in messages)

B.   WSDL provides the abstract definition of a set of message-sending operations

C.   WSDL provides the particular binding information needed to format and to send a message correctly

D.   All of the above

31:

Refer to the code given below and identify the line numbers that contain errors:

..

1. Inquire.Url = "http://uddi.rte.microsoft.com/inquire";

2. FindBusiness findBusiness = new FindBusiness();

3. findBusiness.Names.Add("Royal Airways");

4. BusinessList list = findBusiness.Find();

5. if (list.BusinessInfos.Count > 0)

6. {

7.       GetBusinessInfo gb = new GetBusinessInfo();

8.       gb.BusinessKeys.Add(bizList.BusinessInfos[0].BusinessKey);

9.       BusinessDetail bizDetail = gb.Send();

10.      if (bizDetail.BusinessEntities.Count > 0)

11.      {

12.           ...

13.      }

14.}

...

A.  

2

B.  

4

C.  

5

D.  

7

E.  

10

F.   None of the above

32: Which of the following is a process of making resources and services available on a new system, when the previous system fails while using a federated Web service design?

A.   RECOVER

B.   ROLLOVER

C.   FEDERATION REPAIR

D.   None of the above

33: Which of the following is not a correct statement regarding schema?

A.   The schema element can contain any number of top-level declarations

B.   The XML schema language is based on the Worldwide Web Consortium (W3C)

C.   The definitions in an XML schema are contained within the top-level schema element

D.   The schema element in an XML schema document cannot use a namespace

34: In the .NET UDDI SDK, which of the following contains the businessEntity structure?

A.   WSBusinessEntity

B.   BusinessClass

C.   BusinessEntity

D.   WSBusinessClass

E.   None of the above

35:

Refer to the following code of a SOAP message and identify the error:

xmlns:s="http://www.w3.org/2001/06/soap-envelope">

Mistristic

s:mustUnderstand="true">

1234

A.  

The Namespace is incorrect   

B.  

The position of the header is incorrect 

C.  

The body cannot contain a symbol element 


D.  

MustUnderstand is not an attribute of the transaction element

36: Sometimes, you will want the WSDL file created for your service to indicate that it will be modified by the SOAP extension running on it. Conversely, you will want the proxy generated for you from wsdl.exe to add the SOAP extension to any proxy class it consumes that contains this indication. Which of the following should you apply to accomplish this?

A.   WSDLFormatter

B.   WebServiceClientExtension

C.   WSDLExtensionFormatter

D.   ServiceDescriptionFormatter

E.   None of the above

37: Which of the following is an invalid child of a Fault element of a SOAP message?

A.   faultcode

B.   faultstring

C.   faultactor

D.   faultdescription

38:

State whether True or False:

When you serialize an array that is a member of a class, the result is a piece of structured XML that contains (a) a top element which is, by default, the name of the class member, and (b) any number of child elements, one for each value in the array.

A.  

True 

B.  

False

39:

Which of the following is true with regard to .NET Web services?

Statement 1:.NET Web services use the XmlSerializer as the engine for sending and receiving SOAP messages.

Statement 2:.NET Web services are literal schema-based XML. They are not encoded XML.

A.  

Statement 1 is true but statement 2 is false  

B.  

Statement 1 is false but statement 2 is true 

C.  

Both the statements are true

D.  

Both the statements are false


40: Which of the following represents an array in a SOAP message?

A.   person> Joe Smith

B.  

C.  

D.   None of the above

41: Which of the following is the correct position of the header in a SOAP message?

A.   Only before the body

B.   Only after the body

C.   Only before the envelope

D.   Anywhere in the message

42:

The following code has stored the data using the multiple-referenced accessor:

Which of the following is the correct way to solve the error in the code given above?

A.  

* must be prefixed with href value 

B.  

* must be prefixed with id value 

C.  

# must be prefixed with href value 

D.  

# must be prefixed with id value


43:

Refer to the following code, which is a part of an xml validation:

...

filename = "OrderDetails.xml";

FileStream stream = new FileStream( filename , FileMode.Open);

XmlValidatingReader reader = new XmlValidatingReader(stream);

...

Gavin is trying to open an xml which contains "order details" returned by a Web service, through this code, but an error is being generated in the code. Which of the following might be the cause of error?

A.  

XmlValidatingReader is not a valid class 

B.  

In the constructor of XmlValidatingReader, FileStream object is passed instead of XmlTextReader object

C.  

In the constructor of XmlValidatingReader, FileStream object is passed instead of XmlReader object

D.  

None of the above


44: The use of attributes in a class and its members can affect the XML into which it serializes. Which of the following rules apply when a class is serialized?

A.   The Namespace of the Serialized XML will be http://tempuri.org by default

B.   Properties and Fields will remain in the same Namespace

C.   Properties and Fields will be serialized as Elements

D.   All of the above

45: Security is a hard-to-use feature in .Net. On the contrary, it is rather easy to implement in Web services. Which of the following namespaces is used for encryption?

A.   System.web.Security.Encryption;

B.   System.Cryptography;

C.   System.Security.Cryptography;

D.   None of the above

46: You need to send an image from a Web server to an image server in order to customize the image for the Web surfer. Which of the following options will you use to send binary data with a SOAP message?

A.   Encode the binary data as a string

B.   Package the SOAP message into MIME

C.   Package the SOAP message into DIME

D.   All of the above

47: Mark intends to use Web services of

A.   Inquire.Url =

B.   Inquire.Url =

C.   Inquire.Url =

D.   None of the above

48:

Which of the following is correct with regard to the statements given below?

Statement 1: A Web service is not a web site that a user reads.

Statement 2: A Web service is something another process or another machine uses.

A.  

Statement 1 is true but statement 2 is false

B.  

Statement 1 is false but statement 2 is true

C.  

Both the statements are true 

D.  

Both the statements are false


49: Which of the following code snippets are serializable?

A.   public class Order { public System.Xml.XmlElement OrderDescription; public int Quantity; public String Name; }

B.   public class Order { [XmlAnyAttribute] public System.Xml.XmlAttribute[] anyAttributes; public System.Xml.XmlElement OrderDescription; public int Quantity; public String Name; }

C.   public class Order { [XmlAnyElement] public System.Xml.XmlElement[] extraElements; public System.Xml.XmlElement OrderDescription; public int Quantity; public String Name; }

D.   All of the above

50: Which of the following are the limitations of XML serialization?

A.   Only Classes with a Public Default Constructor will be serialized

B.   Only Public Fields and Properties will be serialized

C.   Read-Only Fields and Properties will not be serialized

D.   Methods and Other Type Information will not be serialized

E.   All of the above