Vidyalelo
C# Programming · all questions

Networking in C Sharp
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

84

Questions

3/5

Page

Pick an option on a question to see the right answer and solution.

What is the purpose of the System.Net.WebSockets.ClientWebSocket class in C#?

Select an option to see the answer and solution.

Which method is used to close a network stream in C#?

Select an option to see the answer and solution.

What is the purpose of the System.Net.WebSockets.WebSocketServer class in C#?

Select an option to see the answer and solution.

Which class in C# is used for representing a URI (Uniform Resource Identifier)?

Select an option to see the answer and solution.

Which of these is a standard for communicating multimedia content over email?

Select an option to see the answer and solution.

Select the properties related to the network errors generated by WebException:

Select an option to see the answer and solution.

Which of these data members of HttpResponse class is used to store the response from a http server?

Select an option to see the answer and solution.

Which of the following are the interfaces defined by the namespace System.Net?

Select an option to see the answer and solution.

Which of the following are the protocols defined by .NET runtime?

Select an option to see the answer and solution.

Which of these classes is used for operating on the request from the client to the server?

Select an option to see the answer and solution.

What will be the output of the following C# code snippet?
public class Generic<T>
{
    Stack<T> stk = new Stack<T>();
    public void push(T obj)
    {
        stk.Push(obj);
    }
    public T pop()
    {
        T obj = stk.Pop();
        return obj;
    }
}
class Program
{
    static void Main(string[] args)
    {
        Generic<string> g = new Generic<string>();
        g.push(30);
        Console.WriteLine(g.pop());
        Console.ReadLine();
    }
}

Select an option to see the answer and solution.

Choose the exceptions generated by the GetResponseStream() method defined by WebRequest.

Select an option to see the answer and solution.

What does the following method specify?
public static WebRequest Create(string requestUriString)

Select an option to see the answer and solution.

Which of the following is the full form of DNS?

Select an option to see the answer and solution.

Which of the following class/classes supports the task of uploading and downloading the file?

Select an option to see the answer and solution.

Which of the following are the classes that support the standard HTTP protocol?

Select an option to see the answer and solution.

Which of these methods gives the full URL of an URL object?

Select an option to see the answer and solution.

What does the following C# code block define?
class Gen<T> {  
                 T ob;    
             }

Select an option to see the answer and solution.

Which of these is an correct way of defining generic method?

Select an option to see the answer and solution.

What will be the output of the following C# code?
class Program
{
    static void Main(string[] args)
    {
        int ch;
        HttpWebRequest req = (HttpWebRequest) WebRequest.Create("http://www.example.com");
        HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
        Stream istrm = resp.GetResponseStream();
        for (int i = 1 ;  ;i++)
        {
            ch = istrm.ReadByte();
            if (ch == -1) 
            break;
            Console.Write((char)ch);
            if ((i % 400) == 0)
            {
                Console.Write("\nPress Enter.");
                Console.ReadLine();
            }
        }
        resp.Close();
    }
}

Select an option to see the answer and solution.