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

4/5

Page

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

Why are generics used?

Select an option to see the answer and solution.

What exception is thrown if the user does not have a proper authorization?

Select an option to see the answer and solution.

Select the type argument of open constructed type?

Select an option to see the answer and solution.

What does the following form define?
Protocol://HostName/FilePath?Query

Select an option to see the answer and solution.

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

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) 
    {
        Uri obj = new Uri("https://www.example.com");
        Console.WriteLine(obj.AbsoluteUri);
        Console.ReadLine();
    }
}

Select an option to see the answer and solution.

Which of these exceptions is thrown by the URL class's constructors?

Select an option to see the answer and solution.

What does the following C# code set defines?
public Gen(T o) {
                    ob = o; 
                }

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of these classes is used to create servers that listen to either local or remote client programs?

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("C++");
        Console.WriteLine(g.pop() + " ");
        Generic<int> g1 = new Generic<int>();
        g1.push(20);
        Console.WriteLine(g1.pop());
        Console.ReadLine();
    }
}

Select an option to see the answer and solution.

Which of the following classes is used to encapsulate IP address and DNS?

Select an option to see the answer and solution.

Which of these classes is used to encapsulate IP address and DNS?

Select an option to see the answer and solution.

Choose the correct way to call subroutine fun() of the sample class?
class a
{
    public void x(int p, double k)
    {
        Console.WriteLine("k : csharp!");
    }
}

Select an option to see the answer and solution.

What exception is thrown if the protocol supported by URI prefix is invalid?

Select an option to see the answer and solution.

What exception is thrown if the URI format is invalid?

Select an option to see the answer and solution.

Which namespace is mostly preferred for the operation of networking in C#?

Select an option to see the answer and solution.

How many bits are present in a single IP address?

Select an option to see the answer and solution.

What does URL stand for?

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<int> g = new Generic<int>();
        g.push("Csharp");
        Console.WriteLine(g.pop());
        Console.ReadLine();
    }
}

Select an option to see the answer and solution.