1. Question: Which of the following code samples will create a comma separated list from IList<string> or IEnumerable<string>?

    A
    ublic static T[] ToArray(IEnumerable<T> source) { return new List<T>(source).ToArray(); } IEnumerable<string> strings = ...; string[] array = Helpers.ToArray(strings); string joined = string.Join(",", strings.ToArray()); string joined = string.Join(",", new List<string>(strings).ToArray());

    B
    List<string> ls = new List<string>(); ls.Add("one"); ls.Add("two"); string type = string.Join(",", ls.ToArray());

    C
    string commaSeparatedList = input.Aggregate((a, x) => a + ", " + x)

    D
    public static string Join(this IEnumerable<string> source, string separator) { return string.Join(separator, source); }

    Note: Not available
    1. Report
  2. Question: What is the advantage of using IList<T> over List<T>?

    A
    IList<T> uses reflection, which is the most efficient way to process an object inside memory.

    B
    IList<T> implements hashing to store objects in the collection; which produces optimum performance.

    C
    Using IList<T> rather than List<T> allows the code to be more flexible. It can replace the implementation with any collection that implements IList<T> without breaking any calling code.

    D
    IList<T> only allows immutable types to be stored inside the collection.

    Note: Not available
    1. Report
  3. Question: How can a single instance application be created in C#?

    A
    System.Threading.SingleInstance can be used to ensure that only one instance of a program can run at a time.

    B
    System.Threading.Mutex can be used to ensure that only one instance of a program can run at a time.

    C
    Locks can be used to force a C# application to launch a single instance at a time.

    D
    C# applications cannot be restricted to a single instance.

    Note: Not available
    1. Report
  4. Question: Which of the following code samples will execute a command-line program in C# and return its STD OUT results?

    A
    System.Diagnostics.Process pProcess = new System.Diagnostics.Process(); pProcess.StartInfo.FileName = strCommand; pProcess.StartInfo.Arguments = strCommandParameters; pProcess.StartInfo.UseShellExecute = false; pProcess.StartInfo.RedirectStandardOutput = true; pProcess.Start(); string strOutput = pProcess.StandardOutput.ReadToEnd(); pProcess.WaitForExit();

    B
    Process p = new Process(); p.StartInfo.UseShellExecute = true p.StartInfo.RedirectStandardOutput = false p.StartInfo.FileName = "YOURBATCHFILE.bat"; p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit();

    C
    System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("program_to_call.exe"); psi.RedirectStandardOutput = true; psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; psi.UseShellExecute = false; System.Diagnostics.Process proc System.Diagnostics.Process.Start(psi);; System.IO.StreamReader myOutput = proc.StandardOutput; proc.WaitForExit(2000); if (proc.HasExited) { string output = myOutput.ReadToEnd(); }

    D
    System.Diagnostics.Process pProcess = new System.Diagnostics.Process(); pProcess.StartInfo.FileName = strCommand; pProcess.StartInfo.Arguments = strCommandParameters; pProcess.StartInfo.UseShellExecute = false; pProcess.StartInfo.RedirectStandardOutput = true; pProcess.StartInfo.WorkingDirectory = strWorkingDirectory; pProcess.Start(); string strOutput = pProcess.StandardOutput.ReadToEnd(); pProcess.WaitForExit();

    Note: Not available
    1. Report
  5. Question: What is an Action delegate?

    A
    An Action is a delegate to a method, that takes zero, one or more input parameters, but does not return anything.

    B
    An Action is a delegate to a method, that takes zero, one or more input parameters, but always returns a boolean value.

    C
    An Action is a delegate to a method that takes one or more input parameters, but does not return anything.

    D
    An Action is a delegate to a method that takes one or more input parameters, but always returns a boolean value.

    Note: Not available
    1. Report
  6. Question: What is the difference between Expression<Func<T>> and Func<T>?

    A
    There is no difference between the two.

    B
    Func<T> denotes a delegate, while Expression<Func<T>> denotes a tree data structure for a lambda expression.

    C
    Func<T> denotes a function with parameter of dynamic type, while Expression<Func<T>> denotes a lambda expression.

    D
    None of these.

    Note: Not available
    1. Report
  7. Question: Which of the following statements is true about IEnumerable<T>?

    A
    IEnumerable<T> supports a Size property.

    B
    IEnumerable<T> supports a Count() extension.

    C
    IEnumerable<T> cannot be casted onto an ICollection<T>.

    D
    IEnumerable<T> cannot be casted onto an IList<T>.

    Note: Not available
    1. Report
  8. Question: Which of the following statements is true about the System.Environment.NewLine property?

    A
    It's a string containing "\n" for non-Unix platforms.

    B
    It's a string containing "\n" for Unix platforms.

    C
    It's a string containing "\r\n" for non-Unix platforms.

    D
    It's a string containing "\r\n" for Unix platforms.

    Note: Not available
    1. Report
  9. Question: An Interface represents which kind of relationship?

    A
    IS A

    B
    HAS A

    C
    CAN DO

    D
    None of these

    Note: Not available
    1. Report
  10. Question: Why is it a bad practice to use iteration variables in lambda expressions?

    A
    Iteration variables can cause problems with accessing a modified closure.

    B
    Iteration variables are passed by value, which produces unexpected results.

    C
    Iteration variables are passed by reference, which produces unexpected results.

    D
    It is perfectly valid to use iteration variables in lambda expressions.

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd