Q1. You are writing a C# program that iterates through a collection such as arrays and lists. You need to make sure that you process each item in the collection once. You also need to ensure that your code is easy to read and debug. Which of the following C# statements provide the best solution for this requirement?
A. while
B. for
C. foreach
D. do-while
Answer: C
Q2. You need to display specific messages to users when their browser is not running JavaScript. Which of the following code segment should you use?
A. <script runat="server"> ... </script>
B. <script> ... </script>
C. <% ... %>
D. <noscript> ... </noscript>
Answer: D
Q3. You are planning to develop a new software system for your organization. You need to verify that the implementation of the system matches with the requirements of the system. Which of the following activities would accomplish this requirement?
A. testing
B. design
C. release
D. requirements analysis
Answer: A
Q4. You are writing code for a class named Book. You should be able to get a list of all books sorted by the author’s last name. You need to write code to define this behavior of a class. Which of the following class elements should you use?
A. method
B. property
C. event
D. delegate
Answer: A
Q5. You are developing a C# program. You write the following code:
int x = 10
int y = ++x
int x = y++;
What will be the variable z after all the above statements are executed?
A. 10
B. 11
C. 12
D. 13
Answer: B
Q6. Which of the following presses is responsible for providing the ASP.NET functionality?
A. inetinfo.exe
B. iexplorer.exe
C. aspnet_isapi.dll
D. aspnet_wp.exe
Answer: D
Q7. You are writing code to handle events in your program. You define a delegate named PolygonHandler like this:
public delegate void PolygonHandler(Polygon p);
You also create a variable of the PolygonHandler type as follows:
PolygonHandler handler;
Later in the program, you need to add a method named CalculateArea to the method invocation list of the handler variable. The signature of the CalculateArea method matches the signature of the PolygonHandler method. Any code that you write should not affect any existing event-handling code. Given this restriction, which of the following code lines should you write?
A. handler = new PolygonHandler(CalculateArea);
B. handler = CalculateArea;
C. handler += CalculateArea;
D. handler -= CalculateArea;
Answer: C
Q8. You have completed developing a new software application. To ensure the quality of the software, you need to verify that each method or function has proper test cases available. Which testing approach should you use?
A. white-box testing
B. black-box testing
C. alpha testing
D. beta testing
Answer: A
Q9. You are developing an ASP.NET Wep page that displays status of a shipment. You need to write some code that will change the Web page's appearance and assign values to some controls. Where should you put this code?
A. In the InitializeComponent method
B. In a method that handles the Load event
C. In a method that handles the Init event
D. In a method that handles the PreRender event
Answer: B
Q10. You are developing a C# program for a bike rental company. The data is stored in a SQL Server 2000 server named BikeServer in a database named BikeDB. You must use the Windows Integrated authentication to connect to the BikeDB database. Which of the following connection strings should you choose in your C# program for connecting to the BikeDB database?
A. "Provider=SQLOLEDB;Data Source=BikeServer;InitialCatalog=BikeDB;Integrated Security=SSPI;"
B. "Provider=SQLOLEDB;Data Source=BikeServer;InitialCatalog=BikeDB;User Id=sa; Password=gih6774y"
C. "Data Source=BikeServer;InitialCatalog=BikeDB;Trusted_Connection=true;"
D. "Data Source=BikeServer;InitialCatalog=BikeDB;User Id=sa;Password=gih6774y"
Answer: A