- What’s the implicit name of the parameter that gets passed into the class’ set method? Value, and it’s datatype depends on whatever variable we’re changing.
- How do you inherit from a class in C#? Place a colon and then the name of the base class.
- Does C# support multiple inheritance? No, use interfaces instead.
- When you inherit a protected class-level variable, who is it available to? Classes in the same namespace.
- Are private class-level variables inherited? Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.
- Describe the accessibility modifier protected internal. It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in).
- C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write? Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in it.
- What’s the top .NET class that everything is derived from? System.Object.
- How’s method overriding different from overloading? When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.
- What does the keyword virtual mean in the method definition? The method can be over-ridden.
- Can you declare the override method static while the original method is non-static? No, you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.
- Can you override private virtual methods? No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.
- Can you prevent your class from being inherited and becoming a base class for some other classes? Yes, that’s what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It’s the same concept as final class in Java.
- Can you allow class to be inherited, but prevent the method from being over-ridden? Yes, just leave the class public and make the method sealed.
- What’s an abstract class? A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it’s a blueprint for a class without any implementation.
- When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)? When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.
- What’s an interface class? It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.
- Why can’t you specify the accessibility modifier for methods inside the interface? They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it’s public by default.
- Can you inherit multiple interfaces? Yes, why not.
- And if they have conflicting method names? It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.
- What’s the difference between an interface and abstract class? In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.
- How can you overload a method? Different parameter data types, different number of parameters, different order of parameters.
- If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor? Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
- What’s the difference between System.String and System.StringBuilder classes? System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.
- Is it namespace class or class namespace? The .NET class library is organized into namespaces. Each namespace contains a functionally related group of classes so natural namespace comes first.
Question 1: How many classes can a single .NET DLL contain?
1.)
512
2.) 1024
3.) 32767
4.) Unlimited =
Correct Answer
Question 2: The actual work process of
ASP.NET is taken care by
1.) inetinfo.exe
2.)
aspnet_isapi.dll
3.) aspnet_wp.exe = Correct Answer
4.)
None of the above
Question 3: An organization has
developed a web service in which the values of the forms are validated
using ASP.NET application. Suppose this web service is got and used by a
customer then in such a scenario which of the following is TRUE
1.)
The customer must be having technology that run ASP.
2.) Such a
situation cannot happen at all
3.) The customer can run on any
platform. = Correct Answer
4.) None of the Above
Question
4: I have an ASP.NET application. I have a page loaded from server
memory. At this instance which of the following methods gets fired
1.)
Load() = Correct Answer
2.) PreRender()
3.) Unload()
4.)
None of the Above
Question 5: Which property common in
every validation control?
1.) ValueToCompare
2.)
ValidationExpression
3.) ControlToValidate = Correct Answer
4.)
InitialValue
Question 6: In an Application Web form
allows users to enter a telephone number into a Textbox ASP.NET Web
server control named txtPhone. You use the RegularExpressionValidator
control to ensure that the phone numbers are in the correct format. The
Web form also includes a Button ASP.NET Web server control, btnReset, to
reset the data entry values. You do not want the validations to occur
when the button is clicked. What should you do to ensure this?
1.)
Set the CausesValidation property of the Button control to false. =
Correct Answer
2.) Set the CausesValidation property of the
TextBox control to false.
3.) Set the CausesValidation property
of the Button control to true.
4.) Set the CausesValidation
property of the TextBox control to true.
Question 7: In
my Web Form i.e asp.net form I have a control of DropDownList having 2
values of New York and Los Angeles .On submit of a button I redirect my
page to same URL.Instead of 2 values in DropDownList,I am able to see 4
values i.e 2 of New York and 2 of Los Angeles each.Why?
1.)
Because Page data is Cached.
2.) AutoPostBack Property is set to
false.
3.) AuotEventWireUp is set to false.
4.)
IsPostBack Validation not done in PageLoad Event. = Correct Answer
Question
8: Your ASP.NET application displays sales data on a page. You want to
improve performance by holding the page in memory on the server for one
hour. You want to ensure that the page is flushed from memory after one
hour, and that the page is re-created when the next request for the page
is received. What should you do?
1.) Initialize a new instance
of the Cache class in the Application.Start event handler. = Correct
Answer
2.) In the Web.config file, set the timeout attribute of
the sessionState element.
3.) Initialize a new instance of the
Timer class in the Page.Load event handler.
4.) Set the Duration
attribute of the OutputCache directive in the page.
Question
9: You are developing an asp.net page for www.abc.com , in that page
you need to provide an option to redirect to a web page that is in
www.def.com. which method you should use to perform the task ?
1.)
Server.Transfer()
2.) Response.Redirect() = Correct Answer
3.)
Response.Transfer()
4.) Request.Redirect()
Question
10: If you are developing your own User Control and you need to set
your property in Specific behavior. but you need to create your own
behavior in which you want to assign this property, then which is the
following attribute you need to set to achieve this functionality?
1.)
[System.ComponentModel.Category("YourOwnCategoryName")] = Correct
Answer
2.) [System.ComponentModel.Class("YourOwnCategoryName")]
3.)
[System.ComponentModel.SetBehavior("YourOwnCategoryName")]
4.)
[System.ComponentModel.BehaviorCategory("YourOwnCategoryName")]
Question
11: Which of the following denote value that can be taken by
Cache-Control of ASP.NET?
1.) Public
2.) Private
3.)
no-cache
4.) All the Above = Correct Answer
Question
12: How many types of cookies are there in ASP.NET ?
1.) 1
2.)
2 = Correct Answer
3.) 3
4.) 4
Question
13: How do you turn off cookies for one page in your site?
1.)
Cookie.close
2.) Cookie.abandon
3.) Cookie.discard =
Correct Answer
4.) None of the above
Question
14: You are designing a new control for use in ASP.NET applications. The
new control will be used to load an image from a disk file to an Image
control at runtime. The control will not need a runtime user interface,
but it must allow you to select a filename in the Properties window at
design time. Which type of control should you create?
1.) Web
custom control that inherits directly from WebControl = Correct Answer
2.)
Composite Web custom control
3.) Web user control
4.)
Web custom control that inherits directly from Label
Question
15: What is the event that is fired when an unhandled exception is
encountered within the application?
1.) Page_Error
2.)
Application_Error = Correct Answer
3.) Application_Disposed
4.)
System_Error
Question 16: Which type of assembly is
stored in GAC?
1.) Private assemblies
2.) Satellite
assemblies
3.) Shared assemblies = Correct Answer
4.)
protected assemblies
Question 17: How do you Make style
changes in whole ASP.Net website with minimal effort?
1.) Place a
theme under an ASP.NETClientFiles folder under the ASP.NET installation
directory
2.) Place a theme in the AppThemes directory under
the application root directory and Assign a theme by specifying the section in the Web.config file = Correct Answer
3.)
Assign a theme by setting the <%@ Page Theme="..." %> directive
to the name of the
application theme
4.) None of the above
Question
18: You created a Web control which consists of labels and associated
text boxes. How do you ensure that the Web control has both toolbox and
visual designer support?
1.) Add a Windows Control Library
project to your solution. Define a class that inherits from UserControl
2.)
Add a Web User Control to your project. Define a class that inherits
from UserControl
3.) Add a Mobile Web User Control to your
project. Define a class that inherits from MobileUserControl
4.)
Add a Web Control Library project to your solution. Define a class that
inherits from CompositeControl = Correct Answer
Question
19: What should you do to dynamically set the master page when a user
views pages in the application that contains two master pages?
1.)
Set Page.MasterPageFile in the Page's PageLoad event
2.) Set
Page.MasterPageFile in the Page's PagePreInit event = Correct Answer
3.)
Set Page.MasterPageFile in the Page's OnInit event
4.) Set
Page.MasterPageFile in the Page's PageInit event
Question
20: What you shoud do to add the web control in your ASP.NET web pages
without compiling your control into a .dll file?
1.) Ensure that
the Web control inherits from the CompositeControl class
2.)
Ensure that the Web control inherits from the Control class
3.)
Ensure that the Web control inherits from the UserControl class =
Correct Answer
4.) Ensure that the Web control inherits from the
WebControl class
Question 21: You have created a page
called UserPasswordReset.aspx for resetting the password. The new
password must be sent to user via email. Now How do you make sure, when
user logins via login.aspx user must be prompted to answer secret
questions to reset their password?
1.) Modify the Login.aspx
form to include a Required Field validator on the secret question answer
text box. Then redirect users to the PasswordReset.aspx file.
2.)
Add a PasswordRecovery element to the PasswordReset.aspx file and
configure it = Correct Answer
3.) Modify the PageLoad to set the
Membership.EnablePasswordReset to True in the PasswordReset.aspx file
4.)
Add a ChangePassword element to the PasswordReset.aspx file and
configure it
Question 22: What code will you write to
protect a page requested by user in a browser and after successful login
user must be sent back to the requested page in ASP.NET?
1.) In
the Web.config file:
name=".ASPXUSERDEMO"
loginUrl="login.aspx" protection="All" timeout="60"
/> =
Correct Answer
2.) On each page in the Web site: void
PageLoad(Object sender, EventArgs E){
Response.Redirect("login.aspx");
//Rest of the PageLoad code goes here}
3.) On each page in the
Web site: void PageLoad(Object sender, EventArgs E){
FormsAuthentication.RedirectToLoginPage("login.aspx");
//Rest of the PageLoad code
goes here}
4.) In the Web.config
file: On each
page in the
Web site: void PageLoad(Object sender, EventArgs E){
FormsAuthentication.Initialize();
//Rest of the PageLoad code goes here}
Question 23:
Some of the commonly used text strings are stored in your application
for use by the page in application. What should you do to ensure that
these text strings should be intialized only when the first user
accesses the application?
1.) Add code to the
Application_BeginRequest event handler in the Global.asax file to set
the values of the text strings.
2.) Add code to the
Session_OnStart event handler in the Global.asax file to set the values
of the text strings.
3.) Add code to the Application_OnStart
event handler in the Global.asax file to set the values of the text
strings. = Correct Answer
4.) Include code in the Page.Load
event handler for the default application page that sets the values of
the text strings when the IsNewSession property of the Session object is
set to True
Question 24: How do you add web services in
your application?
1.) In the Web References dialog box, type
the address of the XML Web service = Correct Answer
2.) Add a
using statement to your Global.asax.cs file, and specify the address of
the XML Web service
3.) Write an event handler in the
Global.asax.cs file to import the .wsdl and .disco files
associated
with the XML Web service. Your Answer
4.) On the .NET tab of the
Reference dialog box, select System.Web.Services.dll
Question
25: You need to develop a Toolbar control that is used by many
applications and can be able to add in Visual Studio.NET toolbox. What
will you do?
1.) Add a new Web user control to your ASP.NET
project.
Create the toolbar within the Web user control
2.)
Add a new Web Form to your ASP.NET project.
Design the toolbar within
the Web Form and save the Web Form with an .ascx extension
3.)
Create a new Web Control Library project.
Create the toolbar within a
Web custom control = Correct Answer
4.) Add a new component
class to your ASP.NET project.
Design the toolbar within the designer
of the component class
Question 26: What is the best
and fast way to extract information from XML documents based on user's
select?
1.) Create an XPathDocument object and load it with the
XML data.
Call the CreateNavigator method to create an XPathNavigator
object.
Call the Select method of the XPathNavigator object to run
an XPath query that extracts the requested data = Correct Answer
2.)
Create an XmlReader object.
Use the Read method of the object to
stream through the XML data and to apply an XPath
expression to
extract the requested data
3.) Create an XmlDataDocument object
and load it with the XML data.
Use the SelectNodes method of the
object to extract the requested data
4.) Create an
XmlDataDocument object and load it with the XML data.
Use the DataSet
property of the object to create a DataSet object.
Use a SQL SELECT
statement to extract the requested data
Question 27: You
need to store small amounts of data for specific page and that data
should be retrived in the server side. Security is not an issue here but
it should work on all the browser which does not support cookies. What
should you do?
1.) Store the information in hidden fields on the
page = Correct Answer
2.) Store the information in a Microsoft
SQL Server database
3.) Store the information in session state
variables.
4.) Store the information in application state
variables
Question 28: Which property setting should you
use for the CheckBoxList control to display its data in a row?
1.)
Set the RepeatLayout property to Flow
2.) Set the RepeatLayout
property to Table
3.) Set the RepeatDirection property to
Vertical
4.) Set the RepeatDirection property to Horizontal. =
Correct Answer
Question 29: You want to improve
performance of a web page by holding the page in memory on the server
for 30 minutes. After 30 minutes web page should be re-created. What
will you do?
1.) Set the Duration attribute of the OutputCache
directive in the page = Correct Answer
2.) In the Web.config
file, set the timeout attribute of the sessionState element
3.)
Initialize a new instance of the Timer class in the Page.Load event
handler
4.) Initialize a new instance of the Cache class in the
Application.Start event handler
Question 30: You want
the application to run in the security context of the user and
application uses Microsoft Windows authentication. What sould you do?
1.)
Use the Configuration Manager for your project to designate the user's
security context
2.) Add the following element to the system.web
section of the Web.config file:
=
Correct Answer
3.) Add the following element to the authe
ntication section of the Web.config file:
4.)
Write code in the Application_AuthenticateRequest event handler to
configure the
application to run in the user's security context
name=".ASPXUSERDEMO" loginUrl="login.aspx" protection="All" timeout="60"
/>
4.) Write code in the Application_AuthenticateRequest event handler to configure the
application to run in the user's security context
C# Technical Question
Question 1: Which Code segment should you use to ensure that a class named Age is written such that collections of Age objects can be sorted?
1.) public class Age { public int Value?
public object CompareTo(object obj)
{ if (obj is Age)
{ Age _age = (Age) obj?
return Value.CompareTo(obj)? }
throw new ArgumentException("object not an Age")? } }
2.) public class Age {
public int Value?
public object CompareTo(int iValue) {
try {
return Value.CompareTo(iValue)? }
catch {
throw new ArgumentException ("object not an Age")? } } }
3.) public class Age : IComparable {
public int Value?
public int CompareTo(object obj)
{ if (obj is Age) {
Age _age = (Age) obj?
return Value.CompareTo(_age.Value)? }
throw new ArgumentException("object not an Age")? } } = Correct Answer
4.) public class Age : IComparable {
public int Value?
public int CompareTo(object obj) {
try {
return Value.CompareTo(((Age) obj).Value)? }
catch {
return 1?
} } }
Question 2: Assume a class is created to compare a speciallyformatted string. The default collation comparisons do
not apply.Which code segment should you use to implement the IComparable interface?
1.) public class Person : IComparable{ public int CompareTo(object other){ ... }}
2.) public class Person : IComparable{ public int CompareTo(string other){ ... }} = Correct Answer
3.) public class Person : IComparable{ public bool CompareTo(object other){ ... }}
4.) public class Person : IComparable
Question 3: Which storage option should you use to Initialize each answer of a trueorfalse survey questionnaire to True? Also ensure to Minimize the amount of memory used by each survey?
1.) BitVector32 answers = new BitVector32(-1)? = Correct Answer
2.) BitVector32 answers = new BitVector32(1)?
3.) BitArray answers = new BitArray(1)?
4.) BitArray answers = new BitArray(-1)?
Question 4: Which type should you choose to identify a type that meets the following criteria: Is always a number?
Is not greater than 65,535?
1.) System.String
2.) System.UInt16 = Correct Answer
3.) System.IntPtr
4.) int
Question 5: A custom event handler needs to be created to automatically print all open documents. The event handler helps specify the number of copies to be printed. Which code segment should you use to develop a custom event arguments class to pass as a parameter to the event handler?
1.) public class PrintingArgs : EventArgs {
private int copies?
public PrintingArgs(int numberOfCopies) {
this.copies = numberOfCopies? }
public int Copies {
get { return this.copies? } }} = Correct Answer
2.) public class PrintingArgs {
private EventArgs eventArgs?
public PrintingArgs(EventArgs ea) {
this.eventArgs = ea? }
public EventArgs Args {get { return eventArgs? }}}
3.) public class PrintingArgs {
private int copies?
public PrintingArgs(int numberOfCopies) {
this.copies = numberOfCopies? }
public int Copies {
get { return this.copies? } }}
4.) public class PrintingArgs : EventArgs { private int copies?}
Question 6: Which code segment should you use to perform the following tasks: Retrieve the name of each paused service?
and Pass the name to the Add method of Collection1?
1.) ManagementObjectSearcher searcher = new ManagementObjectSearcher( "Select * from
Win32_Service")?
foreach (ManagementObject svc in searcher.Get())
{if ((string) svc["State"] == "'Paused'") {Collection1.Add(svc["DisplayName"])? }}
2.) ManagementObjectSearcher searcher =new ManagementObjectSearcher()?
searcher.Scope = new ManagementScope("Win32_Service")?
foreach (ManagementObject svc in searcher.Get())
{if ((string)svc["State"] == "Paused") {Collection1.Add(svc["DisplayName"])? }}
3.) ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from
Win32_Service",
"State = 'Paused'")?
foreach (ManagementObject svc in searcher.Get()) { Collection1.Add(svc["DisplayName"])?}
4.) ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from
Win32_Service
where State = 'Paused'")?
foreach (ManagementObject svc in searcher.Get()) {Collection1.Add(svc["DisplayName"])? } = Correct Answer
Question 7: An Application needs to be created to list processes on remote computers. The application requires a method that performs the following tasks: Accept the remote computer name as a string parameter named CompStr. Return an ArrayList object that contains the names of all processes that are running on that computer. Which code segment should you use to write a code segment that retrieves the name of each process that is running on the remote computer and adds the name to the ArrayList object?
1.) ArrayList al = new ArrayList()?
Process[] procs = Process.GetProcesses(CompStr)?
foreach (Process proc in procs) {al.Add(proc.ProcessName)?} = Correct Answer
2.) ArrayList al = new ArrayList()?
Process[] procs = Process.GetProcessesByName(CompStr)?
foreach (Process proc in procs) { al.Add(proc)?}
3.) ArrayList al = new ArrayList()?
Process[] procs = Process.GetProcesses(CompStr)?
foreach (Process proc in procs) { al.Add(proc)?}
4.) ArrayList al = new ArrayList()?
Process[] procs = Process.GetProcessesByName(CompStr)?
foreach (Process proc in procs) {al.Add(proc.ProcessName)?}
Question 8: Which code snippet should you use to gather regional information about customers in NewZealand?
1.) RegionInfo regionInfo = new RegionInfo("NZ")? // Output the region information... = Correct Answer
2.) foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{ // Output the region information...}
3.) RegionInfo regionInfo = new RegionInfo("")?if (regionInfo.Name == "NZ")
{ // Output the region information...}
4.) CultureInfo cultureInfo = new CultureInfo("NZ")? // Output the region information...
Question 9: Which code snippet should you use to write the encrypted data to a MemoryStream object? (Use the parameters as: The byte array 'messageByte' to be encrypted; encryption key 'keyEncr'; Initialization vector 'iv')
1.) DES des = new DESCryptoServiceProvider()?
ICryptoTransform crypto = des.CreateEncryptor(key, iv)?
MemoryStream cipherStream = new MemoryStream()?
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write)?
cryptoStream.Write(message, 0, message.Length)? = Correct Answer
2.) DES des = new DESCryptoServiceProvider()?
ICryptoTransform crypto = des.CreateEncryptor()?
MemoryStream cipherStream = new MemoryStream()?
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write)?
cryptoStream.Write(message, 0, message.Length)?
3.) DES des = new DESCryptoServiceProvider()?
ICryptoTransform crypto = des.CreateDecryptor(key, iv)?
MemoryStream cipherStream = new MemoryStream()?
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write)?
cryptoStream.Write(message, 0, message.Length)?
4.) DES des = new DESCryptoServiceProvider()?
des.BlockSize = message.Length?
ICryptoTransform crypto = des.CreateEncryptor(key, iv)?
MemoryStream cipherStream = new MemoryStream()?
CryptoStream cryptoStream = new CryptoStream(cipherStream, crypto, CryptoStreamMode.Write)?
cryptoStream.Write(message, 0, message.Length)?
Question 10: Which property of the Exception class should you use to find a line of code that caused an exception to be thrown?
1.) StackTrace = Correct Answer
2.) Data Your Answer
3.) Message
4.) Source
Question 11: Which code snippet should be used to serialize an object by name 'Data' of type List(Of Integer) in a binary format?
1.) Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream() For i As
Integer = 1 To 20
formatter.Serialize(ms, data(i - 1))Next
2.) Dim formatter As New BinaryFormatter()Dim ms As New
MemoryStream()formatter.Serialize(ms, data) = Correct Answer
3.) Dim formatter As New BinaryFormatter()Dim buffer As New Byte(data.Count) {}Dim ms As
New MemoryStream(buffer, True)formatter.Serialize(ms, data)
4.) Dim formatter As New BinaryFormatter()Dim ms As New MemoryStream()While
ms.CanRead formatter.Serialize(ms, data)End While
Question 12: Which code snippet should be used to write a code segment that loads an assembly named Customer1.dll into the current application domain?
1.) AppDomain ^ domain = AppDomain::CurrentDomain;String^ myPath =
Path::Combine(domain->BaseDirectory,"Customer1.dll");
Assembly^ assm = Assembly::Load(myPath);
2.) AppDomain^ domain = AppDomain::CurrentDomain;String^ myPath =
Path::Combine(domain->DynamicDirectory,"Customer1.dll");
Assembly^ assm = AppDomain::CurrentDomain::Load(myPath);
3.) AppDomain^ domain = AppDomain::CurrentDomain;String^ myPath =
Path::Combine(domain->BaseDirectory,"Customer1.dll");
Assembly^ assm = Assembly::LoadFrom(myPath); = Correct Answer
4.) AppDomain^ domain = AppDomain::CurrentDomain;Assembly^ assm =
Domain->GetData("Customer1.dll");
Question 13: Which code snippet should you use to make the runtime assign an unauthenticated principal object to each running thread?
1.) AppDomain^ domain =
AppDomain::CurrentDomain;domain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal);
2.) AppDomain^ domain =
AppDomain::CurrentDomain;domain-
>SetPrincipalPolicy(PrincipalPolicy::UnauthenticatedPrincipal); = Correct Answer
3.) AppDomain^ domain =
AppDomain::CurrentDomain;domain->SetThreadPrincipal(gcnew WindowsPrincipal(nullptr));
4.) AppDomain^ domain =
AppDomain::CurrentDomain;domain-
>SetAppDomainPolicy(PolicyLevel::CreateAppDomainLevel());
Question 14: Which code snippet should you use to create an event that will invoke FaxDocs? We have the code as
public delegate void FaxDocs(Object^ sender, FaxArgs^ args);
1.) public ref class FaxArgs : public EventArgs {
public :
String^ CoverPageInfo;
FaxArgs (String^ coverInfo) {
this->CoverPageInfo = coverInfo;
}};
2.) public ref class FaxArgs : public EventArgs {
public :
String^ CoverPageInfo;};
3.) public : static event FaxDocs^ Fax; = Correct Answer
4.) public : static event Fax^ FaxDocs;
Question 15: Which code snippet should you use to load an assembly named Service1.dll into the current
application domain? (your application dynamically loads assemblies from an application directory)
1.) Dim domain As AppDomain = AppDomain.CurrentDomainDim myPath As String = _
Path.Combine(domain.BaseDirectory, "Service1.dll")Dim asm As [Assembly] =
[Assembly].Load(myPath)
2.) Dim domain As AppDomain = AppDomain.CurrentDomainDim myPath As String =
_ Path.Combine(domain.BaseDirectory, "Service1.dll")Dim asm As [Assembly] =
[Assembly].LoadFrom(myPath) = Correct Answer
3.) Dim domain As AppDomain = AppDomain.CurrentDomainDim asm As [Assembly]
= domain.GetData("Service1.dll")
4.) Dim domain As AppDomain = AppDomain.CurrentDomainDim myPath As String = _
Path.Combine(domain.DynamicDirectory, "Service1.dll")Dim asm As [Assembly] = _
AppDomain.CurrentDomain.Load(myPath)
Question 16: Which code snippet should you use to read the entire contents of a file named Service.txt into a single string
variable?
1.) Dim result As String = NothingDim reader as New
StreamReader("Service.txt")result = reader.ReadToEnd() = Correct Answer
2.) Dim result As String = string.EmptyDim reader As New
StreamReader("Service.txt")While Not reader.EndOfStream
3.) Dim result As String = NothingDim reader As New
StreamReader("Service.txt")result = reader.Read().ToString()
4.) Dim result as String = NothingDim reader As New
StreamReader("Service.txt")result = reader.ReadLine()
Question 17: Whic code should you use to transfer the contents of a byte array named dataToSend by using a NetworkStream object named netStream? (You need to use a cache of size 8,192 bytes)
1.) BufferedStream^ bufStream =
gcnew BufferedStream(netStream, 8192);bufStream->Write(dataToSend, 0, dataToSend-
>Length); = Correct Answer
2.) BufferedStream^ bufStream =
gcnew BufferedStream(netStream);bufStream->Write(dataToSend, 0, 8192);
3.) MemoryStream^ memStream = gcnew
MemoryStream(8192);netStream->Write(dataToSend, 0, (int) memStream->Length);
4.) MemoryStream^ memStream = gcnew
MemoryStream(8192);memStream->Write(dataToSend, 0, (int) netStream->Length);
Question 18: Which code snippet should be used to create a class definition that is interoperable along with COM and also to ensure that COM applications can create instances of the class and can call the GetAddress method?
1.) public class Customer {
string addressString;
public Customer() { }
internal string GetAddress() { return addressString; }}
2.) public class Customer {
string addressString;
public Customer() { }
public string GetAddress() { return addressString; }} = Correct Answer
3.) public class Customer {
static string addressString;
public Customer() { }
public static string GetAddress() { return addressString; }}
4.) public class Customer {
string addressString;
public Customer(string address) { addressString = address; }
public string GetAddress() { return addressString; }}
Question 19: Which of the given method does not belong to System.Object?
1.) Equals
2.) Clone = Correct Answer
3.) GetType
4.) ToString
Question 20: Which Namespace helps to find informations of an assembly?
1.) System.Globalization
2.) System.IO
3.) System.Reflection = Correct Answer
4.) System.Data
Question 21: A User wants to use reflection to discover the assembly that contains a specific module. which one of the following classes does the user should use?
1.) Module = Correct Answer
2.) ConstructorInfo
3.) PropertyInfo
4.) Assembly
Question 22: A User wants to deploy a zero impact .NET application (one that will not affect other applications, does not use the registry, and leaves no residue on removal).In the above scenario, which one of the following must the User deploy?
1.) A Dynamic assembly = Correct Answer
2.) A global assembly
3.) A static assembly
4.) A Public assembly
Question 23: If you are using transactions, what is a great technique that can help you roll back to certain points within a transaction?
1.) Tables
2.) Zones
3.) Savepoints = Correct Answer
4.) Bookmarks
Question 24: Which of the following is Reference Type?
1.) string = Correct Answer
2.) bool
3.) int
4.) ushort
Question 25: Whats the difference between a Thread and a Process?
1.) A process can have multiple threads in addition to the primary thread = Correct Answer
2.) A process is code that is to be serially executed within a thread
3.) When a process begins to execute, it continues until it is killed or until it is interrupted by a process with higher priority
4.) No Difference, they are so same thing
Question 26: What is the term for assemblies that are marked for a specific culture via their AssemblyCultureAttribute?
1.) Sattellite assemblies = Correct Answer
2.) Cultured assemblies
3.) Multilanguage assemblies
4.) Global assemblies
Question 27: Which one of the following statement is true for Assembly's Manifest?
1.) It loads the header file for the referenced assembly
2.) Enumerates other independent assemblies.
3.) Provides a level of indirection between consumers of the assembly and the assembly's implementation. = Correct Answer
4.) It loads the System Registry.
Question 28: Which one of the following .NET Framework tools displays details for failed assembly binds?
1.) asm.exe
2.) logvw.exe
3.) logasm.exe
4.) Fuslogvw.exe = Correct Answer
Question 29: Which of the following tools manages certificates, certificate trust lists (CTLs), and certificate revocation lists (CRLs)?
1.) sn.exe
2.) certnet.exe
3.) certmgr.exe = Correct Answer
4.) ctl.exe
Question 30: Code Access Security does which one of the following?
1.) Defines permissions and permission sets that represent the right to access various system resources
2.) Grants permissions to each assembly that is loaded, based on the permissions requested by the code
3.) Enables code to demand that its callers have specific permissions
4.) All of the above = Correct Answer