C# Test
_____________ helped overcome the DLL conflict faced by the C# language versions prior to .NET.
An enum is defined in a program as follows: [Flags] public enum Permissions { None = 0, Read = 1, Write = 2, Delete = 4 ...
An Interface represents which kind of relationship?
Asynchronous execution is supported in ADO.NET 2.0 for?
Complete the following sentence: In C#, exception handling should be used...
Consider the following code block: public class Person { public string GetAge() { lock (this) { // Code to get Age of this person object. } } } Wh...
Consider the following code: string s1 = "Old Value"; string s2 = s1; s1 = "New Value"; Console.WriteLine(s2); What will be the output printed, and why?
How can a single instance application be created in C#?
If i == 0, why is (i += i++) == 0 in C#?
In C#, can global functions that are not associated with a particular class be defined?
In the sample code given below, which of the data members are accessible from class Y? class X { private int i; protected float f; public char c; } class Y : X { }
In which of the following namespaces is the Assembly class defined?
Is it possible to define custom Exception classes in C#?
One of the ternary operators provided in C# is:
Performance-wise, which of the following is the most efficient way to calculate the sum of integers stored in an object array?
Suppose a class is declared as a protected internal: protected internal class A { } Which statement is correct with regards to its accessibility?
Suppose there is a List of type Person with a property of LastName(string) and PopulateList is a function which returns a Generic List of type Person: List<Person> people = PopulateList(); What do...
The ___________ namespace is not defined in the .NET class library.
The .NET Framework consists of:
The global assembly cache:
There is a class that has a public int counter field that is accessed by multiple threads. This int is only incremented or decremented. To increment this field, three thread-safe approaches are men...
What are Satellite assemblies in C# .NET?
What are the benefits of using the ExpandoObject class over a using dictionary?
What is an Action delegate?
What is the advantage of using IList<T> over List<T>?
What is the benefit of using a finally{} block with a try-catch statement in C#?
What is the difference between data types "System.String" and "string" in C#?
What is the difference between Expression<Func<T>> and Func<T>?
What is the difference between int and System.Int32 CLR types?
What is the difference between the String and StringBuilder class objects with respect to mutability?
What is the issue with the following function? public string GetName(int iValue) { string sValue = "0"; switch (iValue) { case 1: sValue = iValue.ToString(); ...
What is the output of the following code: class CCheck { public static void Main() { string str = @"E:\RIL\test.cs"; Console.WriteLine(str); } }
What is the output of the following code? class Test { static void Main() { string myString = “1 2 3 4 5” myString = Regex.Replace(myString, @"s+", " "); System.Console.Writ...
What is the problem with the following function, which is supposed to convert a Stream into byte array? public static byte[] ReadFully(Stream input) { using (MemoryStream ms = new MemoryStream(...
What is the purpose of the catch block in the following code? try { // Code that might throw exceptions of different types } catch { // Code goes here }
What is the purpose of the vshost.exe file in Visual Studio?
What is the syntax required to load and use a normal unmanaged windows DLL (e.g. kernel32.DLL) in a managed .NET C# code?
What type of code is written to avail the services provided by Common Language Runtime?
What will be the output if in a WinForms application, the following code is executed in the Load event of a form? Assume this form has lblMessage as a Label Control. private void Form1_Load(object...
What will be the output of the following Main program in a C# console application (Assume required namespaces are included): static void Main(string[] args) { int @int = 15; ...
What will be the output of the following Main program in a C# console application (Assume required namespaces are included): static void Main(string[] args) { for (int i = 0; i < 1; i++) {...
What will be the output of the following Main program in a C# console application (Assume required namespaces are included)? static void Main(string[] args) { string Invalid = "$am$it$"; s...
What will be the output of the following Main program in a C# console application (Assume required namespaces are included)? static void Main(string[] args) { string sPrint = St...
What will be the return value if the function fn is called with a value of 50 for the parameter var? public int fn(int var) { int retvar = var - (var / 10 * 5); return retvar; }
What will be the value of result after these two statements? int num1 = 10, num2 = 9; int result = num1 ^ num2;
What will be the value of the result variable after these two statements? int num1 = 10, num2 = 9; int result = num1 & num2;
What will happen if the following code is compiled in .NET 4 or above (Assume required namespaces are included)? public class var { } public class main { public static void main(string[] args)...
Where does a C# assembly store the information regarding the other external dependencies, such as satellite assemblies, global assemblies etc, and their versions so that they can be loaded correctl...
Which object oriented term is related to protecting data from access by unauthorized functions?
Which of the following code samples will check if a file is in use?
Which of the following code samples will create a comma separated list from IList<string> or IEnumerable<string>?
Which of the following code samples will execute a command-line program in C# and return its STD OUT results?
Which of the following code snippets converts an IEnumerable<string> into a string containing comma separated values?
Which of the following code snippets for catch shows a better way of handling an exception? 1. catch (Exception exc) { throw exc; } 2. catch (Exception exc) { throw; }
Which of the following code snippets will call a generic method when the type parameter is not known at compile time?
Which of the following define the rules for .NET Languages?
Which of the following exceptions cannot be thrown by the Delete() function of the FileInfo class (ie. FileInfo.Delete())?
Which of the following functions are used to wait for a thread to terminate?
Which of the following is the correct code to close all references to the com objects below? Workbooks books = excel.WorkBooks; Workbook book = books[1]; Sheets sheets = book.WorkSheets; Worksheet...
Which of the following is the correct way to implement deep copying of an object in C#?
Which of the following is the correct way to perform a LINQ query on a DataTable object?
Which of the following is the correct way to randomize a generic list of 75 numbers using C#?
Which of the following is the correct way to sort a C# dictionary by value?
Which of the following is true about constructors and member functions?
Which of the following is true about friend functions in C#?
Which of the following is true for CLR?
Which of the following is true regarding a null and an empty collection in C#?
Which of the following keywords prevents a class from being overridden further?
Which of the following language code is not 'managed' by default in .NET framework?
Which of the following statements are true regarding the ref and out parameters in C#?
Which of the following statements is true about IEnumerable<T>?
Which of the following statements is true about the code below? string[] lines = theText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
Which of the following statements is true about the System.Environment.NewLine property?
Which of the following statements is true regarding predicate delegates in C#?
Which of the following statements is true regarding the code samples below? A: try { // code goes here } catch (Exception e) { throw e; } B: try { // code goes here } catch (Exception e) ...
Which of the following will block the current thread for a specified number of milliseconds?
Which of the following will correctly remove duplicates from a List<T>?
Which of the following will output the string below? " "
Which statements will give the path where the executing assembly is currently located?
Which type of class members are associated with the class itself rather than the objects of the class?
Why is it a bad practice to use iteration variables in lambda expressions?
Working with a list of Employees: List<Employee> lstEmployees = new List<Employee> { new Employee{Name="Harry",Age=15}, new Employee{Name="Peter",Age=22}...