1. A banking
application is online. As soon as Martin finished his session, Lisa logged on
and did some banking. The connection string created for each of them is as
follows:
String
ConnStr= «Server=BankServer;Database=BankDB;User=Martin;Password=gilbo123;»
String
ConnStr= «Server=BankServer;Database=BankDB;User=Lisa;Password=kari75;»
Which of the
following statements will be correct in case the connection pooling is also
switched on?
Answers: • Lisa can not use someone else’s connection from
the connection pool
2. Which of
the following statements are false regarding the 3 timer classes provided by
the .NET framework?+
a)
System.Windows.Forms.Timer
b)
System.Timers.Timer
c)
System.Threading.Timer
Answers: • The event handler of all of the three Timers call the timer
event handler on a worker thread obtained from the Common Language Runtime
(CLR) thread pool.
3. Which 1.
Which of the following define the rules for .NET Languages?
Answers: • CLS, or • CTS
4. Which of
the following functions are used to wait for a thread to terminate?
Answers: • Join
5.
_____________ helped overcome the DLL conflict faced by the C# language
versions prior to .NET.
Answers: • GAC
6. What is
the benefit of using a finally{} block with a try-catch statement in C#?
Answers: • The finally block is always executed before the thread is
aborted.
7. In which
of the following namespaces is the Assembly class defined?
Answers: • System.Reflection
8. Which of
the following statements is true regarding predicate delegates in C#?
Answers: • Predicate delegates are references to functions
that return true or false.
9. What is
the syntax required to load and use a normal unmanaged windows DLL (e.g. kernel32.DLL)
in a managed .NET C# code?
Answers: • [DllImport(”kernel32”, SetLastError=true)]
10. Which of
the following is the correct way to implement deep copying of an object in C#?
Answers: • By using the
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter class.
11. 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$”;
string sResult
= Invalid.Trim(new char[]{‘$’});
Console.WriteLine(sResult);
Console.ReadLine();
}
Answers: • am$it
12. Which of
the following is the correct way to perform a LINQ query on a DataTable object?
Answers: • var results = from myRow in
myDataTable.AsEnumerable() where myRow.Field<int>(“RowNo”) == 1 select
new { IID= myRow.Field<int>(“IID”), Date =
myRow.Field<DateTime>(“Date”), };
13. What is
the purpose of the vshost.exe file in Visual Studio?
Answers:
• It is used to improve the performance of the Visual Studio
debugger.
• It is used
to improve the performance of Visual Studio plugins.
• It is used
to improve the performance of the C# compiler.
• It is used
to load Visual Studio configuration data.
14. An
Interface represents which kind of relationship?
Answers: • CAN DO
15. The .NET
Framework consists of:
Answers: • The Common Language Runtime and a set of class libraries
16. An enum
is defined in a program as follows:
[Flags]
public enum
Permissions
{
None = 0,
Read = 1,
Write = 2,
Delete = 4
}
What will be
the output of the following Main program (which has access to the enum defined
above) in this C# console application (Assume required namespaces are included)
:
static void
Main(string[] args)
{
var
permissions = Permissions.Read | Permissions.Write;
if
((permissions & Permissions.Write) == Permissions.Write)
{
Console.WriteLine(“Write”);
}
if
((permissions & Permissions.Delete) == Permissions.Delete)
{
Console.WriteLine(“Delete”);
}
if
((permissions & Permissions.Read) == Permissions.Read)
{
Console.WriteLine(“Read”);
}
Console.ReadLine();
}
Answers: • Write Read
17. Which of
the following keywords prevents a class from being overridden further?
Answers: • sealed
18. 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 does
the statement below do?
people.Sort((x,
y) => string.Compare(x.LastName, y.LastName));
Answers: • It will sort the string in place.
19. Which of
the following will correctly remove duplicates from a List<T>?
Answers: • List<T> withDupes = LoadSomeData();
List<T> noDupes = withDupes.Distinct().ToList();
No comments:
Post a Comment