Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Visual C++ questions

0 views
Skip to first unread message

Gopal Dar

unread,
Jul 8, 2000, 3:00:00 AM7/8/00
to

I would be grateful for rectification of the following questions.
My answers are marked with an *

1. You want all errors that are generated by a COM component using ATL to be
written to the application event log. How can this be done?

a). Use the throw statement to throw an instance of comerror,
b). Set the facility code of the returned HRESULT to FACILITY_NULL*

2. You add a method named GetEmployeesList to the dual interface of a COM
component. The method has a single input parameter, which is a department ID
of type short. It returns an array of BSTR's. You want to define the method
by using IDL so that it is accessible from Visual Basic. Which code fragment
should be used?

a).[id(1),helpstring("Returns list of employees for specified department.")
VARIANT GetEmployeeList(short DeptID);
b).[id(1),helpstring("Returns list of employees for specified department.")
HRESULT GetEmployeeList([in short DeptID,[out,retval VARIANT*Employees);*

3.You deploy a disrtibuted app using MTS. To improve the performance of your
app you move one of the MTS packages that is accessed by your application to
a new server, and then unistall it from the original server. The client
computers must be able to directly access the packages. What do you do?

a).Export the package from the new server. From the client computers, run
the executable file created by the export process.
b). Do nothing. The original server will reroute client computers to the new
server*

4.You write a business component for an MTS package that is in a distributed
database envoirnment. The business component is named Bus_User. The Bus_User
business component contains a method named UpdateUser. The UpdateUser method
must verify that the user who is calling this method has sufficient security
rights to make the modification. If the user has sufficient security rights,
then the Bus_User business component must call a method in a data component
named Db_User. The Db_User data component attempts to update a table in the
Microsoft SQL Server database. The table has constraints and triggers. You
configure the transaction property of the Bus_User business component as
Requires a transaction. You configure the transaction property of the
Db_User data component as Supports transactions. You are implementing the
UpdateUser method for the Bus_User business component. You must create an
instance of the Db_User data component. Which code will achieve your
objective?

a). IUser*pUser=NULL;
HRESULT hr;
hr = pObjectContext->CreateInstance(CLSID_DbUser,
IID_IUser, (void**)&pUser);

b). IUser*pUser=NULL;
HRESULT hr;
hr = CoCreateInstance(clsidDbUser,
Null, CLSCTX_INPROC_HANDLER,IID_IUSER,
(void**)&pUser);*

c). IObjectContext*pObjectContext=NULL;
IUser*pUser = NULL;
HRESULT hr;
hr = GetObjectContext(&pObjectContext);
hr = pObjectContext->CoCreateInstance(clsidDbUser,
NULL,CLSCTX_INPROC_HANDLER, IID_IUSER,
(void**)&pUser);

5. A section of code that you are writing might encounter memory exception
or file exception errors. You want to treat each type of error differently
when it occurs. You surround the specific section of code in a try
statement. How should the catch block be implemented?

a). catch( CException*e )
{
// Handle the out of memory and file exceptions here.
}

b).catch( CMemoryException*e )
{
// Handle the out of memory exception here.
}
catch( CFileException*e )
{
// Handle the file eceptions here
} *

6. A type library defines a class named CoBar. The CoClass implements an
interface called IBar. The IBar interface is marked as the default interface
for the CoBar coclass. You want to instantiate an instance of CoBar and
manipulate it through the IBar interface. Which code fragment should you
use?

a). #import "Useful.tlb" named_guids
IBarPtr pBar(CLSID_CoBar); *

b). #import "Useful.tlb" named_guids
UsefulLib::IBarPtr pBar (CLSID_CoBar);

c). #import ""Useful tlb" no_namespace named_guids
IBarPtr pBar(CLSID_CoBar);

7. A spreadsheet application exports its data into an ASCII text file named
c:\TableData.txt. a microsoft SQL server database named Datumco contains a
table named OrderDetails. Each line in the ASCII text file represents one
row that will be imported into the OrderDetails table. Each field within a
line is separated by a | character. Each line ends with a |\n character
pair. You must import the data from the ASCII text file into the database.
How must you code?

a). BULK INSERT Datumco.[OrderDetails
FROM 'c:\TableData.txt'
WITH
{
FIELDTERMINATOR = '|'
ROWTERMINATOR = '|\n'
}

b). BULK INSERT Datumco.[OrderDetails
FROM 'c:\TableData.txt'
WITH
{
FIELDTERMINATOR = '|'
ROWTERMINATOR = '|\n'
FORMATFILE = 'c:TableData.txt'

c). BULK INSERT Datumco.[OrderDetails]
FROM 'c:TableData.txt' *

d). BULK INSERT Datumco[OrderDetails
FROM 'c:\TableData.txt'
WITH
{
FORMATFILE= 'c:\TableData.txt'
}

8. You debug a distributed application. The app uses MTS services, and has
three business logic components named Record, Measurement and Acquisition.
These three components are locted in one MTS package named TestInstrument.
While you test, you find that the Acquisition component occaisonally raise
an unhandled exception error, and you want to prevent this from affecting
the Record and Measurement
components. How can you achieve your aim ?

a). Export the Acquisition component to a remote MTS server.
b). Rewrite the Acquistion component as a COM executable file.*
c).Set the transaction support property of the Acquistion component to
Requires a new transaction.
d). Create a new MTS package, and move the Aquisition component there.

9. You have a project in Visual Source Safe in which you remove the destroy
permission for users. Which category of users is affected?

a). New users,
b). Existing users,
c). New and existing users except those currently accessing the shadow
directory,*
d). New and existing users including those currently accessing the shadow
directory.

10). You have a project in Visual Source Safe in which you want to recover
yesterday's project. Today, you only changed one file. You do not want to
loose today's file change. What must you do?

a). Show history, roll back, get latest version,
b). Show history, pin, get latest version,*
c). Branch project, show history, roll back, get latest version,
d). Branch project, show history, pin, get latest version.

John A. Grant

unread,
Jul 8, 2000, 3:00:00 AM7/8/00
to
"Gopal Dar" <gopa...@swipnet.se> wrote in message
news:tRz95.12613$rH5....@nntpserver.swip.net...

>
> I would be grateful for rectification of the following questions.
> My answers are marked with an *
[...]
Is this MCSE study homework?

--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here


0 new messages