C# Questions & Answers on Network Errors Handling for Freshers

1. What exception is thrown if the URI format is invalid?

a) URLNotFound
b) URLSourceNotFound
c) MalformedURLException
d) UriFormatException
Answer: d
2. What exception is thrown if the protocol supported by URI prefix is invalid?

a) URLNotFound
b) URLSourceNotFound
c) UriFormatException
d) NotSupportedException
Answer :d
3. What exception is thrown if the user does not have a proper authorization?

a) URLNotFound
b) URLSourceNotFound
c) System.Security.SecurityException
d) All of the mentioned
Answer: c
4. Choose the exceptions generated by the Create() method defined by WebRequest:

a) NotSupportedException
b) UriFormatException
c) System.Security.SecurityException
d) All of the mentioned
Answer: d
5. Choose the exceptions generated by the GetReponse() method defined by WebRequest:

a) InvalidOperationException
b) ProtocolViolationException
c) WebException
d) All of the mentioned
Answer: d
Explanation: By definition.
6. Select the properties related to the network errors generated by WebException:

a) response
b) get
c) set
d) none of the mentioned
Answer: a

Explanation: WebException has two properties that relate to network errors:
Response and Status.
We can obtain a reference to the WebResponse object inside an exception handler through the Response property. For the HTTP protocol, this object describes the error. It is defined like this:
public WebResponse Response { get; }
When an error occurs, we can use the Status property of WebException to find out what went wrong. It is defined like this:
public WebExceptionStatus Status {get; }
7. Which of these classes is used for operating on the request from the client to the server?

a) http
b) httpDecoder
c) httpConnection
d) httpd
Answer: d
8. Choose the exceptions generated by the GetResponseStream() method defined by WebRequest:

a) ProtocolViolationException
b) ObjectDisposedException
c) IOException
d) All of the mentioned
Answer: d
9. Which of these classes is used to create servers that listen to either local or remote client programs?

a) httpServer
b) ServerSockets
c) MimeHeader
d) HttpResponse
Answer: b
10. Which of these methods gives the full URL of an URL object?

a) fullHost()
b) getHost()
c) AbsoluteUri
d) toExternalForm()
Answer: c

Related

C Programming Questions and Answers on Static Variables for Freshers

1. What is the output of this C code? #include void main() { m(); m(); } void m() { static int x = 5; x++; printf...

HTML Multiple Choice Questions & Answers on Embracing the Reality of Web Markup for Freshers

1. Which of the following element represents a thematic break rather than a horizontal rule, though that is the likely representation? a) <dd> b) <dt> c) <hr> d) ...

Java Multiple Choice Questions & Answers on String Comparison for Freshers

1. Which of these method of class String is used to compare two String objects for their equality? a) equals()b) Equals()c) isequal()d) Isequal() Answer: a 2. Which of these methods is used to co...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item