Welcome to Certifiable, your exam prep headquarters. Here you'll find questions about some of the tricky areas that are fair game for the certification exams. Following the questions, you'll find the correct answers and explanatory text. We change the questions weekly.

Questions (May 4, 2001)
Answers (May 4, 2001)

This week's questions are similar to what you might find on Exam 70-175: Designing and Implementing Distributed Applications with Microsoft Visual Basic 6.0, which is an elective for the MCSD certification. The MCSD exams tend to focus on a subset of the topics that appear in the exam preparation guide on Microsoft's Training & Services Web site. The reason for this focus is that some skills are more important than others. For example, knowing how to perform version control is a useful skill, but it's not a critical skill. Knowing how to design and build COM components, however, is a skill that every MCSD should have. Today's questions, therefore, involve using COM components in a distributed environment. These questions are moderately difficult because you must understand COM to choose the correct answer. Before you take Exam 70-175, make sure that you understand COM thoroughly.

Questions (May 4, 2001)

Question 1
Data from one code component on your system needs to use Distributed COM (DCOM) to pass 1 to 20 string values of variable length to other components running on the network for your distributed application. What is the most efficient method for passing data? (Choose all that apply.)

  1. Open a data connection to a database that both systems can access. Run a stored procedure to generate a temporary table and pass the table name to the secondary component, which will retrieve the data.
  2. Use an array that can grow or shrink in size.
  3. Write the data to a temporary file.
  4. Manually pack the data into a binary structure and pass this structure as a unit; the other component should unpack the data.

Question 2
You want to implement asynchronous notifications between out-of-process applications. The order in which the components communicate with each other isn't critical to the project's success. Which method should you use?

  1. Asynchronous notifications using events.
  2. Asynchronous notifications using call backs.
  3. Windows socket communications.
  4. Write public events for the container application.

Question 3
Which term describes the part of the COM process whereby a proxy packs and a stub unpacks method calls between client and server?

  1. Marshalling
  2. DCOM
  3. Remote Automation
  4. Named Pipe

Answers (May 4, 2001)

Answer to Question 1
The correct answers are B—Use an array that can grow or shrink in size; and D—Manually pack the data into a binary structure and pass this structure as a unit; the other component should unpack the data.

Visual Basic (VB) supports arrays that can grow and shrink. When components communicate across process barriers, a process called marshalling occurs. The system uses a proxy/stub mechanism to pack data, and each property or method call hits the network and causes traffic. If the two components pack the data and pass it as one data set, only one marshalling sequence occurs across process boundaries.

Writing data to and from a database causes the data to move twice on the network, and it also requires two database connections. Using a shared file causes user authentication and disk I/O, which is often much slower than network or memory-based transactions.

Answer to Question 2
The correct answer is A—Asynchronous notifications using events. When you use events, the component doing the work makes anonymous broadcasts to any components holding a WithEvents variable to the object.

When the order in which components communicate with each other IS important, you need to use call-back procedures. You can use call-back procedures to control the communication order because the component doing the work knows a lot about the object receiving the notifications.

Answer to Question 3
The correct answer is A—Marshalling. Method calls between a client and in-process components occur using the same stack. Because client/server method calls occur on a different computer, you need to use a more complex method because the components don't share the same stack. This is true of any out-of-process communication. COM uses marshalling to move the arguments across the process boundaries by creating a proxy in the client process space and a stub in the server process space.