Do you know that? For designers $50 - $79 per-hour range. next

Contact Email: teammmrem@yahoo.com

<< All Upwork (oDesk) and Elance Tests << Elance test answers << IT & Programming category

Test answers for .NET 2016

(149, CL) Last updated: January 23
Elance • IT & Programming
Questions and answers are regularly updated. Answered and not answered tests questions.

This helps getting job: Hundreds of (cover letter examples , interview questions , profile samples ) • Earn on Upwork (oDesk)
Job assistance: jobs popularityfreelance rates

Popular test answers: HTML, .Net, CSS, English, SEO, Photoshop, iOS, Java, Android, Ruby, Python, JavaScript

See all 6 tests answers updated

Find Upwork (oDesk) and Elance test answers on this website:



Collapse | Expand

149 Answered Test Questions:

1. Which of the following reasons make C# a widely used professional language?

Answers:

• All of the given options are correct

• Structured language

• Component oriented

• Object oriented

2. In C#, a local variable ________.

Answers:

• Can be used anywhere in the program

• Represents a class object

• Is declared within a method

• Must accept a class

3. A delegate is _______.

Answers:

• A class that encapsulates methods

• A Washington representative

• A means of passing arrays into methods

• A substitue for an inherited method

4. In C#, use _______ to return a thread from a suspended state.

Answers:

• Interrupt

• Restart

• Resume

• Pulse

5. A _______ block encloses code that could throw an exception.

Answers:

• Exception

• Catch

• Error

• Try

6. In ASP.NET, what is the extension of a web user control file?

Answers:

• .ascx

• .asmx

• .ashx

• .aspx

7. In C#, what does the following code create: String mystring;

Answers:

• A class

• An object

• A class and a constructor

• A constructor

8. An abstract class _______.

Answers:

• May extend another class

• All of these

• May contain constructors

• May contain instance variables

9. In C#, a constructor ________.

Answers:

• Must have the same name as the class it is declared within

• Is used to create objects

• All of these

• May be overloaded

10. Which C# code will output an element's value from a multidimensional array?

Answers:

• Console.WriteLine( myArray(1),(3) );

• Console.WriteLine( myArray{1}{3} );

• Console.WriteLine( myArray[1.3] );

• Console.WriteLine( myArray[1][3] );

11. To configure authentication for your Web application so clients cannot access it anonymously, but access is allowed for users from untrusted domains, where should the following code be added to?  <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" /> </authentication> <authorization> <deny users="?" /> </authorization> </system.web>

Answers:

• The app.config file

• The web.config file

• The project's property pages

• The workstation's machine.config file

12. When an .aspx page is requested from the web server, the output is rendered to the browser in which format?

Answers:

• wml

• txt

• html

• jsp

13. The ASP.NET server control, which provides an alternative way of displaying text on web page, is:

Answers:

• < asp:listitem >

• < asp:label >

• < asp:button >

14. In ASP.NET, postback occurs in which of the following forms?

Answers:

• Winforms

• HTMLForms

• Webforms

15. Which of the following is not a component of .Net framework?

Answers:

• Windows Forms

• JVM

• Metadata and Assemblies

• Common Language Specification

16. In ASP.NET, does EnableViewState allow the page to save user input on a form?

Answers:

• Yes

• No

17. In the body of a method, C# uses the variable named ________ to refer to the current object whose method is being invoked.

Answers:

• this

• that

• call

• do

18. In C#, the following code measures time in _______. Thread.Sleep(time)

Answers:

• Nanoseconds

• Seconds

• Minutes

• Milliseconds

19. A Thread _______.

Answers:

• Is an object that wraps itself with other threads

• Is a deprecated object that is no longer used

• Does not exist

• Is an object that allows computer multitasking

20. In C#, what is the proper header for a class that intends to use an interface?

Answers:

• class MyClass : Iface

• class MyClass {IFace}

• class MyClass ; Iface

• class MyClass Iface

21. In C#, a variable declared inside a method is called a _________ variable.

Answers:

• Local

• Private

• Static

• Serial

22. In C#,  is it possible to pass methods as arguments for other methods without modification.

Answers:

• True

• False

23. In C#, defining two methods in single class with the same name but with different sets of argument types is called _______.

Answers:

• Overriding

• Duplexing

• Multiplexing

• Overloading

24. How do you manage states in an ASP.NET application?

Answers:

• All of these

• Application objects

• Viewstate

• Session objects

25. A class declared with the sealed keyword cannot be a base class.

Answers:

• True

• False

26. What type of processing model does ASP.NET simulate?

Answers:

• Static

• Linear

• Top-down

• Event-driven

27. The first event to be triggered in an .aspx page is:

Answers:

• Page.Init

• Page.Load

• Page.PreRender

28. Which of the following is not a VALID C# access specifier ?

Answers:

• Private

• Static

• Protected

• Public

29. A String literal _______.

Answers:

• Contains numbers rather than letters

• Contains only one character

• Contains exactly its variable name and nothing else

• Is a sequence of characters in double quotation marks

30. True or false? In C#, a class can inherit from multiple interfaces.

Answers:

• False

• True

31. String indexers treat strings as _______.

Answers:

• Binary code

• A character

• Arrays of characters

• 1 to string length

32. Which of the following keywords is used to include existing namespace in a C# program?

Answers:

• import

• namespace

• package

• using

33. Exception objects are derived from the _______ class.

Answers:

• Event

• Exception

• Catch

• System

34. Which of the following is a valid syntax of entry point of all C# programs?

Answers:

• static Main(string args)

• static void Main(string[] args)

• Static void Main(string[] args)

• static Main(string[] args)

35. Which of the following are part of ASP.NET?

Answers:

• SignalR

• All answers are correct.

• ASP.NET and MVC

• Web Forms and MVC.

• Web Forms, MVC, and Web API

36. To be able to use following statement, which particular namespace has to be included in a C# program? Console.WriteLine("Hello World")

Answers:

• Console

• WriteLine

• System

• Print

37. Which of the following exception is thrown when a member/class lookup results in more than one member/class matching the lookup criteria?

Answers:

• System.Reflection.AmbiguousMatchException

• FileNotFoundException

• FormatException

• AppDomain.UnhandledException

38. Synchronization means _______.

Answers:

• Make every thread start and end at the same time

• Ensure that two concurrently-executing threads or processes do not execute specific portions of a program at the same time

• Delay a thread until there is sufficient memory and work to keep it up

• Make every thread do the same thing

39. Which of the following namespaces contain types that enable interaction with system processes, event logs, and performance counters?

Answers:

• System.AddIn

• System.Data

• System.Diagnostics

• System.ComponentModel

40. An event is _______.

Answers:

• Code used to force a user action

• Not an object type

• The result of a user action

• The result of a party

41. To create a string literal exclude escape sequence, use _______.

Answers:

• $string

• @string

• !string

• #string

42. In ASP.NET, which method do you invoke on the Data Adapter control to load your generated dataset?

Answers:

• Fill()

• Read( )

• ExecuteQuery( )

43. In ASP.NET, to what namespace does the Web page belong in the .NET Framework class hierarchy?

Answers:

• System.web.UI.Page

• System.Web.page

• System.Windows.Page

44. What does the following code snippet imply : namespace TestApplication   {     class HelloWorld {} }

Answers:

• TestApplication namespace contains the class HelloWorld

• Compilation error

• TestApplication class contains the namespace HelloWorld

• TestApplication class contains the class HelloWorld

45. In ASP.NET, why is Global.asax used?

Answers:

• To declare Global variables

• Neither of these

• To implement application and session level events

46. Which of the following would force an immediate garbage collection of all generations?

Answers:

• GCCollect()

• GC.Garbage()

• GC.Force()

• GC.Collect()

47. Which caching type is supported by ASP.NET?

Answers:

• None of these

• Data caching

• Output caching

• Output caching and data caching

48. In ASP.NET, to add a custom control to a Web form you have to register with:

Answers:

• TagPrefix

• Assemblyname

• The namespace of the .dll that is referenced

• All of these

49. In C#, what does the following code do: class Test: Form { }

Answers:

• Creates the class Test : Form

• Creates the class Test : Form and creates the class Test that inherits the class Form

• Creates the class Test that inherits the class Form

• Creates the class Form that inherits the class Test

50. In C#, every class directly or indirectly extends the ________ class.

Answers:

• Drawing

• Object

• System

• Console

51. In ASP.NET, what control does not have any visible interface?

Answers:

• DropdownList

• Repeater

• Datagrid

• Datalist

52. Your Web application, ABCWebApp1, is configured to use Windows Authentication. After granting a specific group NTFS permissions to access a specific file named ABC.doc, you need to ensure that users not belonging to this group cannot access the file. You should _______.

Answers:

• Configure the app.config file to include the <authentication mode="[None]"> element

• Configure the machine.config file to include the <identity impersonate="true"/> element

• Configure the Web.config file to include the <identity impersonate="true"/> element

• Configure the machine.config file to include the <authentication mode="[None]"> element

53. Which of the following kick in the Garbage Collector (GC) process?

Answers:

• The system has low physical memory

• The total memory being used on the managed heap exceeds the acceptable threshold

• When GC.Collect method is invoked

• All of the given options are correct

54. How is ASP.NET different from classic ASP?

Answers:

• Scripting is separated from the HTML, and code is interpreted separately

• Code is separated from the HTML, and interpreted code is interpreted separately

• Scripting is separated from the HTML, code is compiled as a DLL, and DLLs can be executed on the server

55. Which of the following is true about the following : for(;;) {  Console.WriteLine("Testing for loop"); }

Answers:

• Compilation error

• It's an infinite loop

• "Testing for loop" will get printed twice

• "Testing for loop" will get printed once

56. Which of the following "type" of members are accessible only within files in the same DLL ?

Answers:

• Internal

• Protected

• Private

57. To develop an application that meets the following requirements, you should consider using the _______ method. ??? A different ASPX page is displayed when the application's original URL is entered ??? After the page executes, the original URL is not visible to users ??? A single client browser request is sufficient for the execution of a page

Answers:

• HttpContext.Current.ToString

• HttpContext.Current.GetType

• HttpContext.Current.RemapHandler

• HttpContext.Current.RewritePath

58. A method _______ an exception when that method detects that a problem has occured.

Answers:

• Trys and Catches

• Throws

• Catches

• Trys

59. BCL stands for?

Answers:

• Bass Class Language

• Base Class Libraries

• Binary Class Language

• Binary Common Libraries

• Base Class Language

60. How many generations does Garbage Collector use for Small Objects in .Net?

Answers:

• 6

• 4

• 5

• 3

61. In C#, for a class to use an interface, it must _______.

Answers:

• All of these

• Create an interface object

• Contain the same methods as the interface

• Inherit the properties of the interface

62. The number of forms that can be added to a .aspx page is ________.

Answers:

• 1

• 2

• 3

• More than 3

63. Which of the following represents a thread-safe map of key/value pair and can be used in a multi-threaded environment?

Answers:

• ConcurrentBag

• ConcurrentDictionary

• BlockingCollection

• ConcurrentQueue

64. Your Web application includes a page named ErrorPage.aspx. To manage unhandled application exceptions, ErrorPage.aspx should be shown and exception data should be written to the event log. Your web.config file includes the following code:  <customErrors mode="On" defaultRedirect="ErrorPage.aspx" />  Next, you should consider _______.

Answers:

• Adding this code to the master page: void Application_Error(object sender, EventArgs e){Exception exc = Server.GetLastError();//Write Exception details to event log}

• Adding this code to the Default.asax file: void Application_Error(object sender, EventArgs e){Exception exc = Server.GetLastError();//Write Exception details to event log}

• Adding this code to the ErrorPage.aspx file: void Page_Error(object sender, EventArgs e){Exception exc = Server.GetLastError();//Write Exception details to event log Server.ClearError();}

• Adding this code to the Global.asax file: void Application_Error(object sender, EventArgs e){Exception exc = Server.GetLastError();//Write Exception details to event log}

65. Which of the following namespaces contain types that support deployment of ClickOnce applications?

Answers:

• System.Configuration

• System.Data

• System.ComponentModel

• System.Deployment

66. In C#, what code converts a string to lowercase?

Answers:

• string.ToLower();

• string.ToLower(string);

• ToLower(string);

• String = string.ToLower(string);

67. Your Web application lets users upload files and is hosted in Microsoft IIS 6.0 on a server named ABC-SR01. The application uses the default application pool with Windows Authentication. You cannot upload a file from your workstation using the application; instead, you see an access denied message. To fix this problem, you enable debugging. Next, you should _______.

Answers:

• Add your Windows user account to the Administrators group on ABC-SR01

• Stop and restart the application pool on ABC-SR01

• Add the following configuration to the Web.config file <identity impersonate="true" />

• Create a Debugger Users group on your workstation and add your Windows user account to it

68. Which of the following is the actual .net code translated into?

Answers:

• CLR

• CLS

• CTS

• MSIL

69. Which of the following is a valid C# constant definition?

Answers:

• final <data_type> <constant_name> = value;

• const <data_type> <constant_name> = value;

• constant <data_type> <constant_name> = value;

• (all of these)

70. The ThreadPriority enumeration does not contain _______.

Answers:

• Belownormal

• Highest

• Lowest

• ThreadPriority enumeration contains all of these.

71. In C#, two StringBuilder objects that contain the same string _______.

Answers:

• All of these

• Represent the same memory location

• Are two different objects

• Are both changed when a change is made to either

72. Your Web application has a master page with a static navigation menu. All content pages in the application use this master page, but may also substitute their own menu controls for those in the static navigation menu. After writing the following code, you should consider _______. Dim placeHolder As PlaceHolder = TryCast( _Page.Master.FindControl("MenuPlaceHolder"), PlaceHolder)  Dim menuControl As New Menu() placeHolder.Controls.Add(menuControl)

Answers:

• Adding the code segment to the master page

• Adding the code segment to the Page_Load event of the content page

• Adding the code segment to the default page

• Adding the code segment directly to the content page

73. To ensure that the timing and performance data of your web application is gathered and only made available to users when they are logged on the web server, which code should you add to the Web.config file?

Answers:

• <compilation debug="true" urlLinePragmas="false"> ... </compilation>

• <trace enabled="true" pageOutput="false" localOnly="true" />

• <compilation debug="false" urlLinePragmas="true"> ... </compilation>

• <trace enabled="false" pageOutput="true" localOnly="false" />

74. In ASP.NET, how do you register a user control?

Answers:

• Add Source, Tag prefix

• Add Src, Tagprefix, Tagname

• Add Tag prefix, Tag name

75. In ASP.NET, IsPostBack is a ________.

Answers:

• Read-only property of the System.Web.UI.Page class

• Method of the System.UI.Web.Page class

• Method of the System.Web.UI.Page class

76. In which of the following GC Collection mode the garbage collector determines whether the current time is optimal to reclaim objects?

Answers:

• Parallel

• Optimized

• Forced

• Concurrent

77. In your Web application, you create a class to implement the IHttpHandler interface. Which code will display the Warning.jpg image in the browser whenever the handler is requested?

Answers:

• public void ProcessRequest(HttpContext ctx){StreamReader sr = new StreamReader(OpenRead(ctx.Server.MapPath("Warning.jpg")));ctx.Response.Pics("pic ");sr.Close();}

• public void ProcessRequest(HttpContext ctx){ctx.Response.TransmitFile("image/jpg");(_ctx.Server.MapPath("Warning.jpg"));Stream b = default(Stream);while ((b == fs.ReadByte()) != -1) {ctx.Response.Output.Write((b));}Fs.Close();}

• public void ProcessRequest(HttpContext ctx){StreamReader sr = new StreamReader(_File.OpenRead(ctx.Server.MapPath("Warning.jpg")));ctx.Response(sr.ReadToEnd());}

• public void ProcessRequest(HttpContext ctx){ctx.Response.ContentType = "image/jpg";FileStream fs = File.OpenRead(_ctx.Server.MapPath("Warning.jpg"));int b = 0;while ((b == fs.ReadByte()) != -1) {ctx.Response.OutputStream.WriteByte(Convert.ToByte(b));}fs.C

78. In your Web application named ABCWebApp1, you have configured a custom-templated server control named ABCSC that has child controls in the page.  To help ensure distinctive identification of the child controls within the hierarchy of the page, you should consider applying the _______ interface.

Answers:

• INamingContainer

• IDisposable

• GCNotificationStatus Enumeration

• IBindableTemplate

79. The String class and Char structure are found in the _______.

Answers:

• System.Chars namespace

• System.Strings namespace

• System namespace

• System.Text namespace

80. You create a Web page named enterDetails.aspx that includes a TextBox control named txtDetails. The enterDetails.aspx page cross-posts to another page, displayDetails.aspx, which includes a Label control named lblDetails. What code will ensure that text entered in the the txtDetails TextBox control is displayed by the lblDetails Label control?

Answers:

• TextBox txtDetails = NextPage.FindControl("txtDetails") as TextBox; lblName.Text = txtDetails.Text;

• TextBox txtDetails = PreviousPage.FindControl("txtDetails") as TextBox; lblName.Text = txtDetails.Text;

• TextBox txtDetails = FindControl("txtDetails") as lblDetails;lblName.Text = lblDetails.Text;

• TextBox txtDetails = PreviousPage.FindControl("txtDetails") as lblDetails; lblName.Text = lblDetails.Text;

81. While browsing your Web application in IIS 6.0, you receive a Server Application Unavailable error. The application event log states: It is not possible to run two different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process.  To solve this problem as quickly as possible, you should _______.

Answers:

• Change the IIS isolation mode and assign the application to a new application pool

• Change the IIS isolation mode and restart the application pool that hosts the application

• Assign the application to a new application pool and run the Aspnet_regiis.exe tool

• Assign the application to a new application pool and configure all applications that are part of your application's application pool to use the same version of ASP.NET

82. In ASP.NET, how do you explicitly kill a user session?

Answers:

• Session.Discard( )

• Session.End

• Session.Close( )

• Session.Abandon

83. Your Web form uses the following code to display data from a SQL Server 2005 database. What must you add to the _ItemBound event handler in order to access the value of the hlName HyperLink in a variable named var? <asp:RepeaterID="ABCRepeater" runat="server"DataSourceID="SqlDS1" ItemDataBound="_ItemBound"> <ItemTemplate><asp:Hyperlink ID="hlName" runat="server"Text='<%# Eval("ProdName") %> NavigateURL='<%# Eval("ProdURL") %>' /> </ItemTemplate></asp:Repeater>

Answers:

• HyperLink var = rptData.FindControl("hlName") as HyperLink;

• HyperLink var = Page.FindControl("hlName") as HyperLink;

• HyperLink var = e.Item.Parent.FindControl("hlName") as HyperLink;

• HyperLink var = e.Item.FindControl("hlName") as HyperLink;

84. Which of the following is not a VALID variable type in C#?

Answers:

• Value

• Numeral

• Reference

• Pointer

85. Your Web application contains the following class: public class Certs { public string Title {get; set;} public string Number { get; set; } public string Vendor { get; set; } } You store data in certData.xml with the following structure: <Certs> <title>cert title</title> <code>xx-xxx</code> <vendor>vendor name</vendor> </Certs> Which code segment will bind the data in certData.xml to the instance of List<Certs> named ABCCertsList?

Answers:

• certData.DataSource = ABCCertList;certData.DataValueField = "Certs.title";certData.DataBind();

• XmlSerializer xmlserial = new XmlSerializer(typeof(Certs));Certs cert = xmlserial.Deserialize(xmlStream) as Certs;ABCCertList.Text = cert.title();

• certData.DataSource = ABCCertList;certData.DataTextField = "title";certData.DataBind();

• XmlReader xmlread = XmlReader.Create(xmlStream);Certs cert = xmlread.ReadContentAs(typeof(Certs),null) as Certs;ABCCertList.Text = cert.title();

86. Your Web application on IIS 6.0 includes OldPage.aspx. When a user tries to access OldPage.aspx, the browser should display the URL for OldPage.aspx, but open NewPage.aspx. Which code will accomplish this?

Answers:

• Server.Transfer("NewPage.aspx");

• Server.MapPath("NewPage.aspx");

• Server.Execute("NewPage.aspx");

• Response.Redirect("NewPage.aspx");

87. Evaluate. Which statement must be true for the code to compile and run correctly? public class B : A { public B(int i) :base(i) { } }

Answers:

• One of the constructors in the class A takes an argument of the type i

• One of the constructors in the class A takes an argument of the type int

• Class A has only a default constructor

• One of the constructors in the class A takes an argument of the type I, and the class has only a default constructor

88. Your Web appplication, ABCApp1, is hosted on ABC-SR13 and runs an instance of MS SQL Server 2005 locally configured to use Windows Authentication.  As you prepare to configure the role management and membership providers on ABC-SR13, you should consider using _______.

Answers:

• The Aspnet_merge.exe command

• The ASP.NET SQL Server registration tool

• The Aspnet_compiler.exe command and the aspnet_regiis.exe command

• The Aspnet_compiler.exe command

89. In ASP.NET, what is the difference between Response.Write() and Response.Output.Write()?

Answers:

• Response.Output.Write() allows you to write formatted output

• Response.Output.Write() allows you to flush output

• Response.Output.Write() allows you to stream output

• Response.Output.Write() allows you to buffer output

90. Concatenation of strings is done with _______.

Answers:

• Operator overloading

• Reserved words

• Operator overloading and method calls

• Method calls

91. How does the .Net framework define a Large Object?

Answers:

• larger than 185KB

• larger than 85KB

• Multidimensional arrays

• larger than 85KB OR Multidimensional arrays

92. Which of the following is NOT a valid GC Collection mode ?

Answers:

• Default

• Optimized

• Parallel

• Forced

93. Which of the following is NOT a reserved keyword in C#?

Answers:

• ascending

• groupby

• orderby

• descending

94. Which of the following methods is used for destroying threads?

Answers:

• Stop

• Destroy

• Kill

• Abort

95. Which of the following is not a VALID integer literal?

Answers:

• 0x4b

• 30ul

• 30u

• 032UU

96. The CLR allocates memory for new objects in which of the following Generation?

Answers:

• Generation 3

• Generation 2

• Generation 1

• Generation 0

97. All methods in an abstract base class must be declared abstract.

Answers:

• True

• False

98. In ASP.NET, which one of the following namespaces contains the definition for IdbConnection?

Answers:

• System.Data.Common

• System.Data.Connection

• System.Data.Interfaces

• System.Data

99. Your Web application contains an IHttpHandler interface named ABCHandler.  To render the validationBitmap instance as a JPEG image as soon as ABCHandler is requested, what code segment should you add to ABCHandler?

Answers:

• public void ProcessRequest(HttpContext context){Bitmap validationBitmap = (Bitmap)Session["ValidationImage"]; context.Response.ContentType = "image/jpeg"; validationBitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);}

• public void ProcessRequest(HttpContext context){Bitmap validationBitmap = (Bitmap)Session["ValidationImage"]; context.Response.ContentType = "image/jpeg"; validationBitmap.Save(context.Request.InputStream, ImageFormat.Jpeg);}

• public void ProcessRequest(HttpContext context){Bitmap validationBitmap = (Bitmap)Session["ValidationImage"]; context.Response.ContentType = "image/jpeg"; context.Response.Write(validationBitmap.RawFormat);}

• public void ProcessRequest(HttpContext context){Bitmap validationBitmap = (Bitmap)Session["ValidationImage"]; context.Response.ContentType = "image/jpeg"; context.Response.Write(validationBitmap);}

100. If an IndexofAny method is passed an array of characters, _______.

Answers:

• It searches for the first occurrence of the sequence of characters

• It finds the first occurrence of each letter in the string

• It generates an error

• It searches for the first occurrence of any of the characters in the string

101. Which of the following is not a VALID floating point literal?

Answers:

• 3.14159

• 314159E-5L

• 2.74

• 510E

102. Where is the default session data stored in ASP.NET?

Answers:

• All of these

• Session Object

• InProcess

• StateServer

103. Which of the following .Net framework class can be used for Custom Parallel Partitioning ?

Answers:

• ConcurrentQueue<T>

• BlockingCollection<T> Class

• ConcurrentBag<T>

• OrderablePartitioner<TSource>

104. Which of the following provides blocking and bounding capabilities for thread-safe collections?

Answers:

• ConcurrentBag<T>

• ConcurrentDictionary<TKey, TValue>

• BlockingCollection<T> Class

• ConcurrentQueue<T>

105. Which of the following interrupts the thread, which contains wait, sleep or join state?

Answers:

• Join()

• Abort()

• Interrupt()

• Yield()

106. Your Web application should facilitate posting of user comments that must remain visible to all application users. Your code will make use of a SqlDataSource control named SqlDataSource1 and allow the IP address of every user who posts a comment to be captured.  Which is the correct way to start your code?

Answers:

• private void SaveComment(){ string ipaddr = null; ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString(); // ...

• private void SaveComment(){ string ipaddr = null; ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString(); SqlDataSource1.Insert(); // ...

• private void SaveComment(){ string ipaddr = null; ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString(); SqlDataSource1.InsertParameters("IPAddress").DefaultValue = ipaddr; // ...

• private void SaveComment(){ string ipaddr = null; ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString(); SqlDataSource1.InsertParameters("IPAddress") = ipaddr; // ...

107. Which of the following property gets the current thread ?

Answers:

• Thread.Current

• Thread.Thread

• this.CurrentThread

• Thread.CurrentThread

108. In ASP.NET, what is the maximum number of cookies that can be allowed for a web site?

Answers:

• 1

• More than 30

• 10

• 20

109. Your Web application must be reconfigured to include a new theme. To implement the theme in such a way that the theme settings take precedence over all individual control settings, you should consider _______.

Answers:

• Creating a default page for the application and setting the Theme attribute to the name of the theme in the @Default directive

• Setting the Theme attribute of the pages element to the name of the theme in the application's App.config file

• Setting the Theme attribute of the pages element to the name of the theme in the application's Web.config file

• Creating a master page for the application and setting the Theme attribute to the name of the theme in the @Master directive

110. You must add a new custom control to an .aspx page in your Web application, with these requirements: ??? The state of the custom control must remain static for 2 minutes ??? The cache settings of other elements on the page must not be affected by the settings for the new custom control Which code will meet the requirements when added to the Web.configfile?

Answers:

• <caching> <outputCacheSettings> <outputCacheProfiles> <addname="CachedProfileSet" varyByControl="controlname" duration="120" /> </outputCacheProfiles> </outputCacheSettings> </caching>

• <caching> <outputCacheSettings> <outputCacheProfiles> <ProfileCache profile="CachedProfileSet" varyByControl="CachedControl" duration="120"> </ProfileCache> </outputCacheProfiles> </outputCacheSettings> </cachi

• <caching> <outputCacheSettings> <outputCacheProfiles> <ProfileCache profile="CachedProfileSet" varyByControl="CachedControl" duration="2"> </ProfileCache> </outputCacheProfiles> </outputCacheSettings> </caching

• <caching> <outputCacheSettings> <outputCacheProfiles> <addname="CachedProfileSet" varyByParam="CachedControl" duration="2" /> </outputCacheProfiles> </outputCacheSettings> </caching>

111. In C#,  an instance method ________.

Answers:

• Represents the behavior of an object

• Represents both the behavior and attributes of an object

• Represents another class

• Represents the attributes of an object

112. Which of the following methods is not a member of the ADODBCommand object?

Answers:

• ExecuteStream

• ExecuteReader

• ExecuteScalar

• Open

113. In ASP.NET, which property of the session object is used to set the locale identifier?

Answers:

• LCID

• Key

• SessionId

• Item

114. If A = 60, what will be the value of A >> 2 ?

Answers:

• 17

• 0000 1111

• 14

• 0000 0111

115. Your Web application was developed on .NET 1.0 and uses MS IIS 6.0. It does not use any features of MS .NET Framework 3.5.  To configure the Web application for .NET Framework 3.5 with as little administrative effort as possible, you should consider accessing _______ to modify the handler runtime version.

Answers:

• MS IIS 6.0

• The app.config file

• The web.config file

• The machine.config file

116. Your Web application ABCApp1, uses MS .NET Framework 3.5.  After retrieving the project code from your source control repository, you try to compile it on your workstation and find that the reference to the assembly is absent.  You should access _______ to add a reference path that connects to the absent assembly.

Answers:

• The project's property pages

• ABCApp1's web.config file

• ABCApp1's app.config file

• Your workstation's machine.config file

117. A thread returning from a WaitSleepJoin or Suspended state returns to the _______.

Answers:

• Stopped state

• Resume state

• Unstarted state

• Started state (now considering a part of the running state)

118. Which of the following is not a valid built-in C# reference type?

Answers:

• string

• dynamic

• class

• object

119. Which of the following methods causes a thread to wait the number of times defined by the iterations parameter?

Answers:

• SpinWait

• Sleep

• Join

• Wait

120. Which of the following Generation contains the longest surviving objects?

Answers:

• Generation 0

• Generation 1

• Generation 3

• Generation 2

121. In ASP.NET, which .DLL translates XML to SQL in IIS?

Answers:

• SQLIIS.dll

• LISXML.dll

• SQLXML.dll

• SQLISAPI.dll

122. Your Web application should make use of ASP.NET AJAX. It will also be installed in abcdef.com's Web farm environment.  To configure the SessionState of the new Web application before deployment, you should consider setting the mode attribute of the <sessionState> element to _______.

Answers:

• Custom

• StateServer

• SQLServer

• Off

123. When an unhandled exception occurs on products.aspx, your Web application should display an error page that contains the stack trace, and this page must be displayed only to remote users. You set the Page attribute for the products.aspx page to:  <%@ Page Language="VB" AutoEventWireup="true" CodeFile="products.aspx.vb" Inherits="_products" ErrorPage="~/ABCApp/error.html" Debug="false" %>  Which configuration should you use to the Web.config file?

Answers:

• <customErrors mode="Off"> <error statusCode="500" redirect="error.html" /> </customErrors>

• <compilation debug="true"/>

• <customErrors mode="On" />

• <customErrors mode="Remote Only" />

124. Which of the following is NOT a method in Thread class?

Answers:

• public void Abort()

• public static LocalDataStoreSlot AllocateDataSlot()

• public static void EndCriticalRegion()

• public void Run()

125. Use the _______ methods to lock and unlock an object.

Answers:

• Close and Open

• Close and Allow

• Enter and Exit

• Lock and Unlock

126. In C#, an instance variable ________.

Answers:

• Is an object of a class

• Is both an object of a class and a method of a class

• Represents an attribute of an object

• Is a method of a class

127. Methods that are declared abstract in the base class must show implementation at the time of declaration.

Answers:

• False

• True

128. Which of the following is not a valid state in the life cycle of a thread ?

Answers:

• Not Runnable

• Unstarted

• Started

• Ready

129. In ASP.NET, there can be more than 1 machine.config file in a system.

Answers:

• True

• False

130. In ASP.NET, custom controls are derived from the ________ class.

Answers:

• System.Web.UI.Webcontrol

• System.Web.UI.Customcontrol

• System.Web.UI.Customcontrols.Webcontrol

131. In ASP.NET, ________ are displayed correctly in the Visual Studio .NET Designer.

Answers:

• User controls and custom controls

• Custom controls

• User controls

132. Your Web application lets users upload files and is hosted in Microsoft IIS 6.0 on a server named ABC-SR01. The application uses the default application pool with Windows Authentication. You cannot upload a file from your workstation using the application; instead, you see an access denied message. To fix this problem, you enable debugging. Next, you should _______.

Answers:

• Add your Windows user account to the Administrators group on ABC-SR01

• Stop and restart the application pool on ABC-SR01

• Add the following configuration to the Web.config file <identity impersonate="true" />

• Create a Debugger Users group on your workstation and add your Windows user account to it

133. An event is often:

Answers:

• The result of a user action

• Not an object type

• Code used to force a user action

• The result of a party

134. To configure authentication for your Web application so clients cannot access it anonymously, but access is allowed for users from untrusted domains, where should the following code be added to?  <system.web> <authentication mode="Forms"> <forms loginUrl="login.aspx" /> </authentication> <authorization> <deny users="?" /> </authorization> </system.web>

Answers:

• The project's property pages

• The app.config file

• The workstation's machine.config file

• The web.config file

135. Your Web application, ABCWebApp1, is configured to use Windows Authentication. After granting a specific group NTFS permissions to access a specific file named ABC.doc, you need to ensure that users not belonging to this group cannot access the file. You should _______.

Answers:

• Configure the machine.config file to include the <authentication mode="[None]"> element

• Configure the app.config file to include the <authentication mode="[None]"> element

• Configure the machine.config file to include the <identity impersonate="true"/> element

• Configure the Web.config file to include the <identity impersonate="true"/> element

136. What is the number of server forms that can be added to a .aspx page?

Answers:

• More than 3

• 1

• 3

• 2

137. Which of the following is true about the following : for(;;) {  Console.WriteLine("Testing for loop"); }

Answers:

• Compilation error

• "Testing for loop" will get printed twice

• "Testing for loop" will get printed once

• It's an infinite loop

138. To ensure that the timing and performance data of your web application is gathered and only made available to users when they are logged on the web server, which code should you add to the Web.config file?

Answers:

• <trace enabled="true" pageOutput="false" localOnly="true" />

• <compilation debug="true" urlLinePragmas="false"> ... </compilation>

• <compilation debug="false" urlLinePragmas="true"> ... </compilation>

• <trace enabled="false" pageOutput="true" localOnly="false" />

139. While browsing your Web application in IIS 6.0, you receive a Server Application Unavailable error. The application event log states: It is not possible to run two different versions of ASP.NET in the same IIS process. Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process.  To solve this problem as quickly as possible, you should _______.

Answers:

• Change the IIS isolation mode and restart the application pool that hosts the application

• Change the IIS isolation mode and assign the application to a new application pool

• Assign the application to a new application pool and run the Aspnet_regiis.exe tool

• Assign the application to a new application pool and configure all applications that are part of your application's application pool to use the same version of ASP.NET

140. Your Web form uses the following code to display data from a SQL Server 2005 database. What must you add to the _ItemBound event handler in order to access the value of the hlName HyperLink in a variable named var?   <asp:RepeaterID="ABCRepeater" runat="server"DataSourceID="SqlDS1" ItemDataBound="_ItemBound"> <ItemTemplate><asp:Hyperlink ID="hlName" runat="server"Text='<%# Eval("ProdName") %> NavigateURL='<%# Eval("ProdURL") %>' /> </ItemTemplate></asp:Repeater>

Answers:

• HyperLink var = rptData.FindControl("hlName") as HyperLink;

• HyperLink var = e.Item.FindControl("hlName") as HyperLink;

• HyperLink var = e.Item.Parent.FindControl("hlName") as HyperLink;

• HyperLink var = Page.FindControl("hlName") as HyperLink;

141. In your Web application, you create a class to implement the IHttpHandler interface. Which code will display the Warning.jpg image in the browser whenever the handler is requested?

Answers:

• public void ProcessRequest(HttpContext ctx){StreamReader sr = new StreamReader(_File.OpenRead(ctx.Server.MapPath("Warning.jpg")));ctx.Response(sr.ReadToEnd());}

• public void ProcessRequest(HttpContext ctx){StreamReader sr = new StreamReader(OpenRead(ctx.Server.MapPath("Warning.jpg")));ctx.Response.Pics("pic ");sr.Close();}

• public void ProcessRequest(HttpContext ctx){ctx.Response.ContentType = "image/jpg";FileStream fs = File.OpenRead(_ctx.Server.MapPath("Warning.jpg"));int b = 0;while ((b == fs.ReadByte()) != -1) {ctx.Response.OutputStream.WriteByte(Conv

• public void ProcessRequest(HttpContext ctx){ctx.Response.TransmitFile("image/jpg");(_ctx.Server.MapPath("Warning.jpg"));Stream b = default(Stream);while ((b == fs.ReadByte()) != -1) {ctx.Response.Output.Write((b));}Fs.Close();}

142. Your Web application on IIS 6.0 includes OldPage.aspx. When a user tries to access OldPage.aspx, the browser should display the URL for OldPage.aspx, but open NewPage.aspx. Which code will accomplish this?

Answers:

• Server.Transfer("NewPage.aspx");

• Response.Redirect("NewPage.aspx");

• Server.MapPath("NewPage.aspx");

• Server.Execute("NewPage.aspx");

143. The following code is an example of:  public class A  {   IEmailSender _emailSender   public A(IEmailSender emailSender)   {     _emailSender = emailSender;   }    private void SendEmail()   {      _emailSender.Send();   } }

Answers:

• Dependency Injection

• Inheritance

• Tightly coupled classes

• Method Overloading

144. Your Web application contains an IHttpHandler interface named ABCHandler.  To render the validationBitmap instance as a JPEG image as soon as ABCHandler is requested, what code segment should you add to ABCHandler?

Answers:

• public void ProcessRequest(HttpContext context){Bitmap validationBitmap = (Bitmap)Session["ValidationImage"]; context.Response.ContentType = "image/jpeg"; validationBitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);}

• public void ProcessRequest(HttpContext context){Bitmap validationBitmap = (Bitmap)Session["ValidationImage"]; context.Response.ContentType = "image/jpeg"; validationBitmap.Save(context.Request.InputStream, ImageFormat.Jpeg);}

• public void ProcessRequest(HttpContext context){Bitmap validationBitmap = (Bitmap)Session["ValidationImage"]; context.Response.ContentType = "image/jpeg"; context.Response.Write(validationBitmap.RawFormat);}

• public void ProcessRequest(HttpContext context){Bitmap validationBitmap = (Bitmap)Session["ValidationImage"]; context.Response.ContentType = "image/jpeg"; context.Response.Write(validationBitmap);}

145. You must add a new custom control to an .aspx page in your Web application, with these requirements: ??? The state of the custom control must remain static for 2 minutes ??? The cache settings of other elements on the page must not be affected by the settings for the new custom control Which code will meet the requirements when added to the Web.configfile?

Answers:

• <caching> <outputCacheSettings> <outputCacheProfiles> <addname="CachedProfileSet" varyByControl="controlname" duration="120" /> </outputCacheProfiles> </outputCacheSettings> </caching&gt

• <caching> <outputCacheSettings> <outputCacheProfiles> <ProfileCache profile="CachedProfileSet" varyByControl="CachedControl" duration="2"> </ProfileCache> </outputCacheProfiles> </output

• <caching> <outputCacheSettings> <outputCacheProfiles> <ProfileCache profile="CachedProfileSet" varyByControl="CachedControl" duration="120"> </ProfileCache> </outputCacheProfiles> </outp

• <caching> <outputCacheSettings> <outputCacheProfiles> <addname="CachedProfileSet" varyByParam="CachedControl" duration="2" /> </outputCacheProfiles> </outputCacheSettings> </caching>

146. Your Web application must be reconfigured to include a new theme. To implement the theme in such a way that the theme settings take precedence over all individual control settings, you should consider _______.

Answers:

• Setting the Theme attribute of the pages element to the name of the theme in the application's App.config file

• Creating a default page for the application and setting the Theme attribute to the name of the theme in the @Default directive

• Setting the Theme attribute of the pages element to the name of the theme in the application's Web.config file

• Creating a master page for the application and setting the Theme attribute to the name of the theme in the @Master directive

147. Your Web application should facilitate posting of user comments that must remain visible to all application users. Your code will make use of a SqlDataSource control named SqlDataSource1 and allow the IP address of every user who posts a comment to be captured.  Which is the correct way to start your code?

Answers:

• private void SaveComment(){ string ipaddr = null; ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString(); SqlDataSource1.InsertParameters("IPAddress").DefaultValue = ipaddr; // ...

• private void SaveComment(){ string ipaddr = null; ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString(); SqlDataSource1.InsertParameters("IPAddress") = ipaddr; // ...

• private void SaveComment(){ string ipaddr = null; ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString(); SqlDataSource1.Insert(); // ...

• private void SaveComment(){ string ipaddr = null; ipaddr = Request.ServerVariables("REMOTE_ADDR").ToString(); // ...

148. Your Web application ABCApp1, uses MS .NET Framework 3.5.  After retrieving the project code from your source control repository, you try to compile it on your workstation and find that the reference to the assembly is absent.  You should access _______ to add a reference path that connects to the absent assembly.

Answers:

• ABCApp1's web.config file

• ABCApp1's app.config file

• Your workstation's machine.config file

• The project's property pages

149. When an unhandled exception occurs on products.aspx, your Web application should display an error page that contains the stack trace, and this page must be displayed only to remote users. You set the Page attribute for the products.aspx page to:  <%@ Page Language="VB" AutoEventWireup="true" CodeFile="products.aspx.vb" Inherits="_products" ErrorPage="~/ABCApp/error.html" Debug="false" %>  Which configuration should you use to the Web.config file?

Answers:

• <customErrors mode="Off"> <error statusCode="500" redirect="error.html" /> </customErrors>

• <customErrors mode="On" />

• <customErrors mode="Remote Only" />

• <compilation debug="true"/>