Đề tài Ngân hàng câu hỏi Softech YearII (Question Bank Softech YearII)

1. The Obsolete attribute, which is used to specify a method as obsolete, is provided with the .NET framework. [0.5] a) True b) False 2. The Conditional attribute enables access to the Win32 API. [0.5] a) True b) False 3. When a program is compiled in debug mode, a file with an extension _______ is created. [0.5] a) .DBP b) .PDB 4. In .NET, a dynamic link library is created by default when a project of type console application is built. [0.5] a) True b) False 5. ______ are used in C# to add MetaData to classes and assemblies. [0.5] a) Attributes b) Properties 6. C# provides the _______ attribute for interoperability with Windows DLLs. [0.5] a) Conditional b) DllImport 7. When a program is compiled into a release version, it has fewer overheads and also executes faster compared to a debug version. [0.5] a) True b) False

doc131 trang | Chia sẻ: ngtr9097 | Lượt xem: 2383 | Lượt tải: 2download
Bạn đang xem trước 20 trang tài liệu Đề tài Ngân hàng câu hỏi Softech YearII (Question Bank Softech YearII), để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Question Bank Adv .Net and Security in .Net Project 1. The Obsolete attribute, which is used to specify a method as obsolete, is provided with the .NET framework. [0.5] a) True b) False 2. The Conditional attribute enables access to the Win32 API. [0.5] a) True b) False 3. When a program is compiled in debug mode, a file with an extension _______ is created. [0.5] a) .DBP b) .PDB 4. In .NET, a dynamic link library is created by default when a project of type console application is built. [0.5] a) True b) False 5. ______ are used in C# to add MetaData to classes and assemblies. [0.5] a) Attributes b) Properties 6. C# provides the _______ attribute for interoperability with Windows DLLs. [0.5] a) Conditional b) DllImport 7. When a program is compiled into a release version, it has fewer overheads and also executes faster compared to a debug version. [0.5] a) True b) False 8. Windows DLLs have deployment problems like registering the DLL in the Windows registry and versioning issues. [0.5] a) True b) False 9. The code residing inside the Windows Dll is known as _________ code as it has direct access to the memory. [0.5] a) Managed b) Unmanaged 10. Symbol definition should occur ____________ the program. [0.5] a) anywhere in b) only at the beginning of 11. The Win32 API consists of a set of dlls that contain the necessary methods for invoking the system calls. [0.5] a) True b) False 12. The _________ attribute is used to conditionally prevent or allow execution of a block of code. [0.5] a) DllImport b) Conditional 13. An attribute in C# is a declarative tag, which can be used to provide information to the runtime about the behaviour of the C# elements such as classes only. [1.0] a) True b) False 14. Statement 1: An obsolete method executes as any normal method. Statement 2: Specifying a method as obsolete makes the C# compiler generate an error when the program is compiled. [1.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 15. Which of the following are the steps involved in creating an attribute? [1.0] a) Enclose the attribute in square brackets. c) Multiple attributes for a single method can be specified by specifying them one after another just before the method name or class element they apply to. b) Pass any number of parameters required to the attribute within parenthesis. d) All of the above. 16. Which of the following is true? [1.0] a) The DllImport attribute is used to interoperate with code in unmanaged and legacy components. c) The methods contained within Windows DLLs can be called within C# programs using the DllImport attribute. b) The unmanaged code is the code that has been generated outside the .NET environment. d) All of the above. 17. Which namespace has to be imported in applications for working with legacy code? [1.0] a) System.Runtime.Services c) System.Services b) System.InteropServices d) System.Runtime.InteropServices 18. Which of the following is true when the first parameter passed to AttributeUsage attribute is AttributeTargets.All enumerator? [1.0] a) The attribute can be applied to any class element. c) The attribute can be applied only to Enums. b) The attribute can be applied only to constructors. d) The attribute can be applied only to Modules. 19. Which of the following is true when the first parameter passed to AttributeUsage attribute is AttributeTargets.Constructor enumerator? [1.0] a) The attribute can be applied to any class element. c) The attribute can be applied only to Enums. b) The attribute can be applied only to constructors. d) The attribute can be applied only to Modules. 20. Which of the following is true when the first parameter passed to AttributeUsage attribute is AttributeTargets.Module enumerator? [1.0] a) The attribute can be applied to any class element. c) The attribute can be applied only to Enums. b) The attribute can be applied only to constructors. d) The attribute can be applied only to Modules. 21. Statement 1: The AllowMultiple property for the AttributeUsage attribute indicates whether the attribute may be applied to the same item more than once. Statement 2: The Inherited property for the AttributeUsage attribute indicates whether the attribute applied to a certain class or interface applies to all inherited classes or interfaces. [1.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 22. Which of the following is/are true regarding the AttributeUsage attribute? [1.0] a) If the Inherited property is set to true, the attribute applied to a certain class or interface will be applied to all inherited classes or interfaces. c) If the AllowMultiple property is set to false, the compiler will generate an error if the attribute is applied to the same item more than once. b) If the Inherited property is set to false, the attribute applied to a certain class or interface will be applied to all inherited classes or interfaces. d) If the AllowMultiple property is set to true, the compiler will generate an error if the attribute is applied to the same item more than once. 23. Statement 1: To read MetaData from a .NET component, the assembly is first loaded into the running process. Statement 2: Assembly.Load(assemblyName) is a static member method of the Assembly namespace. [1.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 24. Which of the following is/are true? [1.0] a) The .NET components expose their MetaData through a process known as Reflection. c) The classes necessary for Reflection can be found in the Namespace System.Reflection. b) Reflection covers the various .NET base classes allowing finding out information about the types in programs or assemblies. d) All of the above. 25. Which of the following is/are true in relation with the features of Assemblies? [1.5] a) As assemblies are Self-Describing, they do not require registry keys. d) The installation of one application does have adverse effects on the other applications. b) Due to Versioning, each assembly file reflects or rather exposes the version number to all .NET applications. e) All of the above. c) Installation of applications are as simple as copying the files from one directory to another. 26. Consider the snippet given below: static void Main(string[] args) { Assembly asm = Assembly.Load("AttrEx"); Type ty =asm.GetType(); Attribute[] atb=Attribute.GetCustomAttributes(ty); Object ob = atb[0]; Console.WriteLine("The attribute value is :" + ob.ToString()); Which of the following is/are true? [1.5] a) The code above will give a compile time error. c) The code above will give a run time error. b) The code above will display the parameter value passed to attribute existing in the class AttrEx on console. d) None of the above. 27. Consider the snippet below: public class CoderAttribute : Attribute { private string cname; public CoderAttribute(string cName) { this.cname =cName; } } Which of the following is/are true regarding the snippet? [1.5] a) It is mandatory for CoderAttribute class to inherit the Attribute class. c) It is not necessary for the CoderAttribute class to have a constructor defined within it. b) Attribute class belongs to the System namespace. d) If the Coder attribute has a single parameter of string type, then the CoderAttribute class can have a constructor with any number of string parameter. 28. Consider the snippet given below. [CoderAttribute(“Martin”)] public void CalculateBonus { //Method Implementation } Which of the following is/are true? [1.5] a) The compiler appends the string ‘Attribute’ to the name CoderAttribute forming the name CoderAttributeAttribute. c) CoderAttribute is the only custom attribute defined for the method CalculateBonus. b) The compiler does not append the string ‘Attribute’ to the name but leaves the name as CoderAttribute. d) All of the above. 29. Which of the following snippet is correct for the class WriterAttribute with the attribute “Writer” that can be applied only to the properties? [1.5] a) [AttributeUsage(AttributeTargets.Method, AllowMultiple=false,Inherited=false)] public class WriterAttribute { …. b) [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, AllowMultiple=false,Inherited=false)] public class WriterAttribute : Attribute{ …. c) [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property,AllowMultiple=false, Inherited=false)] public class WriterAttribute { .... d) [AttributeUsage(AttributeTargets. Property, AllowMultiple=false,Inherited=false)] public class WriterAttribute : Attribute{ …. 30. Which of the following is the correct syntax, if there are two attributes associated with a method? [1.5] a) … [AttributeName1,AttributeName2](Parameters) MethodName(Parameters) [ //Method Implementation ] [AttributeName1(Parameters)] b) … [AttributeName1(Parameters), AttributeName2(Parameters)] MethodName(Parameters) [ //Method Implementation ] c) … [AttributeName1(Parameters)] [AttributeName2(Parameters)] MethodName(Parameters) [ //Method Implementation ] d) … MethodName(AttributeName1(Parameters) AttributeName2(Parameters)) [ //Method Implementation ] 31. Which of the following is/are true? [1.5] a) A .NET component is a piece of executable code referred to as Assemblies. d) The CLR can only execute code in assemblies. b) An assembly is a collection of all information required by the runtime to execute an application. e) All of the above. c) An assembly can be only a DLL file. 32. Consider the snippet below: [DllImport("Calculation.dll")] public static extern int Addition(int a, int b); static void Main(string[] args) { int ans = Addition(5,2); Console.WriteLine("Result : {0}",ans); Console.ReadLine(); } Which of the following is/are true? [1.5] a) Windows DLL named Calculation.dll must exist either in the application directory or System32 folder inside the Windows installation directory. d) The Addition method, imported from the Calculation.dll, takes in two integer parameters and returns the result as an integer. b) The DLL to import is passed as the parameter to the DllImport attribute. e) The extern keyword in the declaration of imported method is necessary for using any external methods residing in Dlls. c) All of the above. 33. Which of the following is/are true? [1.5] a) An assembly that has been compiled into a PE file has an extension of .exe. d) The assembly handles versioning and security permissions. b) The *.exe file in .NET Framework is the same as a standalone executable created by a C++ compiler. e) All of the above. c) The PE assembly consists of code in the form of IL that requires the .NET platform to be installed on the system in order to execute. 34. Consider the snippet below: [Conditional("DEBUG")] public static void Msg(string message){ Console.WriteLine(message); } static void Main(string[] args){ Console.WriteLine("Before calling Msg()"); Msg("Working with Attributes"); Console.ReadLine(); } Which of the following is/are true? [1.5] a) The Conditional attribute marking the Msg() method ensures that the Msg() method will be used only in debug versions of the solution. d) The compiler will not generate an error if the method Msg() does not return a void. b) The calls to the Msg() method from anywhere in the code in the release version will not be entertained. e) All of the above. c) The Msg() method is not called in the Release version, but compile time errors are thrown. 35. Which of the following is/are true regarding the conditional attribute? [2.0] a) It can only be applied to a complete method as a unit. c) If the condition is met, the compiler ignores any lines of code anywhere else in the source file that calls up the method. b) If the condition is not met, the compiler will not compile the code for the method. d) It cannot be applied to a complete method as only a unit. 36. Statement 1: Attributes are translated into statements in the compiled code. Statement 2: Attributes serve as directives to the compiler. [2.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 37. Statement 1: Attributes can also be applied to individual arguments of a method. Statement 2: Attribute name can be declared anywhere with respect to the definition of the item in the code. [2.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 38. Which of the following statements is/are true regarding the attribute DllImport? Statement 1: It is used to mark a method as being defined in an external Dll rather than in any assembly. Statement 2: It is used to mark a method as being defined in any assembly. [2.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 39. Which of the following is/are true regarding the Conditional attribute? [2.0] a) Any method that returns a void can be marked with it. d) It is used to mark a method as being defined in an external Dll. b) It is used to give conditional compilation. e) All of the above. c) It can be used for debug builds. 40. Which of the following is/are true regarding Reflection? Statement 1: It allows finding out information about the types in programs or assemblies. Statement 2: It can be used to read meta data from assembly manifests. [2.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 41. Which of the following is/are true? Statement 1: The Assembly class allows access to the metadata for a given assembly. Statement 2: The Assembly class provides methods to allow execute an assembly, which is an executable file. [2.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 42. Which of the methods is/are used to load the corresponding assembly into the running process? [2.0] a) Assembly.AssemblyLoad() c) Assembly.Load() b) Assembly.OnLoad() d) Assembly.LoadFrom() 43. Consider the snippet given below: #define DEBUG … … [Conditional(“DEBUG”)] [Obsolete()] public static void DisplayMessage(){ Console.WriteLine(“Hello”); } Which of the following is/are true regarding the method DisplayMessage()? [2.5] a) The above method runs if a debug build takes place. c) It gives error during compilation. b) It is an obsolete method. d) On using the method the compiler generates a warning. 44. Consider the snippet given below: … class ExClass { [Conditional(“Using42.dll”)] public static extern int MessageBox(int hparent, string Message, string caption, int type); } Which of the following is/are true? [2.5] a) The code above generates an error. c) The code above must have DllImport attribute to make use of the windows API function MessageBox. b) The code above compiles successfully. d) The MessageBox() API function is defined in Using42.dll. 45. Which of the following is/are true regarding the windows API function MessageBox()? [2.5] a) While using the DllImport attribute, the declaration of the method MessageBox must contain the keyword extern. d) The fourth parameter of the method if set to 0, ensures that the message box has a button OK. b) The second parameter of the method indicates a string or message to be displayed. e) All of the above c) The third parameter of the method indicates a caption to be displayed in title bar. 46. Which of the following is/are true? [2.5] a) The Assembly.GetTypes() returns an array of type System.Type containing objects that contain the details of all the types defined in the assembly. d) The Assembly.GetAttributes() is used to get the custom attributes attached to an assembly . b) The Assembly.GetTypes() is used to return an array of System.Type references that contains details of only one type. e) All of the above. c) The Assembly.GetCustomAttributes() is used to get the custom attributes attached to an assembly . 47. Which of the following is/are true? [2.5] a) AttributeUsage is primarily used to indicate the items that the custom attribute can be applied to. c) An attribute applied to an assembly can be placed anywhere in the code but need not be marked with the keyword assembly. b) An attribute can be applied to an assembly as a whole instead of to an element in the code. d) An attribute applied to an assembly can be placed anywhere in the code but must be marked with the keyword assembly. 48. Which of the following is/are true? [2.5] a) Assemblies include metadata such as the types exported from the assembly and a manifest. c) .NET allows different versions of the same assembly to be used in a single process. b) The version of a referenced assembly is stored in the manifest of the assembly. d) All of the above. 49. Statement 1: Application Domains allow applications to run independently inside a single process. Statement 2: Application Domains do not allow applications to run independently inside a single process. [2.5] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is false d) Statement 2 is false 50. Statement 1: Private assemblies require registration and versioning. Statement 2: Private assemblies can have versioning problems, which need to be addressed during development time. Statement 3: Windows 2000 introduced the side-by-side feature that allows different versions of the same DLL to be used on a system. [2.5] a) Only statements 1 and 2 are true. c) Only statements 2 and 3 are true. b) Only statements 1 and 3 are true. d) None of the above statements is true. 51. An assembly can exist completely within a single file or can span across multiple files. [0.5] a) True b) False 52. The .NET metadata is a collection of information existing in ___________ form inside a Portable Executable file. [0.5] a) Hexadecimal b) Binary 53. In Global Assembly Cache, two assemblies with the same name but different versions can exist. [0.5] a) True b) False 54. The .NET compilers compile the source code into an Intermediate Language called _______. [0.5] a) SMIL b) MSIL 55. The files that contain only IL code are known as ___________. [0.5] a) .NET Modules b) .NET Packages 56. Splitting the code across various modules enables the .NET cross language support. [0.5] a) True b) False 57. A Resource file is a collection of resources like images and sounds. [0.5] a) True b) False 58. The _________ utility comes along with the .NET framework SDK. This utility is used to create resource files. [0.5] a) Resgenerate.exe b) Resgen.exe 59. The Image class belongs to the __________ namespace. [0.5] a) System.Drawing b) System 60. A cache is used for storing information __________ [0.5] a) Permanently b) Temporarily 61. Global Assembly Cache is a ________. [0.5] a) File b) Directory 62. Private assemblies are the default type of assemblies. [0.5] a) True b) False 63. Which of the following is/are the part(s) of an assembly? [1.0] a) Assembly Metadata d) Resources b) Type Metadata e) All of the above c) MSIL Code 64. Statement 1: Version numbers for an assembly are set in the Asembly.cs file that accompanies the project. Statement 2: The ILDASM tool can be used to view the assembly version number being written into the assembly manifest. [1.0] a) Statement 1 is true c) Statement 2 is true b) Statement 1 is fa

Các file đính kèm theo tài liệu này:

  • docAdv .et & Security in .Net complete.doc
  • docasp.netcomplete 234 qs.doc
  • doccom+ and msmq complete 295 qs.doc
  • docDynamic pages using JSP complete 125 qs.doc
  • docejb complete 406 qs.doc
  • docIntro to .Net and Prg in C# complete-235 qs.doc
  • docj2eecomplete 167 qs.doc
  • docvb.netcomplete 113 qs.doc
  • docWeb Services (WSDL, SOAP & UDDI)-complete-86 qs.doc
  • docxmlcomplete-235 qs.doc