Q1. 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
Q2. You are writing code for a new method named Process:
void Draw(object o)
{
}
The code receives a parameter of type object. You need to cast this object into the type Polygon. At times, the value of o that is passed to the method might not be a valid Polygon value. You need to make sure that the code does not generate any System.InvalidCastException errors while doing the conversions.
Which of the following lines of code should you use inside the Draw method to accomplish this goal?
A. Polygon p = (Polygon) o;
B. Polygon p = o is Polygon;
C. Polygon p = o as Polygon;
D. Polygon p = (o != null) ? o as Polygon : (Polygon) o;
Answer: C
Q3. You are developing an application that receives orders over the Internet via Electronic Data Interface (EDI).
The application needs to run constantly the background and wait for orders. There is no user interface. The application writes messages to the Windows application event log. The application must continue to run even after a user logs off from the computer. Which type of application should you develop for this requirement?
A. Windows Service application
B. Windows Forms application
C. console application
D. Web application
Answer: A
Q4. You are developing a new Web page. You need to create hyperlinks that point to other pages on the World Wide Web. Which of the following methods should you use to create these hyperlinks on your Web page?
A. the SRC attribute of the <IMG> tag
B. the HREF attribute of the <A> tag
C. the HREF attribute of the <LINK> tag
D. the XMLNS attribute of the <HTML> tag
Answer: B
Q5. You are developing a Windows Form with a multiple document interface (MDI). You need to write code that arranges the child windows vertically within the client region of the MDI parent form. Which of the following MdiLayout values should you pass to the LayoutMdi method?
A. MdiLayout.TileVertical
B. MdiLayout.Cascade
C. MdiLayout.TileHorizontal
D. MdiLayout.ArrangeIcons
Answer: A
Q6. Suppose that you defined a class Scenario that defines functionality for running customized pivot transform on large data sets. You do not want the functionality of this class to be inherited into derived classes. What keyword should you use to define the Scenario class?
A. sealed
B. abstract
C. private
D. internal
Answer: A
Q7. You are C# developer who is developing a Windows application. You write the following code:
Object o;
Later in the code, you need to assign the value in the variable o to an object of Rectangle type. You expect that at runtime the value in the variable o is compatible with the Rectangle class. However, you need to make sure that no exceptions are raised when the value is assigned. Which of the following code should you use?
A. Rectangle r = (Rectangle) o;
B. Rectangle r = o;
C. Rectangle r = o as Rectangle;
D. Rectangle r = o is Rectangle;
Answer: D
Q8. You are developing an application that manages customers and their orders. Any solution that you develop must take the least amount of effort but offer the best performance.. Which of the following situations is not a good candidate for implementation with stored procedures in your application?
A. Retrieving the list of all customers in the database
B. Retrieving the list of all orders for particular customers
C. Inserting a new order into the Orders table
D. Ad hoc querying by the database administrator
Answer: D
Q9. You need to update the Region fields for customers whose reference code is "TKY". The updated Region should be set to "Japan". Also, this change should affect only customers who live in Tokyo. Which of the following SQL statement should you use?
A. UPDATE Customers SET Region = 'Japan'
WHERE RefCode = 'TKY' AND City = 'TOKYO'
B. UPDATE Customers SET Region = 'Tokyo'
WHERE RefCode = 'TKY' AND City = 'Japan'
C. UPDATE Customers SET Region = 'Tokyo'
WHERE RefCode = 'TKY'
D. UPDATE Customers SET Region = 'Japan'
WHERE RefCode = 'TKY'
Answer: A
Q10. You need to start a Windows service named ProcService from the command line. Which command should you use?
A. net start ProcService
B. net pause ProcService
C. net continue ProcService
D. net stop ProcService
Answer: A