MCQs on Networking and Web Services | Visual Basic .NET (VB.NET)

Master the essentials of networking and web services in Visual Basic .NET with these 30 multiple-choice questions. Focus areas include working with HTTP requests, creating and consuming REST APIs, and understanding WCF (Windows Communication Foundation). Test your knowledge and improve your skills in VB.NET’s powerful web programming capabilities.


Networking and Web Services – MCQs

Working with HTTP Requests

  1. Which of the following is used in VB.NET to send an HTTP request?
    • a) WebRequest
    • b) WebClient
    • c) HttpWebRequest
    • d) HttpClient
  2. What method is used to get the response from an HTTP request in VB.NET?
    • a) GetResponse()
    • b) SendResponse()
    • c) Get()
    • d) Receive()
  3. How do you set the HTTP method in HttpWebRequest in VB.NET?
    • a) Using SetMethod()
    • b) Using Method property
    • c) Using SetMethodType()
    • d) Using RequestMethod()
  4. What class in VB.NET is used to manage the response from an HTTP request?
    • a) HttpWebResponse
    • b) WebResponse
    • c) ResponseMessage
    • d) WebClientResponse
  5. Which HTTP method is used to retrieve data from a server?
    • a) POST
    • b) PUT
    • c) GET
    • d) DELETE

Creating and Consuming REST APIs
6. In a REST API, what does REST stand for?

  • a) Real-time Event Streaming
  • b) Remote Event Scripting
  • c) Representational State Transfer
  • d) Reliable Endpoint Service Transfer
  1. What HTTP method is typically used to create new resources in a REST API?
    • a) GET
    • b) POST
    • c) PUT
    • d) PATCH
  2. Which of the following is NOT a status code commonly used in REST APIs?
    • a) 200
    • b) 301
    • c) 404
    • d) 502
  3. What does a 200 HTTP status code represent in a RESTful service?
    • a) Bad Request
    • b) Not Found
    • c) OK
    • d) Unauthorized
  4. How can you send JSON data in a POST request to a REST API in VB.NET?
  • a) Use HttpClient’s PostAsync() with JSON content
  • b) Use HttpWebRequest with XmlHttpRequest
  • c) Send data in the query string
  • d) Use POST method only with XML
  1. What class in VB.NET is used to consume a REST API?
  • a) HttpWebRequest
  • b) HttpClient
  • c) WebClient
  • d) WebRequest
  1. Which of the following is a common response type when consuming REST APIs?
  • a) XML
  • b) JSON
  • c) Both XML and JSON
  • d) None
  1. What is the first step in creating a REST API in VB.NET?
  • a) Configure routing
  • b) Define data models
  • c) Set up HTTP methods
  • d) Create HTTP request handlers
  1. How do you send a GET request to an API in VB.NET?
  • a) Using HttpWebRequest.Get()
  • b) Using HttpClient.GetAsync()
  • c) Using WebRequest.Get()
  • d) All of the above
  1. What header is typically used for sending JSON data in a REST API?
  • a) Content-Type: application/json
  • b) Accept-Encoding: gzip
  • c) Authorization: Bearer
  • d) Accept: text/html

WCF (Windows Communication Foundation) Basics
16. Which of the following is used to define a WCF service in VB.NET?

  • a) ServiceContract attribute
  • b) WebInvoke attribute
  • c) WebService attribute
  • d) DataContract attribute
  1. What is the main advantage of using WCF over traditional web services?
  • a) Only supports HTTP requests
  • b) Supports multiple transport protocols
  • c) Only supports SOAP
  • d) Does not support client communication
  1. Which transport protocol is used by default in WCF services?
  • a) HTTP
  • b) TCP
  • c) MSMQ
  • d) UDP
  1. Which method in WCF is used to expose a service to a client?
  • a) OpenService()
  • b) ServiceHost.Open()
  • c) ExposeService()
  • d) Service.Start()
  1. What is the default binding used in WCF?
  • a) BasicHttpBinding
  • b) WSHttpBinding
  • c) NetTcpBinding
  • d) NetNamedPipeBinding
  1. Which of the following is NOT a type of WCF binding?
  • a) BasicHttpBinding
  • b) WebHttpBinding
  • c) HttpWebBinding
  • d) NetTcpBinding
  1. What is a key feature of WCF compared to REST APIs?
  • a) Stateless operations
  • b) Supports multiple message patterns
  • c) Limited to HTTP
  • d) Only supports XML
  1. In WCF, what does the [ServiceContract] attribute define?
  • a) The method signature
  • b) The service method
  • c) The service interface
  • d) The data transfer object
  1. Which of the following is true about WCF and SOAP?
  • a) WCF supports SOAP-based communication
  • b) SOAP is not supported in WCF
  • c) SOAP is only used in RESTful APIs
  • d) WCF only supports HTTP communication
  1. In WCF, which class is used to host a service?
  • a) ServiceHost
  • b) HostService
  • c) ServiceFactory
  • d) ServiceManager
  1. What is required to call a WCF service from a client in VB.NET?
  • a) A ServiceReference
  • b) A Proxy class
  • c) A Binding configuration
  • d) All of the above
  1. What type of communication does WCF support?
  • a) One-way communication
  • b) Duplex communication
  • c) Both one-way and duplex communication
  • d) None of the above
  1. What is the purpose of the [OperationContract] attribute in WCF?
  • a) To define data contracts
  • b) To expose methods in the service
  • c) To handle error responses
  • d) To specify the binding type
  1. Which configuration file is used to define WCF service endpoints in VB.NET?
  • a) web.config
  • b) app.config
  • c) service.config
  • d) WCF.config
  1. Which of the following security features can WCF support?
  • a) Message security
  • b) Transport security
  • c) Both message and transport security
  • d) None

Answer Key

QnoAnswer
1c) HttpWebRequest
2a) GetResponse()
3b) Using Method property
4a) HttpWebResponse
5c) GET
6c) Representational State Transfer
7b) POST
8d) 502
9c) OK
10a) Use HttpClient’s PostAsync() with JSON content
11b) HttpClient
12c) Both XML and JSON
13a) Configure routing
14d) All of the above
15a) Content-Type: application/json
16a) ServiceContract attribute
17b) Supports multiple transport protocols
18a) HTTP
19b) ServiceHost.Open()
20a) BasicHttpBinding
21c) HttpWebBinding
22b) Supports multiple message patterns
23c) The service interface
24a) WCF supports SOAP-based communication
25a) ServiceHost
26d) All of the above
27c) Both one-way and duplex communication
28b) To expose methods in the service
29b) app.config
30c) Both message and transport security

Use a Blank Sheet, Note your Answers and Finally tally with our answer at last. Give Yourself Score.

X
error: Content is protected !!
Scroll to Top