Q1. You need to gain a better understanding of the solution before writing the program. You decide to develop an algorithm that lists all necessary steps to perform an operation in the correct order. Any technique that you use should minimize complexity and ambiguity. Which of the following techniques should you use?
A. flowchart
B. decision table
C. C# program
D. A paragraph in English
Answer: A
Q2. You are developing a new Windows application that needs to write messages to the event log. You use the EventLog class to write these messages. Each event log message must specify the name of the application writing to an event log. Which property of the EventLog class should you use?
A. Source
B. Log
C. Site
D. MachineName
Answer: A
Q3. You are planning to develop a new software system for your organization. You need to review the plans, models, and architecture for how the software will be implemented. Of which of the following activities should you review the output?
A. requirements analysis
B. design
C. coding
D. testing
Answer: B
Q4. You are developing an application that stores data in SQL Server 2005 database. You need to write a query that retrieves all orders in the orders table that were placed on January 1, 2011. You write the following query:
SELECT * FROM Orders
WHERE OrderDate = 01/01/2011
The statement executes without any error but does not return any data. You are certain that the database contains order from this date. How should you correct the SQL statement?
A. SELECT * FROM Orders
WHERE OrderDate = #01/01/2011#
B. SELECT * FROM Orders
WHERE OrderDate = %01/01/2011%
C. SELECT * FROM Orders
WHERE OrderDate = '01/01/2011'
D. SELECT * FROM Orders
WHERE OrderDate = "01/01/2011"
Answer: C
Q5. You are writing a C# program that needs to iterate a fixed number of times. You need to make sure that your code is easy to understand and maintain even when the loop body contains complex code. Which of the following C# statements provide the best solution for this requirement?
A. while
B. for
C. for each
D. do-while
Answer: B
Q6. Suppose that you are a new C# developer and are reviewing object-oriented programming fundamentals.
Which of the following statements is not true?
A. A class is a concrete instance of an object.
B. A class defines the template for an object.
C. A class is a definition of a new data type.
D. A constructor is used to initialize the data members of the object.
Answer: A
Q7. You are developing code for a method that calculates the discount for the items sold. You name the method CalculateDiscount. The method defines a variable, percentValue of the type double. You need to make sure that percentValue is accessible only within the CalculateDiscount method. What access modifier should you use when defining the percentValue variable?
A. private
B. protected
C. internal
D. public
Answer: A
Q8. Your application includes a SqlDataAdapter object named sqlDataAdapter that connects to the Employees table. You use the Fill method to retrieve the data from the Employees table. The SqlDataAdapter's Connection property is set to a valid connection to the SQL Server database, but the connection is in the closed state. Which of the following statements is true about the working of the Fill method?
A. The Fill method will throw an exception because the connection is closed.
B. The Fill method will open the connection, read the data, and leave the connection open.
C. The Fill method will open the connection, read the data, and leave the connection closed.
D. The Fill method will return an emptyresult setbecause the connection is closed.
Answer: C
Q9. You write the following code in your Web page:
protected void Page_Load
(object sender, EventArgs e)
{
/* additional code here */
}
You expect this code to be executed in response to the Load event of the ASP.NET page. However, when you request the page, you notice that the method is not executed. What should you do to make sure that the Page_Load method is executed when the Load event of the Wep page is fired?
A. Set the AutoEventWireup attribute of the @page directive to true.
B. Set the AutoEventWireup attribute of the @page directive to false.
C. Set the IsCallBack property of the page class to true.
D. Set the IsPostBack property of the page class to true.
Answer: A
Q10. You are developing a C# application. You need to decide whether to declare a class member as static. Which of the following statements is true about static members of a class?
A. You can use the this keyword reference with a static method or property.
B. Only one copy of a static field is shared by all instances of a class.
C. Static members of a class can be used only after an instance of a class is created.
D. The static keyword is used to declare members that do not belong to individual objects but to a classitself.
Answer: D
Q11. You need to update the Products table and remove all discontinued products. When the products are discontinued, the value of the field Discontinued is set to true. Which of the following SQL statements should you use to make changes to the Products table?
A. INSERT
B. SELECT
C. UPDATE
D. DELETE
Answer: D
Q12. You are C# developer who is developing a Windows application. You develop a new class that must be accessible to all the code packaged in the same assembly. Even the classes that are in the same assembly but do not directly or indirectly inherit from this class must be able to access the code. Any code outside the assembly should not be able to access the new class. Which access modifier should you use to declare the new class?
A. public
B. protected
C. private
D. internal
Answer: C
Q13. In your application, you are using a queue data structure to manipulate information. You need to find whether a data item exists in the queue, but you don’t want to actually process that data item yet. Which of the following queue operations will you use?
A. enqueue
B. dequeue
C. peek
D. contains
Answer: D
Q14. You are developing a program that performs frequent insert and delete operations on the data. Your requirement also dictates the capability to access previous and next records when the user clicks the previous or next button. Which of the following data structures will best suit your requirements?
A. array
B. circular linked list
C. linked list
D. doubly linked list
Answer: D
Q15. You are developing a user interface component that responds to user actions such as keystrokes. Which of the following programming constructs should you use to accomplish this requirement?
A. event
B. class
C. delegate
D. property
Answer: A
Q16. You need to provide printing functionality to several of your classes. Each class’s algorithm for printing will likely be different. Also, not all the classes have an “is-a” relationship with each other. How should you support this functionality?
A. Add the print functionality to a base class with the public access modifier.
B. Have all classes inherit from an abstract base class and override the base-class method to provide their own print functionality.
C. Have all the classes inherit from a base class that provides the print functionality.
D. Create a common interface that all classes implement.
Answer: D
Q17. 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
Q18. 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