Ensurepass

QUESTION 91

Which methods allow COM components to be used in .NET applications? (Choose all that applay.)

A. Add a reference to the component throudh Microsoft Visual Studio 2005.

B. Use the type Library Import tool (TlbImport.exe).

C. Use the Regsvr32 tool.

D. Ensure thet the application is registered, using the RegSvr tool if necessary. Then either add a reference to it from the COM tab of the Add Reference dialog box or use TblIpm.exe.

Correct Answer: ABD


QUESTION 92

What types of objects derive from te MemberInfo class? (Chose all that applay.)

A. FieldInfo class

B. MethodInfo class

C. Assembly class

D. Type class

Correct Answer: ABD


QUESTION 93

When compressing data with the DeflateStream class, how do you specify a stream into which to write compressed data?

A. Set the BaseStream property with the destination stream, and set the CompressionMode property to Compression.

B. Specify the stream to write into the DeflateStream object is created (for example, in the constructor).

C. Use the Write method of the DeflateStream class.

D. Register for the BaseSream event of the DeflateStream class.

Correct Answer: B


QUESTION 94

You work as an application developer. You are currently in the process of creating an application that reads binary information from a file.

You need to ensure that the only the first kilobyte of data is retrieved. Vhat should you do?

A. Use the following code: FileStream fs = new FileStream ("C:\file.txt’ FiloModo.Open) BufferedStream bs = new BufferedStream (fs); byte [ ] bytes = new byte [1023]; bs.

Head (bytes, 0, bytes. Length) ; bs. Close 0 ;

for (int i = 0; i < bytes, Length-1: i++) Console, WriteLitie {"{0} : [!}", I, bytes [i]);

B. Use the following code:

FileStream fs = new FileStream ("C:\file. txt", FileMode.Open); byte [ ] bytes = new byte [1023]; fs. Read (bytes, 0, bytes. Length);

fs. Close 0 ;

for 0tit i = 0; i < bytes. Length-1 ; L++) Console. WriteLine (*"{0) : (1}", I, bytes [i]);

C. Use the following code:

FileStream fs = new FileStream ("C:\file. txt", FileMode.Open); BufferedStream bs = new BufferedStream (Is); byte [ ] bytes = new byte [1023]:

bytes = bs. ReadAllBytes (0, 1023): bs. Close () ;

for (int i = 0; i < bytes.Length-l; i++) Console. WriteLine ("{0} : {1}", I, bytes [i]);

D. Use the following code:

FileStream fs = new FileStream (‘CrWfile. txt", FileMode.Open): BufferedStream bs = new BufferedStream (f s);

byte [ ] bytes = new byte [1023] ; bs. Read (bytes) ;

bs. Close 0 ;

for (itit i = 0; i < bytes.Length-1; i++) Console. WriteLine {"{0} : {1}", T, bytes [i]):

Correct Answer: B


QUESTION 95

Where can you add items to a LinkedList? (Choose all that apply.)

A. At the beginning of the LitikedList

B. Before any specific node

C. After any specific node

D. At the end of the Linkedlist

E. At any numeric index in the LinkedList

Correct Answer: ABCD


QUESTION 96

Which event would you use to run a mothod immediately before deserialization occurs?

A. OnSerializing

B. OnDserializing

C. OnSerialized

D. OnDeserialized

Correct Answer: B


QUESTION 97

You work as the application developer. You are creating a new class which contains a method named GetCurrentRate. GetCurrentRate extracts the current interest rate from a variable named currRate, currRate contains the current interest rate which should be used.

You develop serialized representations of the class and now need to write a code segment which updates the currRate variable with the current interest rate if an instance of the class is deserialized.

Choose the code segment which will accomplish this task.

A. [OnSerializing] internal void updateValue (StreamingContext context) { pcurrRate = GetCurrent Rate();

}

B. [OnSerializing] internal void UpdateValue (Serialisationlnfo info) { info.AddValue {"currontRate", GetCurrentRate ());

}

C. [OnDeserializing] internal void UpdateValue {Serializationlnfo info) { info. AddValue ("currentRate", GetCurrentRate ());

}

D. [OnDeserialized] internal void UpdateValue (StreamingContext context) { currRate = GetCurrentRate();

}

Correct Answer: D


QUESTION 98

You work as an application developer. Company wants you to develop an application that handles passes for abc.com’ s parking lot. The application has to store and retrieve vehicle information using a vehicle identification number {VIN).

You need to use the correct code to ensure type-safety. What should you do?

A. Use the following code: Vehicle vl, v2;

vl = new Vehicle ("1M2567871Y91234574" , ‘Nissan Silvia", 1996):

v2 = new Vehicle ("lF2569122491234574" , ‘Mitsubishi Lancer", 2005); ArrayList vList = new ArrayList (); vList, Add (vl);

vList.Add (v2):

B. Use the following code: Vehicle vl, v2;

vl = new Vehicle ("lM2567871Y91234574", ‘Nissan Silvia", 1996):

v2 = new Vehicle ("1F2569122491234574", "Mitsubishi Lancer", 2005); SortedList <string, Vehicle> vList = new SortedList <string, Vehicle>; vList.Add (vl.VIN, vl);

vList.Add (v2.VIN, v2) ;

C. Use the following code: Vehicle vlh v2:

vl = new Vehicle ("1M2567871Y91234574", "Nissan Silvia", 1996); v2 = new Vehicle ("IF2569122491234574", ‘Mitsubishi Lancer", 2005); List vList = new List ();

vList.Add (vl); vList.Add (v2);

D. Use the following code: Vehicle vl, v2;

V1 = new Vehicle ("1M2567871Y91234574", "Nissan Silvia’, 1996); v2 = new Vehicle ("1F2569122491234574", "Mitsubishi Lancer", 2005) SortedList vList = new SortedList ();

vList.Add (vl.VIN, vl) ; vList.Add (v2. YIN, v2) ;

Correct Answer: B


QUESTION 99

You work as an application developer. You are currently in the process of creating a new application.

You are required to read compressed data files that have been sent by company’s sales offices. These data files are less than 4 GB in size, but were compressed without cyclic redundancy.

You want to write a method that receives the compressed files and return the uncompressed data as a byte array. What should you do?

A. Use the following code:

public byte [] DecompressFile (string file)

{

FileStream fs = new FileStream (file, FileMode, Open);

DeflateStream cs = new DeflateStream (fs, CompressionModc. Decompress, true) byte [ ] data = new byte [fs.Length – l]; cs. Read (data, (), data, Length);

cs. Close (); return data;

}

:

B. Use the following code;

public byte [] DecompressFile (string file)

{

FileStream fs = new FileStream (file, FileModc, Open);

GZipStream cs = new GZipStream (fs, Compress iotiMndo. Decompress) byte [ ] data = new byte [fs. Length – 1]; cs. Read (data, 0, data.Length); return data:

}

C. Use the following code:

public byte [] DecompressFile (string file)

FileStream fs = new FileStream (file, FileMode,Open);

DeflateStream cs = new DeflateStream (fs, CompressionMode. Decompress) byte [ ] data = new byte [fs.Length – l]; cs. Read (data, 0, data.Length);

return data;

}

D. Use the following code:

public byte [] DecompressFile (string file)

{

FileStream. fs = new FileStream (file, FileMode. Open);

GZipStream cs = new GZipStream (fs, CompressionMode. Decompress, true) ; byte [ ] data = new byte [fs. Length – 1]; cs. Read (data, 0, data. Length);

cs. close 0; return data;

}

Correct Answer: A


QUESTION 100

You write the following class that has three methods. public class SimpleEmployee {

public string GetEmployeeId() { return employeeId; } public string GetName() { return employeeName; } public string GetTitle() { return jobTitleName; }

You need to expose the class to COM in a type library. The COM interface must not expose the method GetEmployeeId. The GetEmployeeId method must still be available to managed code. You need to hide the GetEmployeeID method from the COM interface.

What should you do?

A. Apply the ComVisible attribute to the class and methods in the following manner. [ComVisible(false)]

public class SimpleEmployee {

public string GetEmployeeId() { return employeeId; } [ComVisible(true)]

public string GetName() { return employeeName; } [ComVisible(true)]

public string GetTitle() { return jobTitleName; }

B. Apply the ComVisible attribute to the class and methods in the following manner. [ComVisible(true)]

public class SimpleEmployee {

public string GetEmployeeId() { return employeeId; } [ComVisible(true)]

public string GetName() { return employeeName; } [ComVisible(true)]

public string GetTitle() { return jobTitleName; }

C. Apply the ComVisible attribute to the GetEmployeeId method in the following manner. public class SimpleEmployee {

[ComVisible(false)]

public string GetEmployeeId() { return employeeId; } public string GetName() { return employeeName; } public string GetTitle() { return jobTitleName; }

D. Change the access modifier for the GetEmployeeId method in the following manner. public class SimpleEmployee {

protected string GetEmployeeId() { return employeeId; } public string GetName() { return employeeName; }

public string GetTitle() { return jobTitleName; }

Correct Answer: C

Download Latest 70-536 Real Free Tests , help you to pass exam 100%.

Comments are closed.