book1

52
1) Which is the correct declaration for a nullable integer? 1) Dim i As Nullable<Of Integer> = Nothing 2) Dim i As Nullable(Of Integer) = Nothing in C# Nullable<int> i = null; or int? i = null; 3) Dim i As Integer = Nothing 4) Dim i As Integer(Nullable) = Nothing 2) Tony has executed a DTS package using following command. The command has return the value as 0 (value of @returncode variable). DECLARE @returncode int EXEC @returncode = xp_cmdshell 'dtexec /f "C:\ UpsertData.dtsx"' Which of the following statement(s) is/are true: The command "dtexec" is incorrect. The package executed successfully. The package failed. The utility was unable to locate the requested package. The package could not be found. The utility encountered an internal error of syntactic or semantic errors in the command line. 3) Attribute standalone="no" should be included in XML declaration if a document: is linked to an external XSL stylesheet has external general references has processing instructions has an external DTD 4) What is the role of Installers in a Windows Service ?

Transcript of book1

Page 1: book1

1) Which is the correct declaration for a nullable integer?

1) Dim i As Nullable<Of Integer> = Nothing2) Dim i As Nullable(Of Integer) = Nothing in C# Nullable<int> i = null; or int? i = null;3) Dim i As Integer = Nothing4) Dim i As Integer(Nullable) = Nothing

2) Tony has executed a DTS package using following command. The command has return the value as 0 (value of @returncode variable). DECLARE @returncode intEXEC @returncode = xp_cmdshell 'dtexec /f "C:\UpsertData.dtsx"'Which of the following statement(s) is/are true:

The command "dtexec" is incorrect.The package executed successfully.The package failed.The utility was unable to locate the requested package. The package could not be found.The utility encountered an internal error of syntactic or semantic errors in the command line.

3) Attribute standalone="no" should be included in XML declaration if a document:

is linked to an external XSL stylesheethas external general referenceshas processing instructionshas an external DTD

4) What is the role of Installers in a Windows Service ?

Enable you to install only a Windows service.Enable you to install a Windows service and resources, such as custom logs and performance counters.Automatically creates custom logs when the service is installed or uninstalled.All of the Above

5) Which of the following code snippet will ensure that the instance of the service will be created on a per session basis?

Page 2: book1

[ServiceBehavior(InstanceContextMode.PerSession)]    public class ShoppingCartService : IShoppingCartService {..}[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)]    public class ShoppingCartService : IShoppingCartService {..}[ServiceBehavior(InstanceContextMode.PerSession)]    public interface IShoppingCartService {…}[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)]    public class IShoppingCartService {…}

6) Shashank is creating an ASP.NET page for selling movie tickets. Users select a region, and then they select from a list of cities in that region. The site displays the names and locations of movie theaters in the city selected by the user. Shashank's company, Mahaveer Enterprises, maintains a list of theaters in a database table that includes the city, name, and street address of each theater. He want to minimize the time required to retrieve and display the list of theater names after a user selects the region and city. What should he do?

Modify the connection string to add the packet size property and set its values to 8192.Add the following directive to the page: OutputCache VaryByControl=“region;city”.Add the following directive to the page: OutputCache VaryByHeader=“region;city”.Modify the connection string to keep your database’s connection pool as small as possible.

7) How to detect whether a cookie is a normal cookie or a multi-valued cookie?

Cookie.IsMultivaluedHttpCookie.HasKeysCookie.HasKeysHttpCookie.ValuesHttpCookie.HasValues

Page 3: book1

8) Which of these string definitions will prevent escaping on backslashes in C#?

string s = #”n Test string”; string s = “’n Test string”; string s = @”n Test string”; string s = “n Test string”;

9) Two SQL Server Databases that are used in Reporting services data layer are :

Reportsdb and ReportsTempDBReportServer and ReportServerTempDBReportingServer and ReportingServerTempDBReportServer and TempReportServerDB

10) Dim x As Integer = 4       If x Is 4 Then           x = 7           Console.WriteLine("Wow")       End IfWhat is true about the above code?

x is declared as an integer; integer variables must begin with the letters i-n.Operands to "Is" must be reference types; x and 3 are value types. Once a value has been assigned to x, it is not allowed to reassign it with x=7."strange world" is too short because Console.Writeline requires at least an 80 character string. "Is" is only a valid operator in compile-time #if...then constructs, not regular if...then constructs.

11) We have a List View to which we want to Data Bind a Stock Tciker, which is aThird Party Application with certain APIs exposed. Which is the correct way of handelling this scenario?

1)<Grid x:Name="DisplayGrid"><ListView Name="lstNameDisplay"

Page 4: book1

 ItemTemplate="{DynamicResource StockTemplate}"  ItemsSource="{Binding Path=StockTable}">

    <ListView.View>        

      <GridView>

        <GridViewColumn Header="Company Name" DisplayMemberBinding="{Binding Path=CompanyName}"/>

        <GridViewColumn Header="Stock Price" DisplayMemberBinding="{Binding Path=StockValue}"/>

      </GridView>

    </ListView.View>

  </ListView>

</Grid>

2)<Grid x:Name="DisplayGrid">  <ListView Name="lstNameDisplay"

 ItemTemplate="{DynamicResource StockTemplate}"  ItemsSource="{Binding Path=StockTable}">    </ListView></Grid>

<ListView  Name="lstNameDisplayt"  Text="{Binding Path=StockTemplate, Mode=OneTime}"/><Grid x:Name="DisplayGrid">

3)  <ListView Name="lstNameDisplay"

 ItemTemplate="{DynamicResource StockTemplate}"  ItemsSource="{Binding Path=StockTable,Mode=OneTime}">

    <ListView.View>        

4)      <GridView>

        <GridViewColumn Header="Company Name" DisplayMemberBinding="{Binding Path=CompanyName}"/>

Page 5: book1

        <GridViewColumn Header="Stock Price" DisplayMemberBinding="{Binding Path=StockValue}"/>

      </GridView>

    </ListView.View>

  </ListView>

</Grid>

12) Write the LINQ statement for following collection to get ProductName and Category whose UnitPrice is greater than 10 Class Product{    public string ProductName;    public string Category;    public double UnitPrice;}

 var productPriceList = from p in products        select {p.ProductName, p.Category};

var productPriceList = from p in products        select new {p.ProductName, p.Category};var productPriceList = from p in products         where p.UnitPrice > 10.0        select new {p.ProductName, p.Category}; var productPriceList = from p in products        select new {p.ProductName, p.Category}        where p.UnitPrice > 10.0;

13) Dim objcls As New System.Data.SqlClient.SqlConnection msgbox(objcls.ToString)What is the output?

System.Data.SqlClient.SqlConnectionSqlConnectionThrows Invalid cast ExceptionThrows Null Object Reference Exception

Page 6: book1

14)Which service allows the runtime to keep the internal state of a workflow consistent with the state in a durable store, like a relational database

TransactionPersistenceTrackingScheduling

15) You create an ASP.NET application that will run on Gsoft’s Internet Web site. Your application contains 100 Web pages. You want to configure your application so that it will display customized error messages to users when an HTTP code error occurs. You want to log the error when an ASP.NET exception occurs. You want to accomplish these goals with the minimum amount of development effort. Which two actions should you take? (Each correct option represent part of the solution Choose two)

Create an Application_Error procedure in the Global.asax file for your application to handle ASP.NET code errors. Create an applicationError section in the Web.config file for your application to handle ASP.NET code errors. Create a CustomErrors event in the Global.asax file for your application to handle HTTP errors. Create a customErrors section in the Web.config file for your application to handle HTTP errors. Add the Page directive to each page in the application to handle ASP.NET code errors. Add the Page directive to each page in the application to handle HTTP errors

16) What would be the output on execution of this page?<%@ Language="C#" ValidateRequest="true" %><html> <script runat="server">  void btnSubmit_Click(Object sender, EventArgs e)  {        Response.Write(txtString.Text);  } </script> <body>

Page 7: book1

  <form id="form1" runat="server">    <asp:TextBox id="txtString" runat="server"                  Text="<script>alert('hello');</script>" />    <asp:Button id="btnSubmit" runat="server" OnClick="btnSubmit_Click"                  Text="Submit" />  </form> </body></html>

Blank screen will be displayed. “Hello” is displayed.Asp.net returns an exceptionNone of the above

17) What is Expander control in WPF?

Expander control has ability to expand as per the request of the end user.Expander control is a control that seats on top of other controls when expanded.Expander is very much like GroupBox, but contains a button that enables you to expand and collapse the inner content.There is nothing like Expander control.

18) What allows you to specify the security context within which the services in your service application run?

Account property of the ServiceBase classRunInstaller attribute of the ProjectInstaller class.Account property of the ServiceProcessInstaller classAll of the above

19) Write the LINQ statement for following array to get lower and upper cases of the elementsstring[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" };

var upperLowerWords =        from w in words        select {Upper = w.ToUpper(), Lower = w.ToLower()};

var upperLowerWords =        from words        select new {Upper = w.ToUpper(), Lower = w.ToLower()};

Page 8: book1

var upperLowerWords =        from w in words        select new {Upper = w.ToUpper(), Lower = w.ToLower()};

var upperLowerWords =        from w in words        select new {Upper = w.ToUpper()};

20) You create an web application that produces sales reports for Arihant Enterprises. The sales data is stored in a Microsoft SQL Server database that is used for transaction processing. The application consists of complex Transact-SQL statements. Many users report that the report generation is taking longer to run each day. You need to improve response times. What are the possible ways to achieve this goal?(Each correct answer presents a complete solution.Choose two)

Use an OledbDataAdapter indexes exist on the SQL Server tables.Ensure that appropriate indexes exist in the SQL Server tables.Rewrite your SQL statements to use aliases for all table names.Rewrite your direct SQL statements as stored procedures and call the stored procedures from your application.Configure queries to run in the security context of the user who is running the query.

21) You use Visual Studio .NET to create a Windows-based application. The application includes a form named GraphForm, which displays statistical data in graph format. You use a custom graphing control that does not support resizing. You must ensure that users cannot resize, minimize, or maximize GraphForm. Which three actions should you take? (Each answer presents part of the solution. Choose three)

Set GraphForm.MinimizeBox to False.Set GraphForm.MaximizeBox to False.Set GraphForm.ControlBox to False.Set GraphForm.ImeMode to Disables.Set GraphForm.WindowState to Maximized.Set GraphForm.FormBorderStyle to one of the Fixed styles.

22) You are creating an ASP.NET application for Gsoft. Customers will use the application to file claim forms online.

Page 9: book1

You plan to deploy the application over multiple servers. You want to save session state information to optimize performance.

What are two possible ways to achieve this goal?(Each correct answer presents a complete solution. Choose two)

Modify the Web.config file to support StateServer mode.Modify the Web.config file to support SQLServer mode.Modify the Web.config file to support InProc mode.In the Session_Start procedure in the Global.asax file, set the EnableSession property of the WebMethod attribute to true.In the Session_Start procedure in the Global.asax file, set the Description property of the WebMethod attribute to sessionState.

23) Statement A: The Request-Reply messaging pattern doesn’t allow bi-directional communication to happen freely.Statement B: In Request-Reply pattern, the Clint sends a response and then waits for reply, the service doesn’t communicate anything until it receives a message.

Only statement A is TrueOnly statement B is TrueBoth the statements are TrueBoth the statements are False

24) What is the function of "RepeatButton"?

It works like a ToggleButton.RepeatButton repeats the performed action even after releasing the button.RepeatButton acts just like Button except that it continually raises the Click event as long as the button is being pressed.There is nothing like RepeatButton.

Page 10: book1

25) In Personalization anonymous user information is stored in a cookie which can be named as ?

.ASPXANONYMOUS

.ASPXSHASHANKAPPUnknownProfileAll of the AboveNone of the Above

26) Identify the correct code for registering a channel with a Remoting Infrastructure:

TcpServerChannel channel = new TcpServerChannel(8010);          Channel.Register (channel);

TcpServerChannel channel = new TcpServerChannel(8010);          Channel.RegisterChannel(channel);TcpServerChannel channel = new TcpServerChannel(8010);          ChannelServices.Register (channel);TcpServerChannel channel = new TcpServerChannel(8010);          ChannelServices.RegisterChannel(channel);

27) Select the appropriate optionprivate static void ImpersonateIdentity(IntPtr logonToken){    // Retrieve the Windows identity using the specified token.    WindowsIdentity windowsIdentity = new WindowsIdentity(logonToken);

    // Create a WindowsImpersonationContext object by impersonating the    // Windows identity.    WindowsImpersonationContext impersonationContext =        windowsIdentity.Impersonate();

    Console.WriteLine("Name of the identity after impersonation: "        + WindowsIdentity.GetCurrent().Name + ".");    Console.WriteLine(windowsIdentity.ImpersonationLevel);       // Stop impersonating the user.      Choose from the options.   

    // Check the identity name.

Page 11: book1

    Console.Write("Name of the identity after stopping");    Console.WriteLine(" impersonation: " +        WindowsIdentity.GetCurrent().Name);}

impersonationContext.stop();impersonationContext.undo();impersonationContext.clear();impersonationContext.remove();

28) Shashank develops a Windows-based application for tracking telephone calls. The application stores and retrieves data by using a Microsoft SQL Server database.He will use the SQL Client managed provider to connect and send commands to the database. He uses integrated security to authenticate users. His server is called Retail100 and the database name is CustomerService.

Now He needs to set the connection string property of the SQL Connection object.

Which code segment should he use?

"Provider=SQLOLEDB.1;Data Source=Retail100;Initial Catalog=CustomerService"

"Provider=MSDASQL;Data Source= Retail100;Initial Catalog=CustomerService"

"Data Source= Retail100;Initial Catalog=Master"

"Data Source= Retail100;Initial Catalog=CustomerService"

29) Consider a situation in which we need to apply animation to a rectangle.The condition is as follows:

1.The animation time duration should be 5 Seconds2.The entire sequence should be of 8 seconds

Page 12: book1

The best possible XAML for this would be

<Storyboard> <DoubleAnimation Duration="0:0:5" />  </Storyboard><Storyboard>       <DoubleAnimation BeginTime="0:0:3" Duration="0:0:5" />   </Storyboard><Storyboard>        <DoubleAnimation BeginTime="0:0:5" Duration="0:0:3" />  </Storyboard><Storyboard>         <Animation BeginTime="0:0:2" Duration="0:0:5" />  </Storyboard>

30)You also plan to include full support for visual design tools. You want to create a project to test the control.Which two courses of action should you take? (Each correct answer presents part of the solution. Choose two)

Create a Web user control. Create a Web custom control. Create a new Web Form project.Use the COM Components tab of the Customize Toolbox dialog box to specify the new control. Create a new Web Form project.Use the .NET Framework Components tab of the Customize Toolbox dialog box to specify the new control. Create a new Web Form project.Select Add Reference from the Project menu and browse to the new control.

31) Given a scenario that we need to restrict user access to one single aspx page only for administrators and others should not be allowed to view this page, whereas all other pages can be viewed by anyone. How can this be done?

Add the Following code to Web.Config <allow path="MySecuredAdminPage.aspx" roles="Administrator" deny ="*"/>

 

Page 13: book1

Add the Following code to Web.Config <location path="MySecuredAdminPage.aspx">    <system.web>      <authorization>        <allow roles="Administrator"/>        <deny users="*"/>      </authorization>    </system.web>  </location>Add the Following code to Web.Config <authorization page="MySecuredAdminPage.aspx">        <allow roles="Administrator"/>        <deny users="*"/>  </authorization>Add the Following code to Web.Config <Restrict page="MySecuredAdminPage.aspx">    <system.web>      <authorization>        <allow roles="Administrator"/>        <deny users="*"/>      </authorization>    </system.web>  </Restrict>

32) You want to define the service method, where the method should not commit the transaction automatically. What is the correct code snippet for the same?

[ServiceBehavior(TransactionAutoComplete=-true)Public void AddNumber(int number1, int number2){    Result = number1 + number2;}[OperationBehavior(TransactionAutoComplete=true)Public void AddNumber(int number1, int number2){    Result = number1 + number2;}[OperationBehavior(TransactionAutoComplete=false)Public void AddNumber(int number1, int number2){

Page 14: book1

    Result = number1 + number2;}[TransactionAutoComplete(false)]Public void AddNumber(int number1, int number2){    Result = number1 + number2;}

33) When a browser sends a HTTP request to our web site, what will ASP.NET MVC Framework use to map the incoming request to an action method on a controller class to process it?

1) URL routing engine2) URL re-routing engine3) URL processing engine4) All of the above

34) The workflow defines a “Status” Property. How will you access the value of this property in the WorkflowCompleted event?

1)void runtime_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)        {            string status = sender.OutputParameters["Status"].ToString();         }2) void runtime_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)        {            string status = e.Status.ToString();         }3) void runtime_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)        {            string status = e.OutputParameters["Status"].ToString();         }4) None of these

35) For the painting purpose of a Window, we have a sldBrush of type SolidBrush.How can it be made read only at Run Time?

Page 15: book1

SolidColorBrush sldBrush = new SolidColorBrush(Colors.Blue);

if (sldBrush.CanFreeze){   sldBrush.Freeze();}                     

SolidColorBrush sldBrush = new SolidColorBrush(Colors.Blue);    sld.ReadOnly=True SolidColorBrush sldBrush = new SolidColorBrush(Colors.Blue);   sld.AllowToEdit=False;       Freeze does not exist in WPF hence wrong syntax

36) Syntax to create SQL Server Login is

CREATE SQL LOGIN login_name With PASSWORD='password'CREATE LOGIN login_name With PASSWORD='password'CREATE USER user_name PWD='password'ADD login_name PASSWORD='password'

37) You develop a Windows-Based application that interacts with a Microsoft SQL Server database. The application inserts new rows into the database by calling the following stored procedure. (Line numbers are included for reference only.)

01 ALTER PROCEDURE dbo.sp_UpdateRetailPrice

02 (

03 @category int,

04 @totalprice money OUTPUT

05 (

06 AS

07 SET NOCOUNT ON

08 UPDATE Products SET UnitPrice = UnitPrice * 1.1 WHERE CategoryID = @category

Page 16: book1

09 SELECT @totalprice = sum(UnitPrice) FROM Products

10 SELECT ProductName FROM Products WHERE CategoryID = @category

11 RETURN @totalprice

Your application uses the ExecuteReader method of the SqlCommand object to call the stored procedure and create a SqlDataReader object. After the stored procedure runs, your code must examine the SqlDataReader.RecordsAffected property to verify that the correct number of records is successfully updated.

However, when you execute the stored procedure, the SqlDataReader.RecordsAffected property always returns -1.

How should you correct this problem?

Change line 7 toSET ROWCOUNT 0Change line 7 toSET NOCOUNT OFFChange line 11 toRETURN 0Change line 11 toRETURN @category

38) What does the following auto-generated code do?

static void Main(){ServiceBase[] ServicesToRun;

// More than one user Service may run within the same process. To// add another service to this process, change the following line// to create a second service object. For example,////   ServicesToRun = New System.ServiceProcess.ServiceBase[] //   {//      new Service1(), new MySecondUserService()

Page 17: book1

//   };//

ServicesToRun = new ServiceBase[] {new QuoteService()};ServiceBase.Run(ServicesToRun);}

1) An array of ServiceBase classes, ServicesToRun, is declared. With the Run() method of ServiceBase, you are giving the SCM references to the entry points of your services.2) An array of ServiceBase classes, ServicesToRun is declared. With the Run() method of ServiceBase, you are blocking the service.3) An array of ServiceBase classes, ServicesToRun is declared. With the Run() method of ServiceBase, you are running the windows Servicemanually.4) All of The above

39) To use the WindowsTokenRoleProvider we only need to add the following to web.config.

<roleManager enabled="true"   defaultProvider="AspNetWindowsTokenRoleProvider"/>

<roleManager enabled="true"  CurrentProvider="AspNetWindowsTokenRoleProvider"/><roleManager enabled="true"  defineProvider="AspNetWindowsTokenRoleProvider"/><roleManager enabled="true" Provider="AspNetWindowsTokenRoleProvider"  />

40) In ASP.NET web application you are creating a Web Form. This Web Form allows users to log on to a Web site which use a Login control named Login1. Membership data for the application is stored in a SQL Express database and .mdf file is in the App_Data directory. In ASP.NET web application you have to configure your application

Page 18: book1

so that the membership data is stored in a local Microsoft SQL Server database. You have following setting in the Web.config file.

<membership defaultProvider="MySqlProvider"> <providers> <add name="MySqlProvider" type="System.Web.Security.SqlMembershipProvider,  System.Web,Version=2.0.0.0,  Culture=neutral, PublicKeyToken=b03f5f7f11d40s3a" connectionStringName="MyOrgSqlProviderConnection"/> </providers></membership> What else should you perform?

Run Aspnet_regsql.exe to create the Microsoft SQL Server database.  Add the following code in the Web.config file. <connectionStrings>  <add name="MyOrgSqlProviderConnection" connectionString="connection string" /></connectionStrings>Add the following code in the Web.config file. <appSettings> <add key="MySqlProviderConnection" value="connection string" /></appSettings>None of the above

41) Syntax to terminate a user process bases on the session id or unit of work.

KILL {spid} [WITH STATUS]KILL {spid | UOW} [STATUSONLY]KILL {UOW} [WITH STATUSONLY]KILL {spid | UOW} [WITH STATUSONLY]

42) What will be the Valid value of type attribute in the membership tag to be defined in web.config file for using Active Directory Membership provider

Page 19: book1

System.Web.Security.ActiveDirectoryProvider,  System.Web,Version=2.0.0.0,Culture=neutral,   PublicKeyToken=b03f5f7f11d50a3aSystem.Web.Security.ActiveMembershipProvider,   System.Web,Version=2.0.0.0,Culture=neutral,  PublicKeyToken=b03f5f7f11d50a3aSystem.Web.Security.ActiveDirectoryMembershipProvider,   System.Web,Version=2.0.0.0,Culture=neutral,  PublicKeyToken=b03f5f7f11d50a3aSystem.Web.Security.ActiveDirectoryMembership,   System.Web,Version=2.0.0.0,Culture=neutral,   PublicKeyToken=b03f5f7f11d50a3a

43) Membership service supports facilities for

1) Creating new users and passwords2) storing membership information in sql server , active directory or alternative data store.3) Authenticating users 4) managing passwords5) Authorization6) State management

44) Refer the XAML markup file called App.xaml.

<Application   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  StartupUri="HomePage.xaml"></Application>

What is this code snippet doing?

1) This file defines a WPF application, and is also used it to specify the UI (HomePage.xmal) to automatically show when the application starts.2) This file defines a WPF Page, with the name HomePage.xmal as a startup Page.

Page 20: book1

3) This file defines a WPF application, and is also used it to create the UI (HomePage.xmal)  4) None of these

45) You are creating an e-commerce site which allows users to shop a site and use the site’s shopping cart. But you want to allow them to use your site’s shopping cart before they actually get registered with your site.What do you need to do?

1) Disable authentication for all the users2) Enable Anonymous personalization by using <anonymousIdentification enabled=”true” />3) Enable Anonymous personalization by using<anonymousIdentification disabled=”false” />4)All of the above

46) We have a Text Box on a form and we want to update the value of a Label on the same form once we complete the typing in the Text Box.Which option will suffies our need?

1) <TextBox Name="TextBox1"         Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}" />    On MouseLeave Event2) <TextBox Name="TextBox1"         Text="{Binding Path=Name}" />On MouseMove Event3) <TextBox Name="TextBox1"         Text="{Binding Path=Name, Converter=converter1" /> No need of any Event4) <TextBox Name="TextBox1"         Text="{Binding Path=Name, UpdateSourceTrigger=Explicit}" /> On LostFocus of the TextBox

47) By default, ASP.NET configuration files that are located in subdirectories override and extend configuration settings that are declared in parent configuration files. In application hosting scenarios, Which is the valid setting to prevent modification at lower  levels?

1) <configuration>  <location path="application1" allowOverride="false">

Page 21: book1

    <system.web>      <trust level="High" />    </system.web>  </location>  </configuration>2) <configuration>  <location path="application1" Override="false">    <system.web>      <trust level="High" />    </system.web>  </location> </configuration>3) <configuration>  <location path="application1" allowOverride="false">      <trust level="High" />  </location></configuration>4) <configuration>  <location source="application1" Override="false">  </location>  </configuration>

48) Dhoni is developing a Windows based application. He wants one of his forms to appear partially transparent. What should he do to accomplish this task?

Set Opacity property of the form to a value greater than 1Set Opacity property of the form to 0Set Opacity property of the form to 1Set Opacity property of the form to a value greater than 0 and less than 1

49) What are the different types of Concurrency in Ado.Net?

OptimisticReadOnlyPessimisticWriteOnly

50) What would the following code snippet do:

Page 22: book1

if(Membership.ValidateUser(TextBox1.Text.ToString(),TextBox2.Text.ToString()){Roles.DeleteCookie(); FormsAuthentication.RedirectFromLoginPage (TextBox1.Text.ToString(), false);}else{Label1.Text=”You are not registered with the site”; }

1) It will Delete the role cookie from the client’s machine after the user logs in.2) It will recreate the role cookie on the client’s machine next time when the user logs in again3) It will not delete the role cookie from the client’s machine but would cache the cookie contents for 30 minutes.4) It performs Cache Invalidation

52) I have a Service called as CalculatorService having a remotable class called as Calculator. Identify the correct code for configuring this service using a SingleTon Object

1) RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("CalculatorService.Calculator,                                                 CalculatorService"),"calc", WellKnownObjectMode.Singleton);2) RemotingConfiguration.RegisterActivatedServiceType(Type.GetType("CalculatorService.Calculator,                                                 CalculatorService"),"calc", WellKnownObjectMode.Singleton);3) RemotingConfiguration.RegisterWellKnownServiceType(WellKnownObjectMode.Singleton);4) RemotingConfiguration.RegisterActivatedServiceType(Activator.GetType("CalculatorService.Calculator,                                                 CalculatorService"),"calc", WellKnownObjectMode.Singleton);

53) What does the loose coupling between the three main components of an MVC application promote? For instance, one developer can work on the view, a second developer can work on the

Page 23: book1

controller logic, and a third developer can focus on the business logic in the model.

parallel developmentVertical developmentHorizontal developmentNone of the Above

54) What is the error in the following xml code snippet?

<roleManagerdefaultProvider="SQL"enabled="true">< cacheRolesInCookie enabled=”true” /></roleManager>

i. There is no defaultProvider attributeii. The defaultProvider attribute value cannot be SQL.iii. cacheRolesInCookie is an attribute, not an element.iv. All of the Above

i and iii and iiiiiiiv

55) To match the text node (in XSLT) the syntax will be

1) <xsl:template match=” text”>2) <xsl:template match-text=” text”>3) <xsl:template match=text( )>4) <xsl:template match=” text( )” >

56) How to you define the Contract for a Local Communication Service for a Workflow?

[ExternalDataExchange]    public interface IProductDetails    {

Page 24: book1

      …    }[ExternalDataExchange] public class ProductDetails    {        …    }public interface IProductDetails: ExternalDataExchange    {        …    }None of these

57) You plan to develop a customer information application CustomBD that uses a Microsoft SQL Server database. CustomBD will be used frequently by a large number of users. Your application code must obtain the fastest possible performance when accessing the database and retrieving large amounts of data. You must accomplish this goal with the minimum amount of code. How should you design CustomBD?

Use classes in the System.Data.OleDb namespace.Use classes in the System.Data.SqlClient namespace.Use remoting to connect to the SQL Server computer.Use interoperability to include legacy COM-based data access components.

58) Following are the steps taken when creating a channel and sending a message.i. The client sends the message request via the channelii. The service sends a reply to the client via the channeliii. The client establishes a channel to the serviceiv. The service accepts the client’s request to open a channel.

Select the correct order of the same.

i – iii – iv  - iii  -  ii  -  iii  - iv

Page 25: book1

iii – iv – i  - iiiii  -  iv  - ii  - i

59) Which of the following statements are true for .Net Remoting?

It is a replacement of DCOM.Using Remoting you can make remote object calls which lie in different Application Domains.Remoting is the other name of web-service.Client uses proxy to make method call in Remote object.

60) How can you prevent your .NET projects outputs i.e .dll or .exe from being disassembled?

Digitally sign the project outputObfuscate the project outputImplement Code Access Security feature of the .NET frameworkDeploy the application in the GAC

61) Your company , uses Visual Studio .NET to develop internal applications. You create a Windows control that will display custom status bar information. Many different developers will use the control to display the same information in many different applications. The control must always be displayed at the bottom of the parent form in every application. It must always be as wide as the form. When the form is resized, the control should be resized and repositioned accordingly. What should you do?

Create a property to allow the developers to set the Dock property of the control.Set the default value of the property to AnchorStyle.Bottom.

Create a property to allow the developer to set the Anchor property of the control.Set the default value of the property to AnchorStyle.Bottom.

Place the following code segment in the UserControl_Load event:this.Dock = DockStyle.Bottom

Place the following code segment in the UserControl_Load event:this.Anchor = AnchorStyle.Bottom

Page 26: book1

62) Typically, the Binding defines the following

The underlying transport protocolSecurity requirementsMessage EncodingAll the above three

63) Vinay is developing a website in asp.net 2.0. He has used the Login Server control for authenticating users visiting the site. Now he wants to store the user's information on the client machine automatically without the knowledge of the user who has logged in. What will he have to do?

By setting DisplayRememberMe property of the Login control to falseBy setting the RememberMeSet property of the Login control to true.Both A and BNone of the Above

64) Which of the following IPERMISSION method signature is incorrect?

IPermission Intersect (IPermission Target);IPermission Copy (IPermission Target);IPermission Union (IPermission target);IPermission IsSubsetof(IPermission target);

65) Fulton provides a credit card processing application for its customers. The current application supports only computers that run on a Microsoft Windows operating system. You are asked to rewrite the current application as a .NET application. This .NET application does not need to be backward compatible with the current application. You must ensure that this new application meets the following requirements: • Must support asynchronous processing. • Must be able to pass data through firewalls. • Must pass only SOAP-Compliant formatted data validated by using an XSD schema. • Must not be limited to client computers running on a Microsoft operating system. You want to accomplish this task by using the minimum amount of development effort.

Which type of .NET application should you use?

Page 27: book1

Windows service XML Web service Serviced component .NET Remoting object

66) You create a asp.net web application for insurance company called AXA. The application is used to generate automobile insurance quotes.One page in the application allows the user to enter the vehicle identification number(VIN). The page provides manufacturing information on the identified vehicle, and that information is used in rating the vehicle for insurance. The only control on the page is a textbox control for entering the VIN.You define an event handler for the change event of the TextBox control. The event handler performs the vehicle lookup in the database. The autopostback attribute of the TextBox control is set to true. During Testing, you attempt to browse to the page by using Internet explorer on one of your test computers.You discover you do not receive vehicle information after entering a valid VIN and using the TAB key to move out of the box. This problem does not occur when you use other test computers that are running Internet explorer. What should you do?

Configure Internet Explorer to allow scripting.Configure Internet Explorer to allow page transitions.In the Page Directive, set the SmartNavigation attribute to "True".

In the Page directive, set the AutoEventWireUp attribute to "True".

67) If your users are not in active directory ,which provider model is best suitable?

Basic authentication with WindowsUsername authentication with SQL Membership ProviderUsername authentication with Custom StoreCertificate authentication with certificates

Page 28: book1

68) I have a service called as someservice.asmx at http://localhost/MyWebService/someservice.asmx.

Which of the following is a correct way of creating a proxy class called as calculator.cs for this web service

wsdl /l:cs /r:Calculator.cs http://localhost/MyWebService/someservice.asmx wsdl /l:Calculator.cs http://localhost/MyWebService/someservice.asmxwsdl /l:cs /out:Calculator.cs http://localhost/MyWebService/someservice.asmxwsdl /target:Calculator.cs http://localhost/MyWebService/someservice.asmx

69) While creating Web Service through visual studio template, which namespaces are include automatically?

System.WebSystem.WebServicesSystem.Web.ServicesSystem.Web.Services.Protocols

70) What does the ASP.NET MVC URL Routing System do?

1)Map incoming URLs to the application and route them so that the right Controller and Action method executes to process them2) Construct outgoing URLs that can be used to call back to Controllers/Actions (for example: form posts, <a href="" target="_newcdswin"> links, and AJAX calls)3) Connect the URL from the connection manager4) All of the above

71) Purpose of the below listed code is to

SiteMapDataSourceView  siteMapView = (SiteMapDataSourceView) ACTSiteMapDataSource.GetView(String.Empty);

Page 29: book1

SiteMapNodeCollection lSiteMapNodeCollection= (SiteMapNodeCollection) siteMapView.Select(DataSourceSelectArguments.Empty);

SiteMapNodeCollection siteMapList = new SiteMapNodeCollection();        foreach (SiteMapNode node in lSiteMapNodeCollection)        {            if (!(node.Title == "Home" || node.Title == "Links"))                siteMapList.Add(node);        }        return siteMapList;

Traverse through the complete SiteMap node collection Traverse through the complete SiteMap node collection and Removes Home and Links nodes while displaying SiteMapTraverse through the complete SiteMap node collection and Adds Home and Links nodes while displaying SiteMapNone of the above

72) If you want to create an instance of any workflow what is the correct way of doing it? (Assume that the runtime is started, and the object name is runtime).

WorkflowInstance instance =runtime.CreateWorkflow(typeof(Workflow));instance.Start();WorkflowInstance instance = runtime.Create(typeof(Workflow));instance.Start();WorkflowInstance instance = new WorkflowInstance(typeof(Workflow));instance.Start();None of these

73) How do you create the Persistence service which is used for Persisting a workflow in a database?

1) string Conn = "server=localhost;Initial Catalog=WorkflowStore;User Id=user1; pwd=passwd123";

Page 30: book1

SqlWorkflowPersistenceService per = new SqlWorkflowPersistenceService(Conn,true,new TimeSpan(0,0,20),new TimeSpan(0,0,10));

2) string Conn = "server=localhost;Initial Catalog=WorkflowStore;User Id=user1; pwd=passwd123";

SqlWorkflowPersistenceService per = runtime.SqlWorkflowPersistenceService(Conn,true,new TimeSpan(0,0,20),new TimeSpan(0,0,10));

3) string Conn = "server=localhost;Initial Catalog=WorkflowStore;User Id=user1; pwd=passwd123";

SqlWorkflowPersistenceService per = runtime.AttachSqlWorkflowPersistenceService(Conn,true,new TimeSpan(0,0,20),new TimeSpan(0,0,10));

4) None of these

74) Consider the emp table having columns empno, ename Which of the following SQL query fetches ename that occur more than twice in the emp table

select count(*) from emp group by ename having count(*) >2;select ename, count(*) from emp having count(*) >2;select ename, count(*) from emp where count(*) >2;select ename, count(*) from emp group by ename having count(*) >2;

75) A workflow defines a property called as “FirstName” . How do you send the value to this property through the client application?

1)Dictionary<string, object> dict = new Dictionary<string, object>();dict.Add("FirstName", textBox1.Text);WorkflowRuntime runtime = new WorkflowRuntime(typeof(WorkflowLibrary1.Workflow1), dict);runtime.Start();2)Dictionary<string, object> dict = new Dictionary<string, object>();dict.Add("FirstName", textBox1.Text);

Page 31: book1

WorkflowInstance instance = runtime.CreateWorkflow(typeof(WorkflowLibrary1.Workflow1), dict);instance.Start();3)WorkflowInstance instance = runtime.CreateWorkflow(typeof(WorkflowLibrary1.Workflow1), “FirstName”);instance.Start();4)None of these

76) You want to ensure that the MetaDataPublishing has to be enabled for a service which is hosted under IIS. Which code snippet has to be added in the Web.config file for this?

1) <behaviors>      <serviceBehaviors>        <behavior name="CustomBehaviour">          <serviceMetadata httpGetEnabled="true"/>                  </behavior>      </serviceBehaviors>    </behaviors>2)<behaviors>      <serviceBehaviors>        <behavior name="CustomBehaviour">          <serviceMetadata httpPostEnabled="true"/>                  </behavior>      </serviceBehaviors>    </behaviors>3)<behaviors>      <serviceBehaviors>        <behavior name="CustomBehaviour">          <serviceMetadata httpGetEnabled="False"/>        </behavior>      </serviceBehaviors>    </behaviors>4)<behaviors>      <serviceBehaviors>        <behavior name="CustomBehaviour">          <serviceMetadata="true"/>        </behavior>      </serviceBehaviors>    </behaviors>

Page 32: book1

77) Which of the following Polymorphism-keyword should be used [within the Child class code] for Method/Function of the Parent Class to be executed?

Instance methodoverloading method / ShadowingShared methodclass methods

78) How can the assembly be delay signed?

sn.exe -Rsn -ksn -dCannot be done

79) Please select the valid Sitenode tag definition for SiteMap

<siteMapNode title="National Accounts"     target="_newcdswin"     description="National Accounts"/>

<siteMapNode title="National Accounts"     source="NationalAccounts.aspx"     description="National Accounts"/><siteMapNode name="National Accounts"     url="NationalAccounts.aspx"    description="National Accounts"/><siteMapNode title="National Accounts"     url="NationalAccounts.aspx"     description="National Accounts"/>

80) Write the LINQ statement for following collection to get ProductName and UnitPrice and it should accessible as Price from the collection.Class Product{    public string ProductName;    public string Category;    public double UnitPrice;}

var productPriceList = from p in products        select {p.ProductName, Price = p.UnitPrice};

Page 33: book1

var productPriceList = from p in products        select new {p.ProductName, p.UnitPrice};var productPriceList = from p in products        select new {p.ProductName, Price = p.UnitPrice};var productPriceList = from p in products        select new {p.Name, Price = p.UnitPrice};

81) What are different modes to create remote objects in .Net?

SAO, SOAPCAO, SINGLETONSAO, CAO, CAO, MARSHAL

82) Samuel develops a Windows-based application BrainD. BrainD uses a DataSet object that contains two DataTable objects. BrainD will display data from two data tables. One table contains customer information, which must be displayed in a data-bound ListBox control. The other table contains order information, which must be displayed in a DataGrid control. Samuel need to modify BrainD to enable the list box functionality.

What should he do?

Use the DataSet.Merge method.Define primary keys for the Data Table objects.Create a foreign key constraint on the DataSet object.Add a DataRelation object to the Relations collection of the DataSet object.

83) What are the possible attribute values for OutputCache directive?

VaryByControlVaryByHeaderVaryByCustomVaryByParams

84) How can we kill User Session?

Page 34: book1

Add code in session_onend event of global.asaxcall Session.abandon()redirect to home page.You cannot kill user session explicitely, it will be either automatically killed when user logs out or when session gets timeout.

85) You develop a Windows-based customer service application that includes a search feature. Users will enter characters in a text box to look up customer information by family name.

For convenience, users must be able to perform a search by entering only the first few characters of the family name. To enable this functionality, your application will capture the users input and stores it in a variable named BDName. Your application must then submit a Microsoft SQL Server query to the central customer service database.

How should you write the query?

SQL = “SELECT PersonalName, FamilyName FROM “ + “Customers WHERE FamilyName = ‘” + BDName + “%’”;SQL = “SELECT” PersonalName, FamilyName FROM “ + “Customers WHERE FamilyName LIKE ‘” + BDName + “%’”;SQL = SELECT PersonalName, FamilyName FROM “ + “Customers WHERE FamilyName = ‘” + BDName + “*’”;SQL = “SELECT PersonalName, FamilyName FROM “ + “Customers WHERE FamilyName LIKE ‘” + BDName + “*’”

86) Which are the attributes of <list> tag from the given one's (Select more than one choice)? 

<dl> <list> <ul> <ol> <dt>  

87) The valid configuration setting to configure your membership provider to set specific max and min requirements for numeric, alhpabetic and alphanumeric characters will be

Page 35: book1

<membership ...>   <providers>      <add PasswordLength=10 alphanumericCharacters=2 .../>   </providers></membership><membership ...>   <providers>      <add minRequiredPasswordLength=10 minRequiredNonalphanumericCharacters=2 .../>   </providers></membership><membership ...>   <providers>      <add minRequiredLength=10 minRequiredNonalphanumericCharacters=2 .../>   </providers></membership><membership ...>   <providers>      <add minRequiredPasswordLength=10 NonalphanumericCharacters=2 .../>   </providers></membership>

88) The Local Communication Service wants to define an event that will be passed to the workflow. The code snippet for the same is shown below. 

event EventHandler<ProcessingEventArgs> ExpenseReportProcessed;

What is the basic requirement for the above event to work properly?

All objects passing between a workflow and a host must be serializable objectsIn addition to being serializable, LCS events must derive from the ExternalDataEventArgs classBoth the statements A and B are True

Page 36: book1

Only Statement A is true.

89) Choose all the statements that you could use in the WHERE clause to find only the rows where the first name is Bobby or Bobbi. Choose all that apply.

WHERE name = ‘Bobby’ or name = ‘Bobbi’WHERE name LIKE ‘Bobb_’WHERE name LIKE ‘Bobb%’WHERE name LIKE ‘Bobb[iy]’

90) What is the correct way of configuring passwords to be sent by email in the web.config file?

<mailSettings> <smtp>  <network host="localhost" port="25" from="[email protected]"   defaultCredentials="true" /> </smtp>   </mailSettings>

<mailSettings> <smtp>   <network host="local" port="25" from="[email protected]"    defaultCredentials="true" /> </smtp>   </mailSettings>

<mailSettings> <smtp>   <network host="localhost" port="28" from="[email protected]"     defaultCredentials="true" /> </smtp>  </mailSettings>

None of the Above

91) How will you define the service that must use sessions?

Page 37: book1

[ServiceContract]    public interface IShoppingCartService    {…}[ServiceContract(SessionMode=SessionMode.Required)]    public interface IShoppingCartService    {…}[ServiceContract(SessionMode=SessionMode.Required)]    public class IShoppingCartService    {…}[ServiceContract(SessionMode.Required)]    public interface IShoppingCartService    {…}

92) What is the mechanism in Asp.Net MVC architecture which provides a lot of flexibility in how you map URL's to controller classes?

URL mapping engineSite mapping enginePage mapping engineAll of the Above

93) Following which statement is correct signature for the extension Methid for string class

public string GetNumerics(string s)public string GetNumerics(this string s)public static string GetNumerics(string s)public static string GetNumerics(this string s)

94) Which is the correct option that uses netTcpBinding for the service programmatically?

1) ServiceHost host = new ServiceHost(typeof(Service.ShpooingCart)); WSHttpBinding binding = new WSHttpBinding();host.AddServiceEndpoint(typeof(Contract.IShoppingCartService), binding, "http://localhost:8080/Cart");2) ServiceHost host = new ServiceHost(typeof(Service.ShpooingCart));NetTcpBinding binding = new NetTcpBinding();host.AddServiceEndpoint(typeof(Contract.IShoppingCartService), binding, "http://localhost:8080/Cart");

Page 38: book1

3) ServiceHost host = new ServiceHost(typeof(Service.ShpooingCart));NetTcpBinding binding = new NetTcpBinding();host.AddServiceEndpoint(typeof(Contract.IShoppingCartService), binding, "net.tcp://localhost:8080/Cart");4) ServiceHost host = new ServiceHost(typeof(Service.ShpooingCart));NetTcpBinding binding = new NetTcpBinding();host.AddServiceEndpoint(typeof(Contract.IShoppingCartService), binding, "http://localhost");

95) Which set of parameters are passed to the stored procedure sp_add_category to create a Job in SQL Database:

1)@class, @type, @name2)@JobId, @Jobtype, @Jobname3)@ID, @class, @name4)@ServerName, @ID, @Jobname

96) You are creating an XML Web service that provides a daily quotation from literary works to its customers. This quotation is requested in many different languages, thousands of times every day, and by thousands of Web sites operating many different platform. A Web method named GetQuotes takes a languageID as input. GetQuotes uses this language ID to retrieve a translated version of the daily quotation from a Microsoft SQL Server database and to return that quotation to the customer. You want to minimize the time it takes to return the translated version.

What should you do?

Store each translated quotation by using the Cache object.Store each translated quotation by using the Session object. Set the BufferResponse property of the WebMethod attribute to false. Set the CacheDuration property of the WebMethod attribute to an interval greater than zero.

Page 39: book1

97) ProfileManager class perform the following tasks (choose two options)

Searching for statistical information about all profilesDetermine the number of profiles that have not been modified in a given period of time.Managing and Editing statistical information about all profiles.Managing and editing statistical information about anonymous profiles.

98) What will be th output for the following array and given Lambda Expression

            string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };

            var shortDigits = digits.Where((digit, index) => digit.Length == index);

            Console.WriteLine("Short digits:");            foreach (var d in shortDigits)            {                Console.WriteLine(d.ToString());            }

twosevenfournine

99) You develop an enterprise application, called RetailApplication that includes a Windows Forms presentation layer, middle-tier components for business logic and data access, and a Microsoft SQL Server database.

You are in the process of creating a middle-tier component that will execute the data access routines in your application. When data is passed to this component, the component will call

Page 40: book1

several SQL Server stored procedures to perform database updates. All of these procedure calls run under the control of a single transaction. The code for the middle-tier will implement the following objects:

SqlConnection cn = new SqlConnection();

SqlTransaction tr;

If two users try to update the same data concurrently, errors will occur. You must add code to your component to specify the highest possible level of protection against such errors. Which code should you use?

tr = cn.BeginTransaction("ReadCommitted");tr = cn.BeginTransaction(IsolationLevel.ReadCommitted);tr = cn.BeginTransaction(IsolationLevel.Serializable);tr = cn.BeginTransaction("Serializable");

100) What does the following Asp.Net Membership code do and when :

         protected void button1_Click(object sender, EventArgs e)         {           MembershipUser memUser = Membership.GetUser(txtUserName.Text);           if (memUser != null && memUser.IsLockedOut == true)               memUser.UnlockUser();               }

It Tracks the number of bad password attempts during login.It shows that, in event of automatic account lockout how to unlock the user accountIt tracks the number of bad password answers that are supplied when either retrieving the password or attempting to reset a password.

Page 41: book1

All of the above.

101) If you want to use Persistance what is the other Service that Persistence service that has to be attached to the workflow Runtime?

1) SharedConnectionService2) SharedConnectionWorkBatchService3) SharedConnectionWorkflowCommitWorkBatchService4) None of these

102)