Exam Prep Questions

Team-Fly    

Developing XML Web Services and Server Components with Visual C#™ .NET and the .NET Framework, Exam Cram™ 2 (Exam 70-320)
By Amit Kalani, Priti Kalani

Table of Contents
Chapter 11.  Deployment


Question 1

You have written a component that will be shared among multiple applications. You want to install the component to the GAC. Which of the following tools will you use to achieve this? (Select the two best answers.)

  • A. sn.exe

  • B. ngen.exe

  • C. gacutil.exe

  • D. installutil.exe

A1:

Answers A and C are correct. When you want to install a component to the GAC, you first assign it a strong name. You do this by using the Strong Name tool (sn.exe). You can place a strongly named assembly in the GAC by using the Global Assembly Cache tool (gacutil.exe). Answer B is incorrect because the Native Image Generator (ngen.exe) is the tool to convert a managed assembly to native code. Answer D is incorrect because the Installer tool (installutil.exe) enables you to install and uninstall the installer components from a specified assembly. The Installer tool not useful for installing the shared components; instead, it is the tool to install associated server resources such as the event log and performance counters.

Question 2

You have created a .NET remoting application that uses some components that are not shared by other applications. Each of these components creates its own assemblies, and all of these assemblies have strong names associated with them. The application that uses these components is not required to load a specific version of these components. You do not want to store the assemblies directly under the application's installation folder. Which of the following options is the best approach for storing the assembly files for the application's components?

  • A. Store the components in the GAC.

  • B. Store the assemblies in one of the subdirectories under the application's installation directory, and specify this subdirectory as part of the <probing> element in the application's configuration file.

  • C. Store the components anywhere you want, and specify the path to them by using the <codeBase> element in the application's configuration file.

  • D. Store the components in the Window's System directory.

A2:

Answer B is correct. The applications in question are not specific about versions, so a good place to store the assemblies is in a folder inside the application's installation folder, with its location specified via the <probing> element in the application's configuration file. Answer A is incorrect because if the components are not shared between applications, it is not a good idea to store them in the GAC. Answer C is incorrect because if you use the <codeBase> element in the application's configuration file, you must specify a version of the assembly. Answer D is incorrect because Windows's System directory is for the use of the Windows operating system; applications should not copy their files to the System directory.

Question 3

You are creating a setup project for a Windows service. In the Property Pages dialog box for the setup project, you have set the Compression property to Optimized for Speed. Which of the following options will be true because of this configuration option? (Select the two best answers.)

  • A. All assemblies in the application will be precompiled to native code so that they run faster.

  • B. The setup project will run faster.

  • C. The resulting assemblies will be larger.

  • D. The setup package will be larger.

A3:

Answers B and D are correct. The setup program compresses the assemblies by using a compression algorithm that is optimized for speed. As a result, you have a lower compression ratio, resulting in a large setup package that executes faster. Answers A and C are incorrect because modifying a setup project's Compression property to Optimized for Speed does not affect the size or the speed of the installed assemblies.

Question 4

You are responsible for maintaining the installation of a Windows service that listens for orders and updates the database. The Windows service uses a serviced component, OrderProcess.dll, that is signed with a strong name. You have installed version 1.0.0.0 of this serviced component in the root directory of the application. You later receive a version 2.0.0.0 of OrderProcess.dll, which you install in the Global Assembly Cache, as well as the root directory of the application. You reconfigure the application configuration file of the Windows service to redirect version 1.0.0.0 calls to version 2.0.0.0. Now you receive version 3.0.0.0 of OrderService.dll, which you again install in the Global Assembly Cache. You do not reconfigure the application configuration file. Now when you run the Windows service, which version of OrderService.dll is loaded and from which location?

  • A. Version 1.0.0.0 from the root directory of the application

  • B. Version 2.0.0.0 from the root directory of the application

  • C. Version 2.0.0.0 from the Global Assembly Cache

  • D. Version 3.0.0.0 from the Global Assembly Cache

A4:

Answer C is correct. As a first step, the CLR tries to determine the version of assembly by analyzing the configuration files. From application configuration files, the CLR knows that it should search for version 2.0.0.0 of the assembly instead of version 1.0.0.0. Therefore, as a next step when the CLR queries the GAC, it can bind to version 2.0 of the assembly. Answer A is incorrect because the application configuration files are read when the program is started, and the configuration file redirects version 1.0.0.0 calls to version 2.0.0.0. Answer B is incorrect because, for strongly named assemblies, the GAC is searched before the root directory. Answer D is incorrect because compiled assemblies are bound to a particular version of the assembly unless the binding is overridden in the application's configuration file.

Question 5

You have created a database-driven Web service. Using Microsoft SQL Server, you have also generated an installation script for your database. This script is stored in a file named InstData.sql. When the clients deploy the Web service on their servers, the database should be created as part of the installation. You are creating a setup project by using Visual Studio .NET. Which of the following actions should you take to create the database as part of the installation process?

  • A. Create a component that derives from the Installer class. Override its Install() method to create the database. Add the component to the Install node of the Custom Actions Editor in the setup project.

  • B. Create a component that derives from the Installer class. Override its Install() method to create the database. Add the component to the Commit node of the Custom Actions Editor in the setup project.

  • C. Copy the InstData.sql file to the Application folder on the file system on the target machine by using the File System Editor. Add InstData.sql to the Install node of the Custom Actions Editor in the setup project.

  • D. Create a component that derives from the Installer class. Override its Install() method to create the database. Add the component to the Launch Conditions Editor in the setup project.

A5:

Answer A is correct. You can use the Custom Actions Editor to take custom actions such as database installation during application setup. Answer B is incorrect because if you have a component that derives from the Installer class and overrides the Install() method to create databases, it must be added to the Install node of the Custom Actions Editor. Answer C is incorrect because copying the file to the Application folder just copies the file to the target machine instead of installing the database. Answer D is incorrect because you don't want the installation to be done conditionally.

Question 6

When you install a Windows application on a target machine, you want to store the ReadMe.txt file in the installation directory selected by the user. You also want to create a shortcut for the ReadMe.txt file on the desktop of the target machine. While creating a setup project, which of the following actions would you take in the File System Editor to achieve this? (Select all that apply.)

  • A. Move the shortcut to the ReadMe.txt file from the Application Folder node to the User's Desktop node in the File System on Target Machine node.

  • B. Add the ReadMe.txt file to the Application Folder node of the File System on Target Machine node.

  • C. Add the ReadMe.txt file to the User's Desktop node in the File System on Target Machine node.

  • D. Create a shortcut to the ReadMe.txt file that is available in the Application Folder node of the File System on Target Machine node.

  • E. Move the shortcut to the ReadMe.txt file from the User's Desktop node to the Application Folder node in the File System on Target Machine node.

A6:

Answers A, B, and D are correct. To copy the ReadMe.txt file to the installation directory selected by the user at install time, you add it to the Application Folder node in the File System on Target Machine node. To create a shortcut, you first create a shortcut to the ReadMe.txt file stored in the Application Folder node in the File System on Target Machine node. Then you move this shortcut from the Application Folder node to the User's Desktop node in the File System on Target Machine node. Answer C is incorrect because this action copies the ReadMe.txt file itself to the desktop of target machine, when all you want is a shortcut. Answer E is incorrect because you created the shortcut to the ReadMe.txt file in the Application Folder node rather than on the desktop of the target machine.

Question 7

Your application uses version 4.3.0.0 of the FunChart assembly. The producer of the assembly has issued version 4.3.l.0 of the assembly, together with a publisher policy file that dictates using 4.3.1.0 in place of 4.3.0.0 in all applications. You discover after testing that one of your applications, named ChartApp, which previously worked with 4.3.0.0, fails with 4.3.1.0. You want only this application to use the old version of the assembly, while letting all other applications use the new version. What should you do?

  • A. Add the element <publisherPolicy apply="no"/> to the ChartApp.exe.config file.

  • B. Add an administrator policy in the machine.config file that redirects requests for 4.3.1.0 to 4.3.0.0.

  • C. Delete the publisher policy from your computer.

  • D. Copy version 4.3.0.0 of the assembly from the GAC to the folder containing ChartApp.exe.

A7:

Answer A is correct. The <publisherPolicy> element enables you to override publisher policy for a single application. Answers B and C are incorrect because adding an administrator policy or deleting the publisher policy affects all applications on the computer, not just one application. Answer D is incorrect because copying the assembly will have no effect on the binding, which is satisfied from the GAC.

Question 8

You are using the Installer tool (installutil.exe) to install server resources by executing the installer components in three assemblies. You issued the following command:

 installutil Assembly1.exe Assembly2.exe Assembly3.exe 

During the execution of this command, the installation of Assembly3.exe fails. Which of the following will happen?

  • A. Only Assembly1.exe will be installed.

  • B. Only Assembly2.exe will be installed.

  • C. Both Assembly1.exe and Assembly2.exe will be installed.

  • D. None of the assemblies will be installed.

A8:

Answer D is correct. installutil.exe performs installation in a transactional manner. If one of the assemblies fails to install, installutil.exe rolls back the installations of all other assemblies. Answers A, B, and C are incorrect because if the installation of Assembly3.exe fails, none of the assemblies will be installed.

Question 9

You are designing a Windows application that will be downloaded to a user's computer from your company's Web server. After it is installed on the user's computer, the application might request and download more components from the Web site, as needed for the user's requirements. The application uses several components that need to be installed in the GAC on the user's machine. You want to sign your components with a cryptographic digital signature, as well as with an Authenticode signature, so that your company's identity is certified through an independent certifying authority. Which of the following options would you use for signing the components before they are packaged for deployment?

  • A. Use signcode.exe to sign the assemblies.

  • B. Use sn.exe to sign the assemblies.

  • C. Use signcode.exe followed by sn.exe to sign the assemblies.

  • D. Use sn.exe followed by signcode.exe to sign the assemblies.

A9:

Answer D is correct. sn.exe is used to sign an assembly with a cryptographic digital signature, whereas signcode.exe is used to sign an assembly with an Authenticode signature. When both are used together to sign an assembly, you should always use sn.exe before using signcode.exe. Answers A and B are ncorrect because they provide only part of the solution. Answer C is incorrect because if you make any modifications to the assembly after signing it using the signcode.exe tool, the assembly is considered to be tampered with.

Question 10

You work as a software developer for a big pharmacy. You are writing some components that will be shared across several applications throughout the company. You want to place an assembly named CommonComponents.dll in the GAC for testing purposes. You do not have access to the company's private key, but you have stored the company's public key in the assembly manifest of CommonComponents.dll. Which of the following commands are you required to run to place your assembly in the GAC? (Select all that apply.)

  • A.

     sn.exe -Vu CommonComponents.dll 
  • B.

     sn.exe -Vr CommonComponents.dll 
  • C.

     gacutil.exe /u CommonComponents.dll 
  • D.

     gacutil.exe /i CommonComponents.dll 
A10:

Answers B and D are correct. You must first turn off the verification for partially signed assemblies. This can be done by using the sn.exe tool with the -Vr switch. Next the assembly can be installed to the GAC using the /i switch with the gacutil.exe command. Answer A is incorrect because the -Vu switch enables assembly verification before its installation in the GAC. Answer C is incorrect because the /u switch is for uninstalling an assembly from the GAC.


    Team-Fly    
    Top


    MCAD Developing XML Web Services and Server Components with Visual C#. NET and the. NET Framework Exam Cram 2 (Exam Cram 70-320)
    Managing Globally with Information Technology
    ISBN: 789728974
    EAN: 2147483647
    Year: 2002
    Pages: 179

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net