GIAC GIAC Secure Software Programmer - C#.NET - GSSP-NET Exam Practice Test

You work as a Software Developer for ABC Inc. You create a Console application named
ConsoleApplication4. You use the System.Security.Cryptography namespace. You want to use the key lengths of 384 bits to 16384 bits. You use RSACryptoServiceProvider class to encrypt and decrypt data. Which of the following code segments will you use to accomplish this task?
Each correct answer represents a part of the solution. Choose all that apply.
Correct Answer: A,C
You work as an ADO.NET Application Developer for ABC Inc. The company uses Microsoft Visual Studio .NET 2008 as its application development platform. You create an ADO.NET application by using .NET Framework 3.5. You are using the System.Linq.Expressions namespace to represent the code expression as objects in the form of expression trees. You want to initialize the members of a newly created object. What will you do to accomplish the task?
Correct Answer: B
You work as a Software Developer for ABC Inc. The company uses Visual Studio.NET 2008 as its application development platform. You create an ASP.NET Web application using the .NET Framework 3.5. 91. The application uses ASP.NET AJAX, and you need to deploy it in a Web farm environment. You are required to configure SessionState for the application. Which of the following code segments will you use to accomplish this task?
Correct Answer: B
David works as a Software Developer for GenTech Inc. He defines an interface, named Interface1.
Interface1 contains the following code:
public interface Interface1
{
// Code goes here.
}
David creates a serviced component, named Component1, which implements Interface1. Which of the following code will he add to Component1 to ensure that it is built properly?
Correct Answer: C
Sandra works as a Software Developer for ABC Inc. She develops a Windows form named MyForm1. She wants to add a Button control named button1 to a Panel control named panel1 at runtime. Therefore, she writes the following code:
1.private void MyForm1_Load(object sender, EventArgs e)
2.{
3.Button button1 = new Button();
4.button1.Location = new Point(50,50);
5.button1.Size = new Size(100, 30);
6.button1.Text = "My First button";
7.Panel panel1 = new Panel();
8.panel1.Location = new Point(10, 100);
9.// Write code here
10.
// Write code here
11.
}
Which of the following code statements will Sandra write in line numbers 9 and 10? (Line numbers are for reference only.)
Each correct answer represents a part of the solution. Choose two.
Correct Answer: B,E
Allen works as a Software Developer for ABC Inc. The company uses Visual Studio.NET as its application development platform. He creates an application using the .NET Framework.. He writes the following code segment in the application:
01 class gClass
02 {
03 public gClass(int k)
04 {
05 //Write code here
06 }
07 }
08 public class gSub : gClass
09 {
10 public static void Main(String[] argv)
11 {
12 gSub gs=new gSub(20);
13 }
14 gSub(int j):base(j)
15 {
16 //Write Code here
17 }
18 gSub(string st, int j):this(j)
19 {
20 gClass ss=new gClass();
21 }
22 }
When you execute the above code segment, you get an error at line 20. Which of the following code segments will he place at line 20 to execute the code successfully?
Each correct answer represents a complete solution. Choose all that apply.
Correct Answer: B,C
You work as an Enterprise Application Developer for ABC Inc. The company uses Visual Studio .NET 2008 as its application development platform. You create a logging utility class using .NET Framework 3.5. The utility class writes logs to event log services. You are required to ensure that the client applications that use the utility class can create an instance of the utility class only if they have access rights to write to the event log services.
What will you do?
Correct Answer: C
You work as a Software Developer for ABC Inc. The company uses Visual Studio .NET as its application development platform. You create a class library using the .NET Framework. The library will be used to open the NSCs of computers. Later, you will set up the class library to the GAC and provide it Full Trust permission. You write down the following code segments for the socket connections:
SocketPermission permission = new SocketPermission(PermissionState.Unrestricted);
permission.Assert();
A number of the applications that use the class library may not have the necessary permissions to open the network socket connections. Therefore, you are required to withdraw the assertion. Which of the following code segments will you use to accomplish the task?
Correct Answer: D
Sam works as a Software Developer for GenTech Inc. He creates an ASP.NET page, named Page1, for a college Web site. Page1 is used to enroll new applicants to a certification course offered by the college. In order to get admission to the course, an applicant's age must be between eighteen and twenty-five. The page contains several TextBox controls that are used by applicants to feed their personal details. The data entered by each applicant is then used to check the eligibility of the applicant.
One of the TextBox controls on the page is named txtDateofBirth. Sam wants to verify that the applicants meet the age requirement. He wants to perform validation both on the server-side and on the client-side. In order to validate the age, he adds a CustomValidator control, named CValidator, to the page and sets its ControlToValidate property to txtDateofBirth. Which of the following will Sam use to accomplish the task?
Each correct answer represents a part of the solution. Choose all that apply.
Correct Answer: A,B
You work as a Software Developer for ManSoft Inc. The company uses Visual Studio .NET as its application development platform. You create an application named MyRandomGen. You use the System.Security.Cryptography namespace. You want to create a code that randomly rolls the dice fifty times and displays the results on the screen. Which of the following code segments will you use to accomplish this task?
Correct Answer: B
David works as a Software Developer for McRobert Inc. He develops a Web application named App1 using Visual Studio .NET. App1 contains several Web forms that display information about an online shopping process. David wants to provide a Web-based shopping catalog to users. However, he wants to ensure that the information about the shopping catalog is secure and requires no server resources.
What will David do to accomplish the task?
Correct Answer: A
Which of the following is the best way to authenticate users on the intranet?
Correct Answer: A
You work as a Software Developer for ABC Inc. The company uses Visual Studio.NET 2005 as its application development platform. You are creating an application using .NET Framework 2.0. You are using regular expression in the application to validate email, phone number, etc. You are required to match the preceding character or sub expression zero or more times. Which of the following wildcard characters will you use to accomplish the task?
Correct Answer: A
You work as a Web Application Developer for SunInfo Inc. The company uses Visual Studio 2008 as its application development platform. You create a Windows Forms application using .NET Framework 3.5. You want to create a default event handler for an event in the designer. Which of the following steps will you take to accomplish the task?
Each correct answer represents a part of the solution. Choose all that apply.
Correct Answer: A,B,D
Julia works as a Software Developer for Mansoft Inc. She develops an application using Visual Studio .NET. The application uses a method named MyMethod, which is located in an unmanaged DLL. Julia wants MyMethod to require the application to allocate unmanaged memory, fill the data, and pass the memory address to the application. She also wants to ensure that on returning from MyMethod, the application de-allocates the unmanaged memory. What will Julia do to accomplish the task?
Correct Answer: A
You work as a Software Developer for ABC Inc. You create a Web service named MyWebService using Visual Studio .NET. You implement a public Web method. You make the method accessible through a Web service application by attaching the WebMethod attribute to the public method. The public method is stored in the class file of the Web service file. When you create a Web service project using the Web service project template, by default, one public method named HelloWorld is created. The HelloWorld public method does not become available through the Web service until you attach the WebMethod attribute. The method must be applied to each method declaration. Now, you want to configure a Web service method. You want to ensure that the Web method performs updates on more than one databases or if the sequence of updates is critical to the overall success of the Web method. Which of the following properties will you use to accomplish this task?
Correct Answer: A
You work as a Software Developer for ABC Inc. The company uses Visual Studio.NET 2005 as its application development platform. You have recently finished development of an application using .NET Framework 2.0. The application has multiple threads that execute one after another. You want to modify the application and schedule the threads for execution based on their assigned priority. What will you do to accomplish the task?
Each correct answer represents a complete solution. Choose all that apply.
Correct Answer: A,B,C,E
Martha works as a Software Developer for NetCom Inc. She develops an application, named App1, using Visual Studio .NET. The application contains a form, named MyForm1. MyForm1 contains several controls including a TextBox, named txtDOB. The txtDOB control is used to accept the date of birth from a user. In order to ensure that a user enters a valid date in txtDOB, Martha adds validation logic to the Validating event of txtDOB. When she tests the form by using some invalid dates in txtDOB, the validation logic does not appear to be working as expected. What is the most likely cause of the issue?
Correct Answer: D
You work as a Software Developer for ABC Inc. You create a Web service application named MyWebService using Visual Studio .NET 2005. You use the MyWebService to create a SOAP message. You are not sure whether or not the SOAP message format is correct. Therefore, you decide to use the AsynchronousOperationException class. This class is used to throw an exception when the format of a SOAP message is invalid. Which of the following code segments will you use to accomplish the task?
Each correct answer represents a part of the solution. Choose all that apply.
Correct Answer: A,B
Smith works as a Software Developer for ABC Inc. He creates an application using Visual Studio .NET 2005. The application displays "Welcome to ABC" on the top-left corner of a form. He writes the following code:
StringBuilder strbuild1 = new StringBuilder(20);
strbuild1.Append("'Welcome");
strbuild1.Append(" ");
strbuild1.Append("to");
strbuild1.Append(" ");
strbuild1.Append("ABC'");
string str1 = strbuild1.ToString();
Console.WriteLine(str1);
Console.ReadLine();
What is the main purpose of using StringBuilder object in the application?
Correct Answer: C
Janet works as a Software Developer for Blue Well Inc. The company management wants its project team members to be registered so that they can access the company's Website. To ensure that the team members can work together effectively, Janet creates an XML Web service named MyWebService by using Visual Studio .NET. She wants to ensure that the team members have a valid username and password in order to maintain strict security against unauthorized access. Which of the following authentication methods will Janet implement in her application to accomplish this task?
Correct Answer: C
Martha works as a Software Developer for HiTech Inc. She develops a Web application named
SalesApp that contains a Web page named MyWebForm1.aspx. The Web page contains validation controls for the Web server controls on the page. Martha wants the custom validation error message to display if the validation fails to call the validation control on the Web page. Which of the following actions will Martha take to accomplish the task?
Each correct answer represents a part of the solution. Choose all that apply.
Correct Answer: A,C,D
Allen works as a Software Developer for ABC Inc. The company uses Visual Studio.NET 2008 as its application development platform. Allen develops an application using .NET Framework 3.5. The application connects to a SQL Server database using a SqlConnection object named Connection1. He creates some stored procedures in the database, which are used to update the data. Allen finds that sometimes, the update operation does not affect any row. He wants to add an error handling code to the application. Which of the following code segments will he use to accomplish the task?
Correct Answer: D
You work as an Application Developer for ABC. The company uses Visual Studio .NET Framework 3.5 as its application development platform. You are working on enhancements to an existing WPF application. One problem you have been encountering is that users of the current version routinely enter invalid data, and since the controls use data binding, that data either gets put in the database incorrectly, or in some cases generates a database error. You want to incorporate validation with your data bound controls. Which of the following choices is the best way to accomplish this goal?
Correct Answer: D
You work as a Software Developer for ABC Inc. The company uses Visual Studio .NET as its application development platform. You are creating a Windows service application using the .NET Framework. The service is used to execute several tasks that require background processing. You do not want to actively manage threads in the service application, but you must make sure that security checks are performed during the execution of the task. What will you do to accomplish the task?
Correct Answer: D
You work as a Windows Application Developer for ABC Inc. The company uses Visual Studio .NET 2008 as its application development platform. You create a Windows application using .NET Framework 3.5. The application uses a SQL Server 2008 database on the network.
You use ADO.NET Data Services that exposes data as resources that are addressable by URIs. You access and change data by using the semantics of representational state transfer (REST), specifically the standard HTTP verbs of GET, PUT, POST, and DELETE. You must ensure that when a service violates any other constraint, the service cannot strictly be referred to as RESTful. What will you do?
Correct Answer: D
You work as an Enterprise Application Developer for ABC Inc. The company uses Visual Studio .NET as its application development platform. You create a Windows client application that communicates with a business layer component using the .NET Framework. The business layer component includes a class named MyUtility as follows:
public class MyUtility
{ public MyUtility() { }
public void ChangeData() { }
}
The application must fulfill the following criteriA.
l Create instances of the MyUtility class only within the business component.
l The application should invoke the functions within the MyUtility class.
You evaluate the code of the MyUtility class and decide it requires modification. Which of the following modifications for the code will you recommend?
Correct Answer: C
John works as a Web Developer for ProMetaworks Inc. He creates an ASP.NET application, named MyApp1, by using Visual Studio .NET. MyApp1 contains a page, named Page1. Page1 contains a RadioButtonList control that contains five items. John wants to ensure that users select one of the items from the RadioButtonList control before submitting the page. He wants to accomplish the task with least development effort. Which of the following validation controls will he use to accomplish the task?
Correct Answer: D
You work as a Software Developer for ABC Inc. You create a Console application to create multiple satellite assemblies. Which of the following statements about satellite assemblies are true?
Each correct answer represents a complete solution. Choose all that apply.
Correct Answer: A,C,D
You work as a Software Developer for ABC Inc. The company uses Visual Studio.NET as its application development platform. You create an application using the .NET Framework. You need to use the regular expressions to provide a concise and flexible means for identifying strings of text of interest, such as particular characters, words, or patterns of characters. Which operation will you use to construct the regular expressions?
Each correct answer represents a complete solution. Choose all that apply.
Correct Answer: A,B,C
You work as a Software Developer for ABC Inc. The company uses Visual Studio .NET 2005 as its application development platform. You have recently finished development of a Windows application using .NET Framework. Users report that the application is not running properly. When the users try to complete a particular action, the following error message comes out:
Unable to find assembly 'myservices, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=29b5ad26c9de9b95'.
You notice that the error occurs as soon as the application tries to call functionality in a serviced component that was registered by using the following command:
regsvcs.exe myservices.dll
You must make sure that the application can call the functionality in the serviced component with no exceptions being thrown. What will you do to accomplish this task?
Correct Answer: D
Allen works as a Software Developer for Mansoft Inc. He develops a Web application using Visual Studio .NET. He adds a Web reference to an XML Web service named MyWebService in the application. MyWebService includes a method named MyMethod, which takes user identification number as a parameter and returns a DataSet object containing user information. The System.ArgumentException is thrown if the user identification number does not lie between 1 and
500. Allen writes a try and catch block to capture the exception thrown by the Web service. Which of the following exceptions will the try and catch block catch if a user calls MyMethod passing 501 as a parameter?
Correct Answer: B
You work as a Software Developer for WebTech Inc. You create a Web service named Utils. You want a new object of Utils to be created whenever a customer makes a call to the service. Which of the following will accomplish this task?
Correct Answer: D
You work as a Software Developer for ABC Inc. The company uses Visual Studio .NET 2008 as its application development platform. You create an ASP.NET Web application using .NET
Framework 3.5. The application uses the health monitoring events to raise application audit events in the following situations:
l When users login
l When users modify their password
l When users perform other security-related actions
You must ensure that the application logs all audit events for all applications on the Web server.
What will you do?
Correct Answer: C
You work as a Software Developer for ABC Inc. The company uses Visual Studio.NET as its application development platform. You create an application using .NET Framework. You use the application to create an assembly. Now you need to encrypt assembly data. The company has not provided encryption requirements to you. Which of the following symmetric cryptography classes will you use to accomplish this task?
Correct Answer: A
You work as a Software Developer for ABC Inc. The company has several branches worldwide.
The company uses Visual Studio.NET 2005 as its application development platform. You have recently finished the development of an application using .NET Framework 2.0. The application can be used only for cryptography. Therefore, you have implemented the application on a computer. What will you call the computer that implemented cryptography?
Correct Answer: D
Mark works as a Software Developer for McRobert Inc. He develops an ASP.NET application using Visual Studio .NET. The application loads department name and employee data only once in each user's session. Mark creates two DataTable objects, named Employees and Departments. The
Departments object remains static, but the Employees object is modified whenever new employees join the company.
Mark wants to minimize the time it takes for the application to reload an ASP.NET page after each change. Which of the following statements will he use to accomplish this?
Correct Answer: D
Mark works as a Software Developer for CyberNet Inc. He develops a serviced component, named MyComponent1, using Visual Studio .NET. MyComponent1 uses a SQL Server database. In the code, Mark uses the ExecuteNonQuery method of the SqlCommand class to execute a Transact- SQL statement. Which of the following values will the ExecuteNonQuery method return?
Correct Answer: B
You work as a Software Developer for ABC Inc. The company uses Visual Studio .NET 2008 as its application development platform. You create an ASP.NET Web application using .NET Framework 3.5. You need to represent a strongly typed lambda expression as a data structure in the form of an expression tree. Which of the following classes will you use to accomplish the task?
Correct Answer: D
Tony works as a Software Developer for TechNet Inc. He creates a satellite assembly named
SatAssembly1. He wants to install SatAssembly1 in the global assembly cache. Therefore, he compiles the assembly by using the Al.exe tool and signs SatAssembly1. Which of the following possible tools will Tony use to sign SatAssembly1?
Each correct answer represents a complete solution. Choose two.
Correct Answer: C,D