.NET Fundamentals

Ace your homework & exams now with Quizwiz!

Three main features of an object-oriented programming language are _____, _____, and _____.

properties, methods, events

The .NET Framework classes that handle file read and write, as well as copying, moving, or deleting files are contained in which namespace? A) System.IO B) System.FileIO C) Console.IO D) System.InputOutput

A) The .NET Framework organizes the classes that handle file input and output such as reading, writing, copying, moving, and deleting in the System.IO namespace.

A _____ is a template for creating of an object.

class

You can use _____ to group related classes in order to reduce name collisions.

namespace

What is the term that refers to a collection of classes and other types that are reusable in other projects? A) Class Library B) Namespace C) DLL D) Collection

A) A Class Library is a collection of classes, interfaces, and other objects that can be reused in other projects. Typically, the class library is compiled into a DLL or an EXE. The library is added to the project that will use it by adding a reference to the library in the project.

A(n) _____ is a collection of classes, types, and other resources that is designed to contain everything that is needed for a given unit of functionality. A) Assembly B) Application C) DLL D) Framework

A) An Assembly is a collection of classes, data types, and other resources that are designed to contain the everything that is needed for a given unit of functionality. Assemblies are generally in the form of DLLs or EXEs. Assemblies can be either Private or Shared.

Which type of applications do not have a graphical user interface, but instead rely on text input and output? A) Console Application B) Assembly Application C) Binary Application D) Windows Form Application

A) Console applications rely on a text based interface to interact with the user. The best example of a console application is the command prompt application, cmd.exe.

_____ is the process of encrypting data so that only the auhorized users can access it, and encrypting data so that authorized users can detect if the data has been modified by an unauthorized user. A) Cryptography B) Authentication C) Protection D) Versioning

A) Cryptography is chiefly responsible for three things: Encrypting the data so that it cannot be viewed by unauthorized users. Encrypting data so that authorized users are able to detect whether the data has been modified. Establish the identity of the sender so that you can trust that the data is actually coming from the claimed sender.

The EventHandler class is an example of a(n) _____. A) Delegate B) Exception C) Configuration option D) Control

A) EventHandler is a predefined delegate. The EventHandler delegate is defined as follows: public delegate void EventHandler(Object sender, EventArgs e);

You are working on a project to merge two product lines. The first product line uses an integer datatype for the product ID, and the second product line uses a string datatype. Which of the following programming techniques will allow you to have one class called Products that will accept a variable datatype? A) Generics B) Methods C) Polymorphism D) Variables

A) Generics is the programming technique that will allow your Products class to have a variable datatype for the ID member of the class. Generics allow you to have a place holder type, known as a type parameter. When a new instance of the class is instantiated, you must include a value for the type parameter to be used in place of the place holder. The type that is passed is called the concrete type. Here are a few examples of how to instantiate a class using the type parameter using this class definition. public class Product<T> { public T id; } Product<int> ProdInt = new Product<int>; // This code will create an instance of the Product class using int as the concrete type. Product<string> ProdString = new Product<string>; // This code will create an instance of the Product class using string as the concrete type.

In C#, which is the keyword that refers to the current instance of the class? A) this B) selected C) current D) me

A) In C#, the "this" keyword is used to reference the current instance of the class. In VB.NET, the "me" keyword is used.

Consider the following code example: int numerator = 5; int denomerator = 0; try { Console.WriteLine("Before Divide"); int res = numerator/denomerator; Console.WriteLine("After Divide"); } catch(DivideByZeroException ex) A) Before Divide Catch Finally After Try B) Before Divide Catch After Try C) Before Divide After Divide Catch Finally After Try D) Catch After Try

A) In the previous code example: int numerator = 5; int denomerator = 0; try { Console.WriteLine("Before Divide"); int res = numerator/denomerator; Console.WriteLine("After Divide"); } catch(DivideByZeroException ex) { Console.WriteLine("Finally"); } Console.WriteLine("After Try"); "Before Divide" will be written in every case. The line directly after that is trying to divide by zero, which will throw a DivideByZeroException. Because of this exception, "After Divide" will never be written. When the exception is thrown, the next line that is process is the catch block. This will print the work "Catch" to the screen in every case. After the catch block is process, the finally block of code is processed. The finally block is always run, whether or not an error was thrown. After the entire try catch block completes, the code continues as normal, and so the words "After Try" will be printed every time.

The feature of the .NET Framework that allows code that is written in one language to interact with code written in a different language is called _____. A) Language Interoperability B) Common Language Runtime C) Common Language Specification D) Common Intermediate Language

A) Language Interoperability is the .NET feature that allows code that is written in any .NET language to interact with code written in any other .NET language. For example, a class file is written in C# can instantiate a class that was written in Visual Basic. Note that this is a run-time feature, not compile-time. This means that you cannot use different languages inside of a single compilation unit.

To avoid naming collisions, _____ can be used to organize your classes into logically related groups. A) Namespaces B) Base Classes C) Class Libraries D) Super Classes

A) Namespaces are used to logically group related classes together. A namespace allows your class library to contain multiple classes of the same name. As long as the classes of the same name are in different namespaces, there will not be a name collision.

The central repository that stores shared assemblies on a computer is called the _____. A) Global Assembly Cache (GAC) B) The .NET Framework C) Dynamic Link Library D) Windows Registry

A) The central repository that stores shared assemblies on a computer is called the Global Assembly Cache (GAC). The GAC allows multiple versions of an assembly to coexist, which greatly simplifies deployment of applications that rely on a specific version of an assembly.

Which of the statements is true of the following line of code? System.IO.StreamReader sr = System.IO.File.OpenText(@"c:\DotNetFundamentals.txt"); A) System is a Namespace, IO is a Namespace, and StreamReader is a class. B) System is a Namespace, IO is a Class, and StreamReader is a method. C) System is a Namespace, IO is a Namespace, and File is a Namespace. D) System is a Namespace, IO is a Namespace, and StreamReader is a Namespace.

A) The elements of the line of code are as follows: System is a Namespace StreamReader is a Class sr is an instance of the StreamReader class File is a Class OpenText is a method that belongs to the File class

Consider the following class: class User { public event EventHandler Change; private String name; public String Name { get { return name; } set { name = value; Change(this, EventArgs.Empty); } } } Which of the following code examples creates a new instance of the User class called usr, and adds an event handler that will call the User_Changed method to the Changed event handler of the class? A) User usr = new User(); user.Changed += new EventHandler(User_Changed); B) User usr = new User(); User.Changed = new EventHandler(User_Changed); C) User usr = new User(); usr.EventHandlers.add("Changed", "User_Changed"); D) User usr = new User(new EventHandler(User_Changed));

A) The first line makes a new instance of the User class and calls the constructor for User, which is not defined in the example class, and so is inherited. The second line addresses the Changed event of the usr instance of the User class, and add a new event handler that will call the User_Changed method. This code is incorrect: User usr = new User(new EventHandler(User_Changed)); In the class file from the question, no constructor is included, and so this code would fail at compile time with the error, "User does not contain a constructor that takes 1 argument" This code is also incorrect: User usr = new User(); User.Changed = new EventHandler(User_Changed); In this case, the code is attempting to assign the event handler to the User class, and not the usr instance of the class. This will thow an error at compile time because the event handler is not static, and so requires an instance of the object in order to assign the new event handler.

An assembly contains information that describes the structure of the classes and other types that are contained in the assembly. What is this data called? A) Metadata B) CIL Code C) Assembly Resources D) Assembly Manifest

A) The metadata of an assembly contains information regarding the structure of the contents of the assembly. For example, the metadata contains the return type and parameters for the methods that are members of a class that is contained in the assembly.

Which keyword is used to signify a member that belongs directly to the class, instead of to each instance of the class? A) Static B) Private C) Dynamic D) Protected

A) The static keyword is used to signify that a member belongs to the class, and not to the individual instances of the class. The private keyword is used to signify that the member belongs only to instances of the class. The protected keyword is used to indicate that the member belongs to the containing class, as well as any class that is derived from the containing class.

You have written the following code to open a file and print the contents of the file to the console. The code you have written so far is: 1: StreamReader fileOne = null; 2: try 3: { 4: fileOne = File.OpenText(@c:\DotNetFundamentals.txt); 5: Console.WriteLine(fileOne.ReadToEnd()); 6: } 7: catch (FileNotFoundException fnfe) 8: { 9: Console.WriteLine(fnfe.Message); 10: } 11: catch (Exception ex) 12: { 13: Console.WriteLine(ex.Message); 14: } Line numbers are included for reference. You need to close the StreamReader in every case. Which of the following should you do? A) After line 14, add the code finally { fileOne.Close(); } B) After line 14, add the code fileOne.Close(); C) Between line 5 and 6, add the code fileOne.Close(); D) Between line 5 and 6, add the code fileOne.Close();

A) To be sure that the StreamReader closes in every case, you should add the code: finally { fileOne.Close;br>} The finally block of a try catch will run in every case, no matter if an exception was or was not thrown.

When you create a class that extends another class, the class that is extended is called the _____ class. A) Base B) Master C) Root D) Parent

A) When one class extends another class, the class that is extended is called the base class.

Which of the following is an accurate description of generics? A. A class using placeholders for one or more of the types it uses. B. A type minimizing the reusability of code and type safety. C. A class enabling the compiler to catch type-casting errors during runtime. D. A type storing a pointer to the date, instead of the actual data.

A. A class using placeholders for one or more of the types it uses.

Consider the following code example: int top = 12; int bottom = 0; try { Console.WriteLine("Before Divide); int result = top/bottom; Console.WriteLine("After Divide"); } catch (DivideByZeroException ex) { Console.WriteLine("Catch DivideByZero"); } catch (Exception ex) { Console.WriteLine("Catch Generic"); } Console.WriteLine("After Try"); What will the output of the code be? A) Before Divide After Divide Catch DivideByZero After Try B) Before Divide Catch DivideByZero After Try C) Before Divide After Divide Catch DivideByZero After Try D) Before Divide Catch DivideByZero Catch Generic After Try

B) "Before Divide" will be written in every case. The line directly after that is trying to divide by zero, which will throw a DivideByZeroException. Because of this exception, "After Divide" will never be written. When the exception is thrown, the next line that is processed is the catch block that has specified the error that was thrown, the DivideByZeroException catch block. This will print "Catch DivideByZero" to the screen in every case. After the DivideByZeroExceptioin catch block is processed, the generic block is not ran, because the exception that was thrown has already been handled. "Catch Generic"

Which of the following is a definition of a Delegate? A) A method that is called when an action occurs in the program, such as a button click or a mouse move. B) A reference type that holds a reference to a method instead of an object. C) An error handling technique that allows the program to try to run the code, and catch any exceptions that occur without causing the program to crash. D) None of these.

B) A delegate is a reference type that holds a reference to a method instead of an object. Delegates are frequently used for event handling functionality. An event handler is a method that is called when an action occurs in the program. The error handling technique described is a try catch block.

You are developing an assembly that does not require access to protected resources on the machine. You want to be sure that your code is never used to access protected resources. Which of the following attributes should be added to the assembly? A) [assembly: SecuritySafeCritical(Level2)] B) [assembly: SecurityTransparent()] C) [assembly: SecurityCritical()] D) [assembly: SecuritySafeCritical()]

B) Adding [assembly: SecurityTransparent()] to the assembly will restrict the assembly from accessing any resources, regardless of which security mode the code is running in.

C# is an example of a _____, which means that it must be compiled into machine language before it can be executed. A) Strongly Typed language B) High-level language C) .NET Framework language D) C based language

B) C# is a high-level language, which means that it must be compiled into machine language before it can execute. In the case of .NET Framework languages, it is first compiled into the Common Intermediate Language (CIL) by the .NET language specific compiler. The CIL code is then compiled into machine code when the program is ready for execution by the Common Language Runtime (CLR). The CLR uses Just-In-time Compilation to compile the CIL code into processor specific code, depending on the processor architecture that the code is running on. This allows the developer to write processor independent code that will work on any processor architecture that is compatible with the .NET Framework. CIL was previously known as Microsoft Intermediate Language (MSIL), but was renamed CIL after it was accepted as an international standard.

The StreamReader and StreamWriter classes default to which character encoding? A) ASCII Encoding B) UTF8 Encoding C) Unicode Encoding D) ASCII2 Encoding

B) If no encoding type is specified, the StreamReader and StreamWriter classes will use UTF8Encoding by default.

Primitive datatypes that are supported directly in the programming language are called _____. A) Strong datatypes B) Intrinsic datatypes C) Included datatypes D) .NET datatypes

B) Intrinsic data types are primitive data types that are included in the programming language by default. Examples include int, string, double, and bool. Type Safety is used to ensure that a program reads and writes the correct number of bytes, depending on which datatype was used.

Which of the following is not an intrinsic data type in C#? A) String B) Int32 C) Int D) Bool

B) Intrinsic data types are primitive data types that are included in the programming language by default. Of the listed data types, Int32 is the .NET Framework datatype that is equivalent to the C# Int data type.

What is the process used by .NET Framework applications to compile the CIL code into the machine code specific to the executing processor? A) Microsoft Intermediate Language (MSIL) compilation B) Just-in-Time (JIT) compilation C) .NET Language specific compilation D) Intermediary compilation

B) Just-in-Time compilation is the process used by the .NET Framework to compile CIL code into processor specific machine code. Intermediary compilation is the process of converting the language specific source code into Common Intermediate Language (CIL) code. CIL was previously known as Microsoft Intermediate Language (MSIL), but was renamed CIL after it was accepted as an international standard.

Memory items that are created on the ______ are things like method parameters or local variables declared in a method. These memory items are declared in a method. These memory items are deallocated automatically when the method returns. A) Memory Block B) Stack C) .NET Framework D) Heap

B) Memory items that are created on the stack are automatically deallocated when the stack unwinds. For example, any memory allocated to a local variable inside of a method will be allocated when the method is called, and automatically deallocated when the method returns.

What do shared assemblies require that private assemblies do not require? A) Assembly Resources B) A Strong Name C) A Version Number D) Metadata

B) Shared assemblies require a Strong Name. Strong Naming is the process of creating a unique name for your assembly so that there is no chance of another assembly overwriting yours. The Strong Naming process requires that your assembly have a simple name, a version number, and a public/private key pair. This information is used to create a strong name for your assembly so that multiple versions of your assembly may be present in the GAC at the same time, and also to avoid name collisions with other assemblies in the GAC.

What is the process used to assign a unique name to an assembly to avoid name and version conflicts with other assemblies? A) Strong Typing B) Strong Naming C) Encryption D) Assembly Versioning

B) Strong Named assemblies use a unique name to prevent naming and version conflicts with other assemblies. To create a strong named assembly, you need a simple name, version number, and a public/private key pair for the assembly. This information will allow you to create an assembly with a strong name. A strong name is required for all shared assemblies.

The classes that read and write files use unmanaged operating system resources. When you are done using the instances of the classes you create, which method should be called to be sure the resources are correctly released? A) Deallocate B) Dispose C) Release D) Close

B) The Dispose method will release all resources used by the instance of the class. It is good practice to do this as soon as possible in your code so that resources are freed as soon as they are no longer needed.

Which keyword is used to signify a member that belongs only to instances of the containing class? A) Protected B) Private C) Dynamic D) Static

B) The private keyword is used to signify that the member belongs only to instances of the class. The static keyword is used to signify that a member belongs to the class and not to the individual instances of the class. The protected keyword is used to indicate that the member belongs to the containing class, as well as any class that is derived from the containing class.

Which keyword is used to signify a member that belongs to instances of the containing class, as well as any class that is derived from the containing class? A) Static B) Protected C) Dynamic D) Private

B) The protected keyword is used to indicate that the member belongs to the containing class, as well as any class that is derived from the containing class. The private keyword is used to signify that the member belongs only to instances of the class. The static keyword is used to signify that a member belongs to the class, and not to the individual instances of the class.

You are working on creating a mobile version of an already existing Windows Forms application. Much of the functionality of the two applications will be the same. What should you do to simplify maintaining two separate applications with nearly the same functionality? A) Save the source code for the common class files in a common locations so that any changes will be made to both applications. B) Use a Class Library that contains the classes that contain the functionality that will be shared between the two applications, and reference that class library in both applications. C) Create a web service with interfaces that run the common code, and have both applications connect to the web service. D) None of these will accomplish the goal of simplifying the code base.

B) The situation described is an example of when a Class Library will greatly simplify the code base. Using a Class Library in this situation allows you to make the changes to the class library once, update the class library in all of the applications that use it, and all the applications will get the new functionality.

You are writing a C# class file that will make frequent use of the classes contained in the System.IO Namespace. What can you do to avoid including the namespace reference before the classes everywhere that you use them? A) There is no short hand option. To address a class in the System.IO namespace, you must include the Namespace reference. B) At the beginning of the class file, include the line: using System.IO. C) In the class declaration, make the class extend System.IO. D) At the beginning of the class file, include the line: Imports System.IO

B) The using section of the class file is where you can put namespaces that you are using in the class file. To use the System.IO namespace, the line to use is using System.IO; The namespace references at the beginning of the class file are optional, however without them you will need to include the namespace references to every class that you use in the class file. You can only extend classes, not namespaces.

You are creating an application using .NET Framework 4.0. The application uses an interop assembly that will be accessed by multiple .NET Framework applications on each computer. You need to make a single version of the interop assembly available to all applications. What is the best way to accomplish this? A. Place the interop assembly in the system directory. B. Install the interop assembly in the global assembly cache (GAC). C. Install the interop assembly in the root of the C:\ drive. D. Place the interop assembly in a shared folder on the network.

B. Install the interop assembly in the global assembly cache (GAC).You should install the interop assembly in the global assembly cache (GAC). Assemblies shared by multiple applications need to be installed in a centralized storage area called the global assembly cache (GAC). The .NET clients can access the identical copy of the interop assembly, which is signed and installed in the GAC. Global assembly cache (GAC) is a machine-wide cache. It stores assemblies that are designed to be shared among multiple applications on a computer. All assemblies stored in the global assembly cache must have strong names. While you can reference assemblies placed in a particular directory, installing the assembly in the GAC provides greater reliability as well as easy maintenance.

_____ refers to the process of obtaining and verifying a users credentials, while _____ is the process of determining if the user is allowed to perform a given action. A) Authorization, Authentication B) Verification, Authentication C) Authentication, Authorization D) Authorization, Verification

C) Authentication (is the user authentic?) refers to the process of obtaining and verifying a users credentials, while Authorization (is the user authorized?) is the process of determining if the user is allowed to perform a given action.

In C#, what is the keyword used to let the compiler infer what data type to use based on the declaration? A) Object B) None, C# is strongly typed, and so must have a datatype declared. C) var D) Dim

C) C# is a strongly typed language. This means that everything that has a datatype needs to be defined as such at compile time or there will be a compile time error. The var keyword is used to let the compiler infer at compile time what datatype the variable is. For example: var num=18; // the compiler will use an int for this variable var anotherNum=47.0; // the compiler will use a double for this variable var email=""[email protected]""; // the compiler will use a string for this variable.

You have created an application that uses an app.config file. The contents of the app.config file are as follows: You have compiled the application, and now need to change the email address. You modify the app.config file in the install directory of the application, and save the changes. What is the next step to change the SupportEmail value in all of the places that it is used in the application? A) Uninstall and reinstall the application. B) Recompile the application. C) Changing the app.config file is all that is required. D) Modify the app.config file in the visual studio solution, and then recompile the application.

C) Changing the app.config file that is located in the install directory of the application is all that is required to make the application show the new values. This feature allows changes to be made to the application without requiring it to be recompiled or reinstalled.

Language Interoperability uses _____ to define the rules that programming languages must follow in order to interoperate with other compliant languages. A) Common Language Runtime (CLR) B) Microsoft Intermediate Language (MSIL) C) Common Language Specification (CLS) D) Common Intermediate Language (CIL)

C) Common Language Specification (CLS) defines the rules for features within a programming language. These are the rules that a language is required to follow in order to operate with other .NET programming languages.

Which of the following programming features allows you to define a class with a placeholder data type that can be different for each instance of the class? A) Variables B) Methods C) Generics D) Polymorphism

C) Generics is the programming technique that will allow your Products class to have a variable datatype for the ID member of the class. Generics allow you to have a place holder type, known as a type parameter. When a new instance of the class is instantiated, you must include a value for the type parameter to be used in place of the place holder. The type that is passed is called the concrete type.

When memory is allocated in the _____, the garbage collector will automatically reclaim it when the objects are no longer in use. A) Datatype B) Execution Stack C) Heap D) Call Stack

C) Memory allocated in the heap is automatically deallocated by the garbage collector when the object is no longer in use. Memory that is allocated in the stack is reclaimed as the stack executes and unwinds.

You have created a shared assembly and it has been published. Since the initial publish you have added new features to the assembly and want to release a new version. However, you do not want to force applications that use the original version of the assembly to use the new version. What type of execution model should you use to allow multiple versions of the assembly to be present in the GAC? A) Dynamic Versioning execution B) Publisher Policy execution C) Side by Side execution D) None. The GAC will only allow one version of the assembly to be present at a time.

C) Multiple versions of your assembly can be installed into the GAC at the same time by using a Side by Side execution model. This will install the new version of the assembly into the GAC along side the existing version. Applications that use the assembly can then be modified to use the new assembly, or to continue using the original version of the assembly with no problems.

Which of the following is the namespace that contains classes related to cryptography services such as encryption and decryption? A) System.Cryptography B) Security.Cryptography C) System.Security.Cryptography D) System.Security

C) The System.Security.Cryptography namespace contains the classes that provide cryptography services, including encryption and decryption, hashing, random number generation, and message authentication.

Consider the following XML example: <?xml version="1.0" encoding-"utf8"?> <Users> <User Id="204"> <Name>Steve Jones</Name> <Phone>1112223334</Phone> </User> <User id="205"> <Name>Jane Johnson</Name> <Phone>2223334445</Phone> </User> </Users> Which of the following statements is the most true? A) The Users XML Document contains 2 User attributes. The second User attribute has an Id tag of 205. B) The Users element contains two User tags. Each User tag includes an Id element, as well as an attribute for Name and Phone. C) The Users element contains 2 user elements. The first User element contains an Id attribute with a value of 204. D) The Users tag has 2 User attributes. The first User attributes has a Name tag with the value of Steve Jones.

C) The Users element is the root element of the document. The Users element contains 2 User elements. Each User element contains an Id Attribute inside of the opening tag, and additional elements for Name and Phone.

Which keyword is used to mark a class as unable to be used as a base class? A) noninheritable B) child C) sealed D) abstract

C) The sealed keyword is used to mark a class as unable to be used as a base class. The abstractkeyword is used to mark a class that can only be a base class. child and noninheritable are not keywords in this context.

_____ is used to ensure that program reads and writes the correct number of bytes from a memory location. A) The .NET Framework B) The Strongly Typed languages C) Type Safety D) C#

C) Type Safety is used to ensure that a program reads and writes the correct number of bytes from a memory location. Without type safety, your program may read the wrong data type from memory, such as reading a string from memory as an integer, which will cause unpredictable results.

You have created a project named DotNetFundamentals and have included an application configuration file to easily adjust certain settings in the application. In the directory where DotNetFundamentals.exe is located, what is the name of the configuration file? A) web.config B) app.config C) DotNetFundamentals.exe.config D) DotNetFundamentals.config

C) When the application compiles into an .exe, the name of the configuration file will be the name of the exe, with the .config file extension.

C# is a _____, meaning that the datatypes for all variables, constants, literals, return values, and parameters must be defined in the code, before compile time. A) Implicitly typed language B) Dependently typed language C) Weakly typed language D) Strongly typed language

D) C# is a strongly typed language. This means that everything that has a datatype needs to be defined as such at compile time, or there will be a compile time error.

The Command Prompt, cmd.exe. is an example of a(n) _____. A) Windows Forms Applications B) Assembly Application C) Binary Application D) Console Application

D) Console applications rely on a text based interface to interact with the user. The best example of a console application is the command prompt application, cmd.exe.

Which utility is used to assign a publisher policy assembly to the GAC? A) sn.exe B) assemblyUtil.exe C) globalUtil.exe D) GACUtil.exe

D) GACUtil.exe is used to add new assemblies, new versions of existing assemblies, and publisher policies into the GAC.

In XML, an opening tag, and all of their content is called a(n) _____. A) Attribute B) Document C) Tag D) Element

D) In XML, an opening and closing tag, and all of their content, is called an element. Consider the following example: <User Id="104"> <Organization>GMetrix SMS</Organization> </User> The example is one User element. The User element contains an Organization element. A tag is anything inside of matching angle brackets. An Attribute is a piece of data that further describes the element, and is contained in the opening tag of the element. In the example above, <User Id="104"> Id is the attribute, 104 is the value, and <user> is the tag.

Which of the following is not used to identify a strong name shared assembly? A) Version Number B) Simple Name C) Public Key D) Private Key

D) Strong Named assemblies use a unique name to prevent naming and version conflicts with other assemblies. To identify an assembly, you need the assembly's simple name, version number, and public key token. Optionally, you may also need the culture identity. This information will allow you to identify an assembly by its strong name. A strong name is required for all shared assemblies.

Consider the following XML example: <?xml version="1.0" encoding="utf8"?> <Users> <User Id="204"> <Name>Steve Jones</Name> <Phone>1112223334</Phone> </User> <User id="205"> <Name>Jane Johnson</Name> <Phone>2223334445</Phone> </User> </Users> Tags that begin with the <? characters are called _____. A) Definition tags B) Title tags C) Declaration tags D) Processing Instruction tags

D) Tags that begin with the <? characters are called Processing Instruction tags, and are used to define how the document will be processed. Consider the example from the question: <?xml version=""1.0"" encoding=""utf8""?> The <?xml processing instruction states that the document adheres to the specifications of XML version 1.0, and also that the document uses utf-8 character set.

Which of the following keywords is used to mark a class as a class that does not provide a complete implementation of the class, but can be used as a base class for other classes? A) Parent B) Private C) Sealed D) Abstract

D) The abstract keyword is used to mark a class that does not provide a complete implementation of the class, but can be used as a base class for other classes. Abstract classes cannot be directly instantiated, and so provide a way to optimally organize your class structure. The sealed keyword makes a class unable to be a base class. The private keyword and the parent keyword are unrelated.

You are developing a Windows Forms application that needs to connect to a database. Where should the connection string be stored so that it can be modified without recompiling the application? A) The connection string cannot be changed without recompiling the application. B) In a custom class in the application. C) In the web.config file for the application. D) In the app.config file for the application.

D) The app.config file for the application is the best place to store connection strings so that they can be changed without recompiling the application.

In the following code, what is the programming concept being used? public class Product<T> { public T id; } A) Methods B) Polymorphism C) Variables D) Generics

D) The class file in the example is using Generics. Generics allow you to have a place holder type, known as a type parameter. When a new instance of the class is instantiated, you must include a value for the type parameter to be used in place of the place holder. The type that is passed is called the concrete type. Here are a few examples of how to instantiate a class using the type parameter. Product<int> ProdInt = new Product<int>; // This code will create an instance of the Product class using int as the concrete type. Product<string> ProdString = new Product<string>; // This code will create an instance of the Product class using string as the concrete type.

.NET Framework languages go through a two step compilation process. Which of the following best describes the process? A) The source code is compiled by the .NET language specific compiler into the Common Intermediate Language (CIL). The CIL code is then compiled by the .NET Framework into processor specific code, which is then compiled by the Common Language Runtime (CLR) at run time. B) The source code is compiled by the .NET language specific compiler into processor specific machine code. C) The source code is compiled by the Common Language Runtime (CLR) into the Common Intermediate Language (CIL). CIL is then compiled by the .NET Framework intor processor specific machine code. D) The source code is compiled by the .NET language specific compiler into the Common Intermediate Language (CIL). The CIL code is then compiled through the Common Language Runtime (CLR) into processor specific machine code.

D) The compile process of .NET Framework languages is a two step process, instead of the traditional one step process. First, the source code is passed through the .NET language specific compiler. Each .NET language has their own language specific compiler. The .NET language specific compiler compiles the source code into Common Intermediate Language code. When the project is compiled into CIL, it is usually in the form of a DLL or an EXE. When the CIL code is executed, the Common Language Runtiime (CLR) begins by compiling the CIL code into machine code, and then running the cod. This compile method is called Just-In-Time compilation, because the CLR does not compile the CIL code to machine code until just before it is needed. CIL was previously known as Microsoft Intermediate Language (MSIL), but was renamed CIL after it was accepted as an international standard.

You have a class called Student that you want to extend the base class of User. The User class has an abstract method called VerifyLogin(). In addition to the class definition of class Student : User, which of the following code examples from the Student class are required in order to extend the User class? A) The Student class cannot extend the User class because the User class is abstract. B) None, all that is needed is the class Student : User class definition. C) public void VerifyLogin() { // Code Here } D) public override void VerifyLogin() { // Code Here }

D) The critical piece is the override keyword. The abstract method in the base class requires that a method in the derived class override the method.

You are creating a Console Application that needs to capture every keystroke that the user presses. Which method of the Console class should you use? A) ReadInput B) ReadKeyPress C) ReadLine D) ReadKey

D) The method in the Console class that is used to capture each of the users key strokes is the ReadKey method.

The classes that want to support comparison must implement the _____ interface and then provide a body for the _____ method.

IComparable, CompareTo

You are the developer of a utility that uses version 1.0.0.0 of a shared assembly called SharedProcesses that was developed by another developer. The developer of the assembly has released version 1.1.0.0 of the assembly that you would like your application to use. The new version has already been installed in the GAC. How can you use the new version of the assembly without recompiling your application? A) Modify the application's app.config file to include the following code in the <dependentAssembly> Element. <assemblyIdentity name="SharedProcesses" publicKeyToken="dk48ritk59t27d6" useVersion="1.1.0.0"/> B) You cannot change the assembly reference in an application without recompiling the application. C) Modify your applications app.config file to include the following XML in the <dependentAssembly> Element: <assemblyIdentity name="SharedProcesses" publicKeyToken="dk48ritk59ti27d6"/> <bindingRedirect old Version="1.0.0.0" newVersion="1.1.0.0"/> D) No additional steps are needed after the new version of the assembly is installed in the GAC.

Multiple versions of your assembly can be installed into the GAC at the same time by using a Side by Side execution model, as described in the question. To modify the version of the assembly that an application uses without recompiling the application, you can modify the app.config to include bindingRedirect tag inside of the <dependentAssembly> element for the assembly. The following is a code example: <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v!"> <dependentAssembly> <assemblyIdentity name="SharedProcesses" publicKeyToken="dk48ritk59ti27d6: /> <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>

You are working for a company that maintains a web application, a Windows Forms application, and a mobile application that all interact with the same database. To simplify the database interactions, all of the class files that interact with the database have been compiled into a DLL that each project then references in order to interact with the database. This DLL is an example of which of the following? A) The .NET Framework B) A Web Service C) A Class Library D) A Namespace

The DLL in the example is a Class Library. Using a Class Library to contain all things related to the database allows the developers in this situation to use the DLL in every project, so that any changes do not have to be done in each product. This is particularly useful in a situation where you have multiple applications that all have a common element such as a database.

A _____ is a collection of functionality defined in terms of classes, interfaces and other types that can be reused to create applications, components, and controls.

base class

A class that does not provide complete implementation must be declared with the _____ keyword.

abstract

You can use the _____ operator to check if it is legal to cast one type to another type.

is

If a class by the same name exists in two different namespaces, use a _____ to resolve the ambiguous references.

namespace hierarchy

You can use the _____ keyword to declare a member, which belongs to the class itself rather than to a specific object.

static

The _____ keyword refers to the current instance of the class.

this


Related study sets

There There - Character Study Set

View Set

Misssed Concepts from All Full lengths part 1

View Set

Nursing Care of the Child With an Integumentary Disorder (and alteration in tissue integrity)

View Set

Audit Chapter 13 - Overall Audit Strategy and Audit Program

View Set

Sem 3 - Unit 2 - Glucose Regulation - NCO

View Set

financial markets and institutions

View Set