adplus-dvertising
frame-decoration

Question

For the given set of codes, what is the output?
class Program
{
    static void Main(string[] args)
    {
        string[] strs = { ".com", ".net", "facebook.com", "google.net", "test", "netflix.net", "hsNameD.com" };
        var netAddrs = from addr in strs
                       where addr.Length > 4 && addr.EndsWith(".net",
                       StringComparison.Ordinal)
                       select addr;
        foreach (var str in netAddrs) Console.WriteLine(str);
        Console.ReadLine();
    }
}

a.

Compile time error

b.

Run time error

c.

facebook.com
netflix.net
google.net

d.

google.net
netflix.net

Posted under C# programming

Answer: (d).google.net
netflix.net

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. For the given set of codes, what is the output?