Đề thi lý thuyết 3 môn c

169
Đề thi lý thuyết 3 môn C# ( 2) (2010-07-01) 61 Which statement is true to create a thread A Thread t = new Thread(); B Thread t = new Thread(new ThreadStart(CallbackMethodName)); ----------------Cau nay dung C Thread t = new Thread(new ThreadStart()); D Thread t = new Thread(CallBackMethodName); 62 Multithreading can be implemented in .NET by (choose 2) A ThreadStart ----------------Cau nay dung B Create new class that implement IThreadable interface C ThreadPool class ----------------Cau nay dung 63 ______ is the main class for creating threads and controlling them A Thread - B ThreadPool C ThreadStart D Monitor ---------------Cau nay dung E WaitHandle 64 ______ contains operationg system-specific objects that wait for access to shared resources A Thread B ThreadPool C ThreadStart D Monitor E WaitHandle ----------------Cau nay dung 65 ______ comprises a set of threads that can be used for posting work items, processing asynchronous I/O, waiting on

Upload: nguyentuan82

Post on 07-Apr-2015

429 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Đề thi lý thuyết 3 môn C

Đề thi lý thuyết 3 môn C# ( 2) (2010-07-01)

61 Which statement is true to create a thread

A Thread t = new Thread(); B Thread t = new Thread(new ThreadStart(CallbackMethodName)); ----------------Cau nay dung C Thread t = new Thread(new ThreadStart()); D Thread t = new Thread(CallBackMethodName);

62 Multithreading can be implemented in .NET by (choose 2)

A ThreadStart ----------------Cau nay dung B Create new class that implement IThreadable interface C ThreadPool class ----------------Cau nay dung

63 ______ is the main class for creating threads and controlling them

A Thread - B ThreadPool C ThreadStart D Monitor ---------------Cau nay dung E WaitHandle

64 ______ contains operationg system-specific objects that wait for access to shared resources

A Thread B ThreadPool C ThreadStart D Monitor E WaitHandle ----------------Cau nay dung

65 ______ comprises a set of threads that can be used for posting work items, processing asynchronous I/O, waiting on

behalf of other threads, and processing timers

A WaitHandle B ThreadPool ----------------Cau nay dung C Timer D Monitor

66 The methods represented by ThreadStart can return any type

A TRUE

Page 2: Đề thi lý thuyết 3 môn C

B FALSE ----------------Cau nay dung

67 The methods represented by ThreadStart can have zero, one or more parameters

A TRUE B FALSE ----------------Cau nay dung

68 An instance of a class which defines the method containing task action needs to be created before starting a thread object

A TRUE ----------------Cau nay dung B FALSE

69 The start method in the Thread class starts immediately the thread execution

A TRUE B FALSE ----------------Cau nay dung

70 Only the Thread class can be used to create a thread object

A TRUE ----------------Cau nay dung B FALSE

71 _______ method blocks the calling thread till the current thread ends

A Sleep() B Join() ----------------Cau nay dung C IsAlive() D Block()

72 Which property returns a value that contains the state of the current thread.

A ThreadState ----------------Cau nay dung B State C CurrentState

73 Which statements are TRUE about thread?

A Thread.Priority() method is used to set and get priorities of threads B Priority level values come from the ThreadPriority enumeration of namespace System.Threading ----------------Cau nay dung C ThreadHighest is the priority value for highest priority D A thread must be in the Running state before the operation system can schedule it ----------------Cau nay dung

74 A portion of code which is accessed by multiple threads at the same time is called

Page 3: Đề thi lý thuyết 3 môn C

______

A Reentrant B Critical section ----------------Cau nay dung C Immutable object

75 ________ is a mechanism to implement thread management

A Critical section B Locking C Immutable object D Thread pooling ----------------Cau nay dung

76 ______ is a concept which allows only one thread to excusively access particular sections of code at a time

A Locking B Thread pooling ----------------Cau nay dung C Reentrant

77 Reentrant is __________

A a method which is thread-safe ----------------Cau nay dung B a mechanism to implement thread management C an portion of code which is accessed by multiple threads at the same time

78 Which 3 of the following statement with reference to .NET and COM are TRUE?

A .NET is a component technology like COM ----------------Cau nay dung B .NET achieves COM interoperability by creating a proxy class for every COM component that the .NET client tries to access. ----------------Cau nay dung C When a .NET component is called from COM, the runtime generates a Runtime Callable Wrapper object. D In reality, .NET does not talk to COM at all, it interacts with the RCW. ----------------Cau nay dung

79 The __________ utility can be used to convert a COM Type Library into a .NET assembly.

A TlBExp B TlbImp C TlBLib ----------------Cau nay dung D TlBDet

80 The TlbExp Utility creates the proxy for the COM Dlls.

Page 4: Đề thi lý thuyết 3 môn C

A TRUE B FALSE ----------------Cau nay dung

81 If the .NET component needs to be accessed from more than one application, the .NET component then needs to be a shared assembly and has to be installed on the GAC.

A TRUE ----------------Cau nay dung B FALSE

82 When an object of the COM component is created in a .NET managed environment; how is the object destroyed?

A The object is destroyed by the CLR B The object is destroyed when the count reaches zero C This issue is addressed by the RCW ----------------Cau nay dung

83 When a .NET component is called from COM, the runtime generates a wrapper object known as the __________________.

A Runtime Callable Wrapper B COM Callable Wrapper ----------------Cau nay dung

84 Regardless of how many COM clients try to access the component, the runtime creates only one CCW for a managed .NET component.

A TRUE ----------------Cau nay dung B FALSE

85 .NET client and COM clients can simultaneously make calls to the same .NET component.

A TRUE ----------------Cau nay dung B FALSE

86 In order to call a .NET component from a COM client, you need to first register the assembly using the _________ utility.

A RegAsm ----------------Cau nay dung B TlbExp

87 The Runtime Callable Wrapper does not contain any form of business logic.

A TRUE ----------------Cau nay dung B FALSE

Page 5: Đề thi lý thuyết 3 môn C

88 How many CCWs are created by the runtime to manage more then one COM client ?

A The number of CCWs is equal to the number of COM clients. B One CCW can handle any number of COM clients ----------------Cau nay dung C Five CCWs are created to handle more then one COM clients.

89 Which 2 of the following statements with reference to .Net components are TRUE ?

A The CLR manages the lifetime of the objects in .Net. ----------------Cau nay dung B .NET clients use interfaces to learn about the functionality of the object. C .Net files can be either .dll or .pe files ----------------Cau nay dung D .Net objects must reside in the same memory location throughout the lifetime of the object

90 The .exe file in .Net can be executed from any platform.

A TRUE ----------------Cau nay dung B FALSE

91 What is a Runtime callable wrapper ?

A Run time error in .Net B It is the proxy through which .Net interacts with the COM ----------------Cau nay dung C An object used in .Net D A component used in .Net

92 Which term is used for the data conversion from Com to .Net ?

A Marshalling B Type-casting C Data-conversion D Marshaled ----------------Cau nay dung

93 What must one do to register or unregister the .Net components in the Windows registry ?

A Write the code for registering/unregistering .Net components in the assembly. B Run RegAsm.exe on the command line ----------------Cau nay dung C Components get registered / unregistered automatically. D Register / Unregister the .Net components in the windows file.

94 ___________ is the Proxy used by .Net to interact with COM.

Page 6: Đề thi lý thuyết 3 môn C

A Runtime Callable Wrapper ----------------Cau nay dung B Executable Callable Wrapper C Route Callable Wrapper

95 The ___________ command gives you the output of COM type library.

A TlBExp ----------------Cau nay dung B TlBImp C TlBLib D TlBDet

96 One of the overloaded constructors of the XmlTextWriter takes in two parameters; the first being the filename for the XML text file that is to be created and the second is the _________.

A EnvironmentPermission B Encoding style ----------------Cau nay dung C Version No. D File path

97 The WriteStartDocument() method of the XmlTextwriter class writes the XML declaration with the version _________.

A "1.0" ----------------Cau nay dung B "0.0" C "0.1" D "1.1" E "2.0"

98 The XMLReader class is an abstract class.

A TRUE ----------------Cau nay dung B FALSE

99 We write the contents of the dataset to an XML file using the ___________ method of the dataset object.

A WriteStartDocument() B Write() C WriteXml() ----------------Cau nay dung D WriteStartElement()

100 Identify the correct statement/s.

Statement A: The WriteStartDocument() method of the XmlTextWriter class writes the specified start tag.

Page 7: Đề thi lý thuyết 3 môn C

Statement B: The WriteStartElement() method of the XmlTextWriter class writes the specified specified XML declaration.

A Statement 1 is true B Statement 2 is true C Both the Statements are true D Both the Statements are false ----------------Cau nay dung

101 When there are no more nodes to be read in the file, the XMLReader class returns ________.

A 0 B 1 ----------------Cau nay dung C FALSE D EOF

102 Identify the correct statement/s.

Statement A: The XMLNodeList is an ordered list of nodes but the data represented by them is not live.

Statement B: The XMLNode and the XMLNodeList class collectively make up the core of the DOM implementation in .NET.

A Statement 1 is true B Statement 2 is true ----------------Cau nay dung C Both the Statements are true D Both the Statements are false

103 The XmlValidatingReader is an implementation of the __________ class.

A XmlReader ----------------Cau nay dung B XmlTextReader C ReadString D ValidatingXML

104 The Document Object Model is implemented in .NET using the _________ class.

A XMLNode ----------------Cau nay dung B XMLNodeList C XMLReader D XMLDocument

Page 8: Đề thi lý thuyết 3 môn C

105 Which 2 of the following statements with reference to XSLT are TRUE?

A XSLT is used to provide the graphics utility to the XML document B XSLT is used to map more then one XML document ----------------Cau nay dung C XSLT can be used with various languages ----------------Cau nay dung

106 The __________ method of the XMLTextWriter class writes the specified start tag.

A WriteStartElement() ----------------Cau nay dung B WriteStartDocument() C WriteStartTag() D WriteStartAttribute()

107 XMLValidatingReader class provides the validation against:

A XDR schemas B XML schemas C DTDs schemas D All of the above ----------------Cau nay dung E None of the above

108 Which one of the following classes allows you to transform documents using stylesheets in XML?

A System.XML.Style B System.XML.Xsl ----------------Cau nay dung C System.XML.Schema D System.XML.Xpath

109 ReadXML() and WriteXML() methods belong to the _________class.

A SqlConnection B SqlDataAdapter C Dataset ----------------Cau nay dung D XmlTextWriter

110 All valid XML documents are well formed but not all well formed XML document are valid.

A TRUE ----------------Cau nay dung B FALSE

111 Which of the following classes in System.XML namespace gives the tree representation of the XML document, so that we can navigate through the entire

Page 9: Đề thi lý thuyết 3 môn C

document and edit if required ?

A XmlReader B XmlWriter----------------Cau nay dung C XmlDocument D XMLValidatingReader

112 The first parameter of XMLTextWriter specifies the filename which we have to create, whereas the second parameter specifies ___________.

A Path of the file B Format of the file C Encoding Style ----------------Cau nay dung

113 The class _____________ in System.XML is used to store, retrieve and manipulate the relational Dataset.

A XMLDataDocument ----------------Cau nay dung B XMLTableDocument C XMLRelationalDocument

114 Identify the 2 abstract classes from the list given below.

A XmlReader ----------------Cau nay dung B XmlWriter ----------------Cau nay dung C XmlDocument D XmlTextWriter

115 Which class will point you towards the innerdata of the XML document ?

A XMLInner B XmlWriter C XMLReader D XMLNode ----------------Cau nay dung

116 Which of the following statements are true about the Reflection API? ( Choose 2)

A It can be used to effectively find all the types in an assembly and/or dynamically invoke methods in an assembly. ----------------Cau nay dung B IT cannot be used to manipulate other objects on the .NET platform. C It can at times even be used to emit Intermediate Language code on the fly so that the generated code can be executed directly. ----------------Cau nay dung D The Reflection API uses the System.Reflection namespace, with the Reflection class to identify the type of the Class being reflected,

Page 10: Đề thi lý thuyết 3 môn C

117 Which of the following statements best illustrates the use of the Reflection API. ( Choose 3)

A Obtains Class and Type Information from an Assembly ----------------Cau nay dung

B Translates a stream of input characters into a stream of input elements C Obtains Member Information from a Class ----------------Cau nay dung D Dynamically Invokes Methods from Classes in an Assembly ----------------Cau nay dung

118 Which of the following properties does the Type class have? (Choose 3)

A IsCLass B IsMethod C IsPublic ----------------Cau nay dung D IsCOMObject ----------------Cau nay dung

119 Which of the following statements are true? ( Choose 2)

A A .NET executable program cannot directly reference a .NET DLL module. B Windows 2000 operating System is capable of loading two assemblies with the same name but different version numbers. ----------------Cau nay dung C Reflection APIs does not allow creating of assembly in memory dynamically. D The Reflection API allows creating types on the fly and invoking methods on them. ----------------Cau nay dung

120 How can we create the object dynamically in C#?

A C# does not allow instantiation of objects at run time.

B By using the System.Reflection. CreateInstance() method to create an instance of object in the following manner. Type myObjectType = Type.GetTypeFromProgID ("MyDll.MyObjectName") object myObject = System.Reflectrion. CreatInstance(myObjectType)

C By using the System.Activator .CreateInstance() method to create an instance of object in the following manner. Type myObjectType =Type.GetTypeFromProgID ("MyDll.MyOName") object myObject = System.Activator.CreatInstance (myObjectType)

Page 11: Đề thi lý thuyết 3 môn C

----------------Cau nay dung D In C#, Object cannot be instantiated at run time but a method of a class can be invoked.

121 using System.Reflection; using System; class Reflect { public int i=20; public char ch=a; public float f1=10; public void GetFloat(){ Console.WriteLine(f1); } public void GetInt(){ Console.WriteLine(i); } public void GetChar(){ Console.WriteLine(ch); } } class TCPReflection { public static void Main() { Reflect sender = new Reflect(); Type t = sender.GetType(); MemberInfo [] members = t.GetMembers(); MethodInfo [] method = t.GetMethods(); FieldInfo [] f1=t.GetFields(); Console.WriteLine("No of memebers:"+members.Length); Console.WriteLine("No of fields:"+f1.Length); } }

What will be the output of above code when compiled/run?

A The code will generate a compile time error B The output of above code will be: No of members : 11 No of fields: 4

C The output of above code will be:

Page 12: Đề thi lý thuyết 3 môn C

No of members : 11 No of fields: 3 ----------------Cau nay dung D The output of above code will be: No of members : 12 No of fields: 3

122 Through which process does the assembly expose its Metadata ?

A Reaction B Action C Reflection D Interaction

Comment(0 ý kiến)

Đề thi lý thuyết 3 môn C# ( 1) (2010-07-01)

What is the purpose of the Dlllmport attribute in C#?

A It is used to provide information to the runtime about the behaviour of C# elements such as classes and assemblies. B It is used to conditionally prevent or allow execution of a block of code. C It is used for interoperability with legacy and unmanaged code. ----------------Cau nay dung D It is used to perform checks on whether a symbol has been defined or not.

2 The assemblies expose their MetaData through a process known as _____________.

A Self Describing B Versioning ----------------Cau nay dung C Reflection

3 The ________attribute enumerator is applied for any class elements.

A AttributeTargets.All B AttributeTargets.Class C AttributeTargets.AllClasses D None of those

4 Which of the following statement/s with reference to Dllimport attribute is/are

Page 13: Đề thi lý thuyết 3 môn C

TRUE?

A It can import a file written in any programming language B It can import a file written in Visual basic only.

5 Custom attributes can be applied to more than one programming element

A TRUE B FALSE

6 In C#, _______ is a mechanism of adding metadata to a programming element.

A Reflection B Assembly C Attribute D Annotation

7 We can define a custom attribute but its information cannot be retrieved

A TRUE B FALSE 8 Descriptive information in the metadata can be extracted using runtime reflection services

A TRUE B FALSE

9 Attributes are stored with the metadata of the element they are associated with

A TRUE B FALSE

10 Code developed outside the .NET Framework is called ________

A managed code B unmanage code C protected code

11 _______ attribute is used to invoke unmanage code in a C# program

A Conditional B Obsolete C STAThread D DllImport

12 Namespace ______ is mandatory for using DllImport attribute

Page 14: Đề thi lý thuyết 3 môn C

A System.Diagnostics B System.Runtime C System.Runtime.InteropServices D System.Runtime.Diagnostics

13 Which attribute is used to notify about a deprecated element

A Conditional B Obsolete C DllImport D STAThread

14 Conditional attribute is used as debugging aid or precompilation directive

A TRUE B FALSE

15 Custom attributes also placed in the namespace System

A TRUE B FALSE

16 Which statement is FALSE about custom attribute?

A A custom attribute class should inherit from System.Attribute class B A custom attribute class cannot be declared as private C A metadata cannot be extracted by another application

17 Sn.exe is used to create strong names for assemblies.

A TRUE B FALSE

18 A .NET component is also referred to as assembly.

A TRUE ----------------Cau nay dung B FALSE

19 Adding pictures to resources of an assembly can be easily accomplished using the ___________ class of the .NET Base Class Library.

A ResourceElements B ResourceData C AddResource D ResourceWriter

Page 15: Đề thi lý thuyết 3 môn C

20 ________ is a unit of class deployment.

A An Assembly B A Manifest C An Executable file

21 The extension of an assembly is _________

A .exe B .dll C .cs D .ddl

22 A key pair is created using the _______utility.

A key.exe B sn.exe C snk.exe D key.snk

23 Private assemblies have no versioning policy.

A TRUE B FALSE

24 The _____ package forms the basic unit of versioning.

A An Assembly ----------------Cau nay dung B A Manifest C An Executable file

25 The syntax to create an assembly file is:

A csc/out:/target B csc /out:/library ----------------Cau nay dung C csc /out:/target:library D csc /out: /target: library

26 For versioning the private assemblies, the CLR simply loads the newest assemblies found in the application directory.

A TRUE ----------------Cau nay dung B FALSE

27 Identify the correct syntax for creating an executable file referencing an assembly.

Page 16: Đề thi lý thuyết 3 môn C

A csc /out:< executable name >/r:/library:exe B csc /out:< executable name >/target:exe /r: C csc /out:/target /r: D csc /out:< executable name > /target:exe /r: ----------------Cau nay dung

28 Version number of an assembly are stored in the following format:

A < Minor version >... B .< Minor version >.. C .< Minor version >.. D < Minor version >...

29 The information about a class can be found out using ________

A Assemblies B Manifest C Reflection D Delegates

30 The manifest contains data that ___ (Choose 2)

A contains set of types that form a logical unit . B describes the resources to form a logical unit of functionality. C describes how the elements in assembly are related to each other. D describes the other assemblies on which the elements of the assembly are dependent.

31 Which of the following commands can be used to create assembly named "myAssembly" from the files "file1.cs and file2.cs"?

A csc /out:myAssembly /target:library file1.cs file2.cs B csc /out:myAssembly.dll /target:library file1.cs file2.cs C csc /out:myAssembly.dll /target:library file1.cs /target:library file2.cs D csc /out:myAssembly.dll /target:library file1.cs /out:myAssembly.dll /target:library file2.cs

32 The global assemblies are saved in the _________

A in the :\WINNT\Assembly folder. B Parent folder of the calling application. C sub folder within the folder containing the calling application. D same folder as the calling application.

33 If there is a change in the major number or minor number of the version number it indicates that __s_____

Page 17: Đề thi lý thuyết 3 môn C

A the assembly is incompatible with previous versions of that assembly. B a very minor change has been made to the assembly. C assembly maybe compatible with previous versions of that assembly.

34 The programmer has an assembly named pri.dll which other programmer also wants used the same assembly. Which of the following are the correct statements when executed will satisfy the above needs.

A sn key1.snk csc /out:pri.dll /target:library file2.cs /a .keyfile:key.snk gautil -I pri.dll

B sn -k key1.snk csc /out:pri.dll /target:library file2.cs /a .keyfile:key.snk gautil pri.dll

C sn -k key1.snk csc /out:pri.dll /target:library file2.cs /a .keyfile:key.snk gautil -I pri.dll

35 Which of the following statements are true?(Choose 2)

A Assemblies can be shared by installing it in the global Assembly Cache. B Private assemblies should not be installed in subfolders below the executables folder. C Private assemblies are stored in the same folder as that of an application. D Private assemblies have predefined versioning policy.

36 The .net Framework SDK 2 provides the user with a tool called ___________ to peek into the assemblies and explore the classes available within them.

A SN B ILDASM ----------------Cau nay dung C Explr D Lock

37 Which one of the following statement/s with reference to Shared Assemblies is NOT TRUE?

A Shared assemblies are the default type of assemblies B For a shared assembly to be used by many applications there should be no naming clash C The shared assembly must have an identifier which makes it unique across the

Page 18: Đề thi lý thuyết 3 môn C

entire system. D You must generate a new strong name for each and every shared assembly that you wish to create.

38 When we use a __________ assembly, the assembly file is not copied onto the applications directory but remains in the GAC folder.

A Private B Shared ----------------Cau nay dung

39 What does a change in the build number of the version number indicate?

A It indicates that the assembly maybe compatible with previous versions of that assembly B It indicates that a very minor change has been made to the assembly ----------------Cau nay dung C It indicates that the assembly is incompatible with previous versions of that assembly

40 Identify the correct statements.

Statement A: An assembly consists of a set of types and resources that form a logical unit of functionality. Statement B: An assembly consists of a manifest that contains information, which describes the assembly.

A Statement 1 is true B Statement 2 is true C Both the Statements are true ----------------Cau nay dung D Both the Statements are false

41 Identify the correct statements.

Statement A: Unlike private assemblies, shared assemblies which can be used by various applications need to be stored in Global Assembly Cache.

Statement B: Unlike the GAC, the Native Image Cache does not store assemblies in IL format, but rather in their native machine dependent native code.

A Statement 1 is true B Statement 2 is true C Both the Statements are true ----------------Cau nay dung D Both the Statements are false

42 The ________ Command Line Option is used to list assemblies from the GAC.

Page 19: Đề thi lý thuyết 3 môn C

A /l ----------------Cau nay dung B /i C /u D /a

43 What is the command GacUtil /i NetClient.dll used for ?

A To store the assembly in the file. B To generate an assembly containing metadata. C To compile the assembly D To enable the assembly to be shared among several applications ----------------Cau nay dung

44 The _______ command in C# is used to view the content of Assemblies and the manifest.

A csc.exe B Resgen.exe C ILDASM.exe ----------------Cau nay dung D view.exe

45 _________ describe the methods, types, IL and resource.

A Metadata B Type-Metadata C IL-Metadata D Resource-Metadata----------------Cau nay dung

46 Which of the following is/are not a part of the Assembly?

A Assembly Metadata B MSIL Code C Type Metadata D Resources E GAC utility ----------------Cau nay dung

47 Which part of the assembly displays the picture file or sound file ?

A Assembly Metadata B MSIL Code C Type Metadata D Resources ----------------Cau nay dung

48 Which file comes with .Net framework SDK to create a Resource file ?

Page 20: Đề thi lý thuyết 3 môn C

A Resource.exe B Resgen.exe ----------------Cau nay dung C Region.exe D Resin.exe

49 ResourceWriter class is present in the _________ namespace.

A System.Resources ----------------Cau nay dung B System.Writer C Sytem.Drawing D System

50 What is the purpose of the Exists method of System.IO.Directory class?

A It checks whether the directory exists and deletes it. B It checks whether the given path refers to an existing directory ----------------Cau nay dung C It gets the current directory D No such method exists.

51 Identify the syntax of the GetDirectories method of System.IO.Directory class.

A string[] GetDirectories(stringPath); ----------------Cau nay dung B string GetDirectories(); C void GetDirectories(string Path); D arr1[] GetDirectories();

52 The default mode in the FileStream class is ___________ read/write operations

A synchronous ----------------Cau nay dung B asynchronous C sequential D random

53 The StreamReader class is the superclass of the class TextReader?

A TRUE ----------------Cau nay dung B FALSE

54 Stream class support a two-way stream (input and output)

A TRUE ----------------Cau nay dung B FALSE

55 Which class is used to write primitive types to a stream

Page 21: Đề thi lý thuyết 3 môn C

A Stream B BinaryWriter ----------------Cau nay dung C TextWriter D StreamWriter

56 A stream to encrypt or zip data can be created

A TRUE ----------------Cau nay dung B FALSE

57 Multithread can help to improve application responsiveness

A TRUE ----------------Cau nay dung B FALSE

58 Which class in the System.Threading namespace is used to sunchronize access to objects?

A Thread B ThreadPool C Monitor ----------------Cau nay dung D Timer

59 The Timer class in the System.Thread namespace provides a mechanism for executing a method at _______

A specified intervals ----------------Cau nay dung B specified time

60 ThreadStart is a _________

A interface B class C abstract class D delegate ----------------Cau nay dung E event

Comment(0 ý kiến)

Đề thi lý thuyết 2 môn C# (2010-07-01)

10: We write the contents of the dataset to an XML file using the___method of the dataset object (Chúng tôi viết nội dung của dataset một file XML sử

Page 22: Đề thi lý thuyết 3 môn C

dụng phương pháp ___ của đối tượng dataset ) [A]WriteStartElementO [B]Wr iteStartDocu mentO [C]WriteXmlO [D]WriteQ

12 : How can we create the object dynamically in C#? (Làm thế nào chúng ta có thể tạo đối tượng động trong C #?) [A] By using the System .Activator .CreatelnstanceO method to create an instance of object in the following manner. Type myObjectType =Type.GetTypeFromProgID ("MyDll.MyOName") object my Object = System.Activator.CreaHnstance (myObjectType) [B] In C#, Object cannot be instantiated at run time but a method of a class can be invoked. [C] C# does not allow instantiation of objects at run time. [D] By using the System.Reflection. CreatelnstanceO method to create instanrR nf nhiprf in thfi frillnwinn m^nnRr,

13: How many CCWs are created by the runtime to manage more then one COM client ? (13: Làm thế nào CCWs được tạo ra bởi rất nhiều thời gian để quản lý nhiều hơn thì một trong những khách hàng COM?) [A]One CCW can handle any number of COM clients [B]The number of CCWs is equal to the number of COM clients. [C]Five CCWs are created to handle more then one COM clients.

15: Resource Writer class is present in the_____namespace. (15: Tài nguyên Writer lớp là hiện diện trong không gian tên _____.) [A]Sy tern. Drawing [B]System [C]System.Resources [D]System.Writer 17: The _____ attribute enumerator is applied for any class elements, (17: Các thuộc tính _____ Enumerator được áp dụng cho bất kỳ yếu tố lớp học,) [A]AttributeTargets. All Classes [B]None of those [C]AttributeTargets.All [D]AttributeTargets.Class 19: The first parameter of XMLTextWriter specifies the filename which we have to create, whereas the second parameter specifies___________

Page 23: Đề thi lý thuyết 3 môn C

(Thaham số đầu tiên của XMLTextWriter xác định tên tập tin mà chúng tôi đã tạo ra, trong khi các tham số thứ hai xác định ___________) [A]Encoding Style [B]Format of the file [C]Path of the file

2: ReadXML() and WriteXML() methods belong to the_____class. (ReadXML () và WriteXML () phương pháp thuộc về lớp _____) [A]Dataset [B]XmlTextWriter [C]SqlConnection [D]SqlDataAdapter

20 : Identity the syntax of the GetDirectories method of System JO.Directory class, (Identity cú pháp của phương pháp GetDirectories của lớp Hệ thống JO.Directory,) [A]arrl[] GetDirectoriesO; [B]string [] GetDirectories(stringPath); [C]void GetDirectories (string Path); [D]string GetDirectoriesO;

22: The .net Framework SDK 2 provides the user with a tool called____to peek into the assemblies and explore the classes available within them. (The net Framework. SDK 2 cung cấp cho người sử dụng với một peek called____to công cụ vào hội đồng và khám phá những lớp học có sẵn trong chúng.) [A] Lock [B] SN [C] Explr [D] ILDASM

24: Code developed outside the .NET Framework is called_____ (24: Mã số phát triển bên ngoài NET Framework. Được gọi là _____) [A]protected code [B]unmanage code [C]managed code

26: The TlbExp Utility creates the proxy for the COM Dlls, [A] False [B] TRUE 27: In order to call a .NET component from a COM client you need to first register the assembly using the ____ utility. (Để gọi cho một thành phần. NET COM từ một khách hàng đầu tiên bạn cần phải đăng ký lắp ráp bằng cách sử dụng tiện ích ____.) [A] TlbExp [B] RegAsm

28: When an object of the COM component is created in a .NET managed environment; how is the object destroyed? (Khi một đối tượng của các thành phần COM được tạo ra trong một môi trường được quản lý NET.; Như thế nào là đối tượng tiêu huỷ?) [A]The object is destroyed when the count reaches zero [B]The object is destroyed by the CLR

Page 24: Đề thi lý thuyết 3 môn C

[C]This issue is addressed by the RCW

3: The Document Object Model is implemented in .NET using the_______class. (DOM được thực hiện trong lớp học bằng cách sử dụng NET) [A]XMLReader [B]XMLNode [C]XMLNodeList [D]XMLDocument

30: The________utility can be used to convert a COM Type Library into a .NET assembly* (Các tiện ích ________ có thể được sử dụng để chuyển đổi một COM Loại Thư viện thành một hội đồng NET. *) [A] TlBLib [B] TlBDet [C] TlBExp [D] TlbImp

31: Which one of the following classes allows you to transform documents using stylesheets in XML? (Mà một trong những lớp học sau đây cho phép bạn biến đổi các tài liệu sử dụng trong XML stylesheets?) [A]System.XML.Xpath [B]System.XML.Style [C]System. XML.Schema [D] System.XML.Xsl

32: Which of the following statements are true about the Reflection API? (Choose 2) (Mà các báo cáo sau đây là đúng sự thật về API Reflection? (Chọn 2)) [A]It can at times even be used to emit Intermediate Language code on the fly so that the generated code can be executed directly. [B]It can be used to effectively find all the types in an assembly and/or dynamically invoke methods in an assembly, [C]IT cannot be used to manipulate other objects on the .NET platform. [D]The Reflection API uses the System.Reflection namespace, with the Reflection class to identify the type of the Class being reflected,

34: Version number of an assembly are stored in the following format: (Phiên bản số lắp ráp một được lưu trữ trong các định dạng sau:) [A]< Minor version >... [B]< Minor version >... [C].< Minor version >.. [D].< Minor version >..

Page 25: Đề thi lý thuyết 3 môn C

35: Which file comes with .Met framework SDK to create a Resource file ? (Những tập tin đi kèm với SDK khuôn khổ. Met để tạo một tập tin tài nguyên?) [A]Resin.exe [B]Resource.exe [C]Region.exe [D]Resgen.exe

36: The class_________ in System .XML is used to store, retrieve and manipulate the relational Dataset (Lớp _________ trong hệ thống. XML được sử dụng để lưu trữ, truy xuất và thao tác các tập dữ liệu quan hệ) [A]XMLTableDocument [B]XMLDataDocument [C]XMLRe lationa IDocu ment

38: Which of the following statements are true?(Choose 2) [A]Private assemblies have predefined vers ion ing policy. [B]Assemblies can be shared by installing it in the global Assembly Cache. [C]Private assemblies are stored in the same folder as that of an application. [D]Private assemblies should not be installed in subfolders below the executables folder.

39: Adding pictures to resources of an assembly can be easily accomplished using the __________ class of the .NET Base Class Library* (Hình ảnh Thêm vào một nguồn lực của hội đồng có thể dễ dàng thực hiện bằng cách sử dụng các lớp __________ của NET Base. Lớp thư viện *) [A]Resource Writer [B]AddResource [C]ResourceData [D]ResourceElements

41: Private assemblies have no versioning policy, (hội đồng tư nhân không có chính sách versioning,) [A] FALSE [B] TRUE

42: Custom attributes also placed in the namespace System (Tuỳ thuộc tính cũng được đặt trong hệ thống không gian tên) [A] FALSE [B] TRUE

44: Descriptive information in the metadata can be extracted using runtime reflection services (Mô tả thông tin trong siêu dữ liệu có thể được tách ra bằng cách sử dụng các dịch vụ phản ánh thời gian chạy)

Page 26: Đề thi lý thuyết 3 môn C

[A] FALSE [B] TRUE

45: Attributes are stored with the metadata of the element they are associated with (Thuộc tính được lưu với các siêu dữ liệu của phần tử chúng được liên kết với) [A] FALSE [B] TRUE

47: (Một. NET cũng là thành phần được gọi là lắp ráp *) A .NET component is also referred to as assembly* [A] FALSE [B] TRUE

48: When there are no more nodes to be read in the file, the XMLReader class returns___ (Khi không có các nút nhiều hơn để được đọc trong tập tin, các lớp XMLReader trả về _) [A]FALSE [B]EOF [C]0 [D] 1

49: What is the command GacUtil /i NetClientdll used for ? (Các GacUtil lệnh / i NetClientdll được sử dụng cho là gì?) [A]To compile the assembly [B]To enable the assembly to be shared among several applications [C]To store the assembly in the file. [D]To generate an assembly containing metadata.

5: Identity the correct statement/s. Statement A: Unlike private assemblies, shared assemblies which can be used by various applications need to be stored in Global Assembly Cache. Statement B: Unlike the GAC, the Native Image Cache does not store assemblies in IL format but rather in their native machine dependent native code. [A]Both the Statements are false [B]Both the Statements are true [C]Statement 2 is true [D]Statement 1 is true

50: The StreamReader class is the superclass of the class TextReader? (Các lớp StreamReader là lớp cha của lớp TextReader?) [A] FALSE [B] TRUE

51: Which of the following properties does the Type class have? (Choose 3) Trong đó các đặc tính sau đây không có lớp Loại? (Chọn 3)

Page 27: Đề thi lý thuyết 3 môn C

[A]IsPublic [B]IsCLass [C]IsMethod [D]IsCOMObject

53: Which term is used for the data conversion from Com to .Net ? (thuật ngữ nào được sử dụng để chuyển dữ liệu từ Com vào Net?.) [A]Data-conversion [B]Marshalling [C]Type-casting [D]Marshaled

54: The__________command gives you the output of COM type library, (Lệnh _________ cung cấp cho bạn các đầu ra của thư viện kiểu COM,) [a]TlbLib [b]TlBExp [c]TlBImp [d]TlBDet

56: The Timer class in the System Thread namespace provides a mechanism for executing a method at________ (Lớp Timer trong không gian tên hệ thống Thread cung cấp một cơ chế để thực hiện một phương pháp ở ________) [A]specified time [B]specified intervals

57: Regardless of how many COM clients try to access the component the runtime creates only one CCW for a managed .NET component (Bất kể có bao nhiêu khách hàng COM thử truy cập vào các thành phần trong thời gian chạy tạo chỉ có một bên trái cho một thành phần quản lý NET.) [A] FALSE [B] TRUE

58: The .exe file in .Net can be executed from any platform. (Các exe trong.. Có thể được thực hiện từ nền tảng nào.) [A] FALSE [B] TRUE

59: A key pair is created using the ____ utility (Một cặp khoá được tạo ra bằng cách sử dụng tiện ích ____) [A]snk.exe [B]key.snk [C]key.exe [D]sn.exe

6: _______method blocks the calling thread till the current thread ends (_______ phương pháp khối sợi chỉ gọi điện thoại đến chủ đề hiện tại kết thúc) [A] Block() [B]IsAlive() [C] Join() [D] Sleep()

60: Which of the following statement/s with reference to Dllimport attribute is/are TRUE? (ào của các tuyên bố sau / s với tham chiếu đến thuộc tính DllImport là / là TRUE?) [A]It can import a file written in Visual basic only.

Page 28: Đề thi lý thuyết 3 môn C

[B]It can import a file written in any programming language

61: In C#,_________-is a mechanism of adding metadata to a programming element (Trong C #,_________- là một cơ chế thêm vào một yếu tố siêu dữ liệu để lập trình) [A]Annotation [B]Attribute [C]Assembly [D]Reflection

62_________describe the methods, types, IL and resource, (_________ Mô tả các phương pháp, các loại, IL và tài nguyên,) [A]Resource-Metadata [B]Metadata [C]IL-Metadata [D]Type-Metadata

63: .NET client and COM clients can simultaneously make calls to the same .NET component. (NET client. COM và khách hàng có thể đồng thời thực hiện cuộc gọi đến cùng. Thành phần NET.) [A] FALSE [B] TRUE

65: Reentrant is___ [A]an portion of code which is accessed by multiple threads at the same time [B]a mechanism to implement thread management [C]a method which is thread-safe

66: What is the purpose of the Exists method of System.10.Directory class? (mục đích của phương pháp Tồn tại của System.10.Directory lớp học là gì?) [A]No such method exists. [B]It gets the current directory [C]It checks whether the given path refers to an existing directory [D]It checks whether the directory exists and deletes it.

8: If the .NET component needs to be accessed from more than one application, the .NET component then needs to be a shared assembly and has to be installed on the GAC. (Nếu thành phần NET. Cần phải được truy cập từ nhiều hơn một ứng dụng, các. NET thành phần sau đó cần phải được một hội đồng chia sẻ và đã được cài đặt trên GAC.) [A] FALSE [B] TRUE

Page 29: Đề thi lý thuyết 3 môn C

Comment(0 ý kiến)

Đề thi lý thuyết 1 môn C# (2010-07-01)

1.Which of the following statement about C# varialble is incorrect ? A. variable is a computer memory location identified by a unique name 2. The.……types feature facilitates the definition of classes ,structures and interfaces over multiple files? B. partial 3. The....…class is a variable-length array that can dynamically increase or decrease in size? A. ArrayList D. SortedList 4. The.………interface defines methods to control the different generic collections? A. ICollection 5. The default capacity of an ArrayList class is.....? C.24 6. in C# ...………are created using delegates B. events 7. Which of the following code declare the delegate Calculation with the return type and the parameter types as integer ? A. public delegate int Calculation(int numOne,int numTwo); 8. The.......constructor initialises an object of the ArrayList class with the specified initial capacity as the parameter . D. ArrayList(int) 9. Which of the following statements about the different data types in C# are correct? B. Reference type variables store memory address of other variables in a stack . D. int and class are examples of value and reference type variables respectively. 10. Which piece of code display a float value as string ? B. float flotNum = 500.25F; string stNum = flotNum.ToString(); Console.WriteLine(stNum); C. float flotNum = 500.25F; String stNum = flotNum.ToString(); Console.WriteLine(stNum); 11. An ...…….method is created when you instantiate or reference a delegate with a block of ... code. C. anonymous, unnamed D.unnamed,anonymous

Page 30: Đề thi lý thuyết 3 môn C

12. The........…...exception is thrown when the stack runs out of space while the.….......exception is thrown when the result of an arithmetic,casting or conversion operation is larger in size than the destination object or variable. C. NullReferenceException, StackOverFlowException D. StackOverflowException, OverflowException

13. What is the output of the following code ? int num =5; while(num>0) { if(num>4) { Console.WriteLine(num+""); } --num; if(num--= =4) { Console.WriteLine("(0)",num); } if(num==3) { Console.WriteLine("{0}",num); } num--; } B. 503 14. Which of the following statements about delegates are correct ? A. Delegates are objects that contains references to methods that need to be invoked . D. Delegates can be associated with methods provided they have the same return type and parameter type. 15. Managing memory and verifying code safety are functionalities of..……………...... A. Common Language Runtime 16. Restriction or constraints can be applied to type parameters by using the......keyword . C.where 17. Which of the following statements about the different operator are correct ? A. The Addition operator performs concatenation of strings if the operands are strings B. The Boolean inclusive OR operator returns true if at least one the expression is true

D. The Relational operators return a boolean value depending on the comparison being made 18. Which of the following statements about the partial class are correct ? A. Partial classes are the only types in C# that support partial definitions B. Partial classes can be defined over multiple locations to store different members D. Partial classes allow multiple developers to work on separate sections

Page 31: Đề thi lý thuyết 3 môn C

simultaneously 19. Which of the following statements about System.Collections.Generic namespace classes are correct ? A. The List class provides a generic collection of items that can be dynamically resized C. The Queue provides a generic collection that follows the First-In-First-Out principle D. The Dictionary provide a generic collection of sorted key and value pairs

20. The ......………...class is a combination of the.………......and...…………….....class es. D. SortedList,Hashtable,ArrayList

21. Which of the following statements about the defferent types of C# statements are correct ? B. Iteration statements help you to repeatedly execute a block of code within program . D. Exception handling statements manage situation that hinder the normal execution of the program. 22. The........method of the ArrayList class copies the elements of a list to an array while the........method also copies elements of a list to an array of type Object. B. CopyTo,ToArray 23. Which of the following statements about constraints on type parameters are correct ? C. The T: specifies that the type parameter must be a parent class or its successor. D. The T: specifies that the type parameter must be an interface or should inherit an interface. 24. Which of the following statements about generic methods are correct ? A. Generic methods process values whose data types are known only when they are accessed C. Generic methods can be declared within generic or non generic class declaration. 25. Can you re-arrange the steps given below to implement delegates in C# ? Declare a delegate Call method using the delegate object Create method to be referenced by delegate Instantiate the delegate B. A C D B 26. The SortedList class behaves like an ......if you access its elements based on their index number otherwise it behaves like a.......... A. array,hash table 27. Which of the following statements about generics are correct ? B. Generic allow you to reuse the code in a safe manner without casting or boxing. D. Generics always accept a type parameter,which is a placeholder for the required date type. 28. Which of the following keywords are associated with iteration statements? B. foreach

Page 32: Đề thi lý thuyết 3 môn C

29. Which of the following statements about C# are correct ? A. C# applications can easily use or integrate code written in other .NET languages. C. C# can be used to develop both,simple standalone and distributed application. D. C# applications are easy to deploy because of its support for XML and SOAP. 30. ......…….are a kind of parameterized data structure that can work with value types as well as reference types. D. Enumerator 31. A....………...is a set of items of same or different data types. C. collection 32. The.........property of the System.Exception class returns the Exception instance that caused the current exception. A. Message 33. Exception thrown due to arithmetic operations or null object reference are...........exceptions. C. system-level 35. Exceptions thrown due to failure in database connection or network connection are examples of.........exceptions A. application-level 36. The...….....fields are accessible by other classes but.…….....fields are accessible only by the class in which they are declared. A. public,private 37. The....……...interface supports simple iteration over elements a generics ? C. IEnumerator 38. The.........exception is thrown when a value is assigned null object . C. NullReferenceException 39. Which of the following statements about delegates in C# are correct? B. delegate can invoke one method at a time. C. delegate can encapsulate static methods. D. delegate is declared using the delegate keyword 40. ........allow you to reuse a code for different data types. D. Generics 41. Which of the following statements about exceptions are correct ? A. The System.Exception class is the base class that allows you to handle all exception. D. The System.Exception class contains properties that are common to all exceptions. 42. An......method is an inline nameless block of code that can be passed as a delegate parameter ? A. anonymous B. named C. partial D. unnamed 43. Which of the following statements about Visual Studio 2005 IDE key elements are correct? (chon 1 dap an!) A. The code Editor facilitates writing, display and aditing of form, event, and method code. B. The Dynamic help window provides a list of topics depending on the active IDE

Page 33: Đề thi lý thuyết 3 môn C

area or task. D. The Solution Explorer provides an organized view of projects and access to their commands. 44: Which of the following statements about expressions and statements are correct? A. Statements may or may not return values, but expressions always return values. D. Compilers execute statements and since expressions are part of statements, they are executed with them. 45: The Visual Studio 2005 … edition is a proper choice for students enthusiasts and hobbyists? (chon 1 dap an!) C. Standard 46: The … class is a combination of the Hashtable class and the ArrayList class? A. SortedList

Tất cả các câu trả lời sai đã bị loại bỏ

Comment(0 ý kiến)

Đề thi lý thuyết +đáp án môn PCS _1 (2010-07-17)

1. What’s the top .NET class that everything is derived from ? Select Answer: 1. System.Net.All 2. System.IO 3. System.Collections 4. System.Object

Answer: 4 2. How can you sort the elements of the array in descending order? Select Answer : 1. Desc() 2. ASCReverse() 3. By calling Sort() and then Reverse() methods 4. By calling ascen() and then Reverse() methods

Answer: 3 3. What is boxing in .net ? Select Answer : 1. Encapsulating an object in a value type. 2. Encapsulating a copy of an object in a value type 3. Encapsulating a value type in an object 4. Encapsulating a copy of a value type in an object

Answer: 4

Page 34: Đề thi lý thuyết 3 môn C

4. Which of these string definitions will prevent escaping on backslashes in C#? Select Answer : 1. string s = #”n Test string”; 2. string s = “n Test string” 3. string s = @”n Test string” 4. string s = “n Test string”;

Answer: 3 5. The C# keyword ‘int’ maps to which .NET type ? Select Answer : 1. System.Int16 2. System.Int32 3. System.Int64 4. System.Int128

Answer: 2 6. Which program control statements aways executes the internal statements at least once? Select Answer : 1. do{Statements}j=j+1; 2. if(j!=1){Statements} j = j+1; 3. while(j!=1){Statements} j=j+1;

Answer: 1 7. Which interface allows a collection to be navigated using the foreach statement? Select Answer : 1. IEnumerable 2. IUnknown 3. IEnumerator 4. Idisposable

Answer: 1 8. Which of these statements correctly declares a two-dimensional array in C# ? Select Answer : 1. int[,] myArray; 2. int[][] myArray; 3. int[2] myArray; 4. System.Array[2] myArray;

Answer: 1 9. What is the printout of the following ? byte b1 =1; byte b2 = 255;

Page 35: Đề thi lý thuyết 3 môn C

byte total = b1+b2; Console.WriteLine(total); Select Answer : 1. We will get a runtime error 2. We will get a compilation err 3. 256 4. 1

Answer: 2 10. Multiple data type store in a System.Array? Select Answer : 1. Yes 2. No 3. I don’t know 4. All the above

Answer: 2 11. Which is the main CLR System assembly which contains the classes for built – in CLR types? Select Answer : 1. base 2. mscorlib 3. 1&2 4. none

Answer: 2 12. How many classes can a single .NET DLL contain? Select answer : 1. 1 2. many 3. 4 4. 5

Answer: 2

13. In Object Oriented Programming , how would you describe encapsulation? Select answer : 1. The exposition of data 2. The runtime resolution of method calls 3. The separation of interface and implementation 4. The conversion of one type of object to another.

Answer: 3

14. What will be the output of the code :

Page 36: Đề thi lý thuyết 3 môn C

int i = new byte(); string str; i =2005; str = “This is Year”; str = str+i; Console.WriteLine(str); Select answer : 1. Compile time error – Cannot implicitly convert type ‘byte’ to ‘int’ 2. Compile time error – Cannot convert from int to string 3. Run time error – Invalid Cast 4. This is Year 2005

Answer: 4

15. What is the output of the following ? Byte a = 5 ; Byte b = 255; Byte total a+b ; Console.WriteLine(total); Select answer : 1. 260 2. 1 3. Run –time error 4. Compilation Error

Answer: 4

16. What if you compare Null against Null Ex : if NULL = NULL [True Part] Else [False Part] Select answer : 1. True 2. False 3. Fatal Error

Answer: 1

17. What is the output of the following snippet in c#? Using System : Class main { static long afield = 123 ;

Page 37: Đề thi lý thuyết 3 môn C

static main() { Console.WriteLine(afield); } main() { afield = 1000; Console.WriteLine(afield); } static void Main(String[] args) { main obj = new main(); } } Select answer : 1. 1000 123 2. 123 3. no output 4. 123 1000

Answer: 4

18. What is the output of following C# code ? Using System ; Class AClass { ushort aField; public AClass(ushort aField) { Console.Write (this.aField = aField); } } Class MainClass { static void Main() { AnObj = new AClass(44); } AClass AnObj = new AClass(33); } Select Answer : 1. 33 2. Syntax Error [Cannot access ‘AnObj’ in ‘static void Main()’] 3. 44 4. 3344 5. 4433

Page 38: Đề thi lý thuyết 3 môn C

Answer: 2

19. What is the output of following C# code ? Class AClass { sbyte aField ; public AClass (sbyte aField) { this.aField = aField; System.Console.Write(aField); } } class MainClass { AClass Third = new AClass(8); static void Main() {

} static AClass Second = new AClass(7); } select answer : 1. 7 2. 8 3. 78 4. 87 5. No output

Answer: 1

20. Which of the following are/is value type datatypes of C#? Select answer : 1. String 2. Object 3. Struct 4. 1&2 5. All

Answer: 3

Comment(0 ý kiến)

Page 39: Đề thi lý thuyết 3 môn C

Đề thi lý thuyết 10 môn C# (2010-07-02)

101. interface intA: one, two,three{ }

Which of the following statements are true for the above code? [0.5]

a) one ,two ,three must be classes. c) one, two, three can be classes or interfaces.

b) Above code will generate an error as multiple values after the : is not allowed in C#. d) one, two, three must be interfaces.

102. If Parent is a base class and child is its derived class then which of the following statements are not valid? [1.0]

a) Parent p1=new child(); c) Parent p1=new Parent();

b) Child c1=new Child(); d) Child c1=new Parent();

103. Any class that contain one or more abstract methods must be declared as ____ [1.0]

a) Interface c) Static

b) Abstract d) Private

104. Which of the following are correct statements for implementing an abstract class. [1.0]

a) public abstract void class ClassA c) abstract public ClassA

b) public abstract class ClassA

105. Which of the following methods can be called as an “operation” ? [1.0]

a) public void methodA(){} c) void methodA();

b) public void methodA{} d) public void methodA();

Page 40: Đề thi lý thuyết 3 môn C

106. Abstract methods holds only: [1.0]

a) return type c) name of method

b) return statements d) Parameters

107. A __ can be thought as a mould of a class. [1.0]

a) abstract class c) Interface

b) Delegates d) static class

108. Which of the following is a valid statement to implement class B in the class A. [1.0]

a) class A implements B c) class A:B

b) class A implements class B d) class B:A

109. Properties provide the opportunity to protect a field in a class by reading and writing to it using accessors. [1.0]

a) True b) False

110. 1. using System; 2. public class Parent{ 3. public virtual void Count(){ 4. Console.WriteLine("100"); 5. } 6. }; 7. public class Child:Parent 8. { 9. public override void Count(){ 10. Console.WriteLine("1000"); 11. } 12. public static void Main(){ 13. Parent p=new Child(); 14. p.Count(); 15. } }

What will be the output of the above program?

Page 41: Đề thi lý thuyết 3 môn C

[1.5]

a) 100 c) compilation error

b) 1000 d) runtime error.

111. What will be the output of the following code when compiled/run?

1. using System; 2. class Book{ 3. void show(){ 4. Console.WriteLine("In Book"); 5. } 6. } 7. class storyBook:Book{ 8. void show(){ 9. Console.WriteLine("In Story book"); 10. } 11. static void Main(){ 12. Book b1=new storyBook(); 13. b1.show();14. }} [1.5]

a) The code will output: following Texts.. In Book In Story Book c) The code will output: following Texts.. In Story Book

b) The code will output: following Texts.. n Book d) The code generates an error at line 13 during compilation.

112. Statement I: An override method overrides an inherited virtual method with the same signature. Statement II : An override method declaration specializes an existing inherited virtual method by providing a new implementation of the method. [1.5]

a) Statement I is true c) Both the statements are true

b) Statement II is true d) Both the statements are false

113. What will be the output of the code below? 1. class Room{ 2. public bool isUsed(){

Page 42: Đề thi lý thuyết 3 môn C

3. return (getNumber()<0); 4. } 5. public virtual int getNumber(){ 6. return 0; 7. } 8. } 9. class StaffRoom: Room{ 10. StaffRoom(){ } 11. public override int getNumber(){ 12. return 10; 13. } 14. public static void Main() { 15. Room R2=new StaffRoom(); 16. System.Console.WriteLine(R2.isUsed());17. }} [1.5]

a) True b) False

114. What error does the following code generates when compiled? 1. abstract class Class 2. { 3. public void getNumber(); 4. } 5. class ClassA:Class 6. {} [1.5]

a) The name of base class used is invalid c) The class ClassA must declare as abstract as the class does not implements all the methods of abstract base class.

b) 'Class.getNumber()' must declare a body because it is not marked abstract.

115. abstract class Class { private abstract void getNumber(); } class ClassA:Class { } What error does the following code generates when compiled? [1.5]

a) The name of base class used is invalid. c) The class ClassA must declare as abstract as the class does not implements all the methods of abstract base class.

b) 'Class.getNumber()' must declare a body because it is marked abstract. d)

Page 43: Đề thi lý thuyết 3 môn C

The abstract member cannot be private.

116. Which of the following statements are true? [1.5]

a) A class inherits all interface implementations provided by its base classes. c) When an interface method is mapped onto a virtual method in a class, it is possible for derived classes to override the virtual method

b) Without explicitly re-implementing, a derived class can alter the interface mappings it inherits from its base classes d) An explicit interface member implementations can be abstract.

117. using System; public class Parent { public virtual void Display(){ Console.WriteLine("100"); } } public class Child1:Parent { public override void Display(){ Console.WriteLine("1000"); }} public class Child2:Parent { public override void Display(){ Console.WriteLine("1000"); } public static void Main() { Child1 c1=new Child1(); Child2 c2=new Child2(); Parent p=c2; c1.Display(); p.Display(); }}

What will be the output of above code when compile/run? [2.0]

a) The code will generate an error, as the object p is not properly instantiated. c) The output of the code will be: 1000 1000

b) The code will generate an error, as the object c2 is not properly instantiated d) The output of the code will be: 1000 100

Page 44: Đề thi lý thuyết 3 môn C

118. using System; public class Parent { public virtual void Display(){ Console.WriteLine("100"); } } public class Child1:Parent { public override void Display(){ Console.WriteLine("1000"); } public void Display(int i){ Console.WriteLine("{0}",i); }} public static void Main() { Parent p =new Child1(); p.Display(); p.Display(90); }}

What will be the output of above code when compile/run? [2.0]

a) The code will generate an error, as the object p is not properly instantiated. c) The code will generate a compilation error, as parent class does not have a display method with one argument.

b) The output of the code will be: 1000 1000 d) The output of the code will be: 1000 90

119. Which of the following statements are true with respect to a virtual method [2.0]

a) In a virtual method invocation, the compile-time type of the instance for which the invocation takes place determines the actual method implementation to invoke. c) Because methods are allowed to hide inherited methods, it is possible for a class to contain only one virtual method with the same signature.

b) For every virtual method inherited by or declared in a class, there exists a most derived implementation of the method with respect to that class.

Page 45: Đề thi lý thuyết 3 môn C

120. What will be the output of the code below?

1. class Room{ 2. public bool isEmpty(){ a. return (true); 3. } 4. } 5. class StaffRoom: Room{ 6. public new bool isEmpty(){ a. return false; 7. } 8. public static void Main() { 9. Room R1=new StaffRoom(); 10. System.Console.WriteLine(R1.isEmpty());11. }} [2.0]

a) True c) False

b) The code will not compile and generate an error at line 6. d) The code will not compile and generate an error at line 9.

121. 1. abstract class Class{ 2. public abstract void getNumber(); 3. public abstract void getHeight(); 4. public bool isEmpty(){return (true);} 5. } 6. abstract class ClassA:Class{ 7. public abstract void getWidth(); 8. } 9. class ClassB:ClassA 10. { } What changes should be done in the above code so that the code does not generate any error at compile time? [2.0]

a) Remove the abstract modifier for the Class.getNumber(), Class.getHeight() methods c) Add the abstract modifier for the function Class.isEmpty()

b) Remove the abstract modifier for the class ClassA d) Implement the methods getNumber(),getHeight(), getWidth() in the class ClassB.

c) Add the abstract modifier for the class ClassB

122. Which of the following statements are true with respect to abstract functions? [2.0]

Page 46: Đề thi lý thuyết 3 môn C

a) Abstract event declarations are only permitted in abstract classes. c) An overriding event declaration can include a new modifier.

b) An overriding event declaration must specify the exact same accessibility modifiers, type, and name as the inherited event d) An abstract event declaration specifies that the accessors of the event are virtual, but does not provide an actual implementation of the accessors.

c) An overriding event declaration should not include the sealed modifier.

123. 1. class Room{ 2. int number=0; 3. public bool isEmpty(){ 4. return (number>0); 5. } 6. } 7. class StaffRoom: Room{ 8. int number=10; 9. public new bool isEmpty(){ 10. return (number>0); 11. } 12. public static void Main() { 13. Room R1=new StaffRoom(); 14. System.Console.WriteLine(R1.isEmpty()); 15. StaffRoom R2=new StaffRoom(); 16. System.Console.WriteLine(R2.isEmpty()); 17. } 18. } The output of above code will be: [2.5]

a) 0,10 d) False, True

b) 10,0 e) The code will generate an error.

c) True, False

124. Which of the following statements are correct? [2.5]

a) Like a non-abstract class, an abstract class must provide implementations of all members of the interfaces that are listed in the base class list. c) An explicit interface member implementations can be abstract.

b) An abstract class is not permitted to map interface onto abstract methods d)

Page 47: Đề thi lý thuyết 3 môn C

An explicit interface member implementations are permitted to call abstract methods.

125. interface IMethods { void F(); void G(); } abstract class C: IMethods { void IMethods.F() { FF(); } void IMethods.G() { GG(); } protected abstract void FF(); protected abstract void GG(); } Consider the above code. The non-abstract that derive from C will have to implement: [2.5]

a) F() c) GG()

b) FF() d) G()

126. Using directives are provided to facilitate the use of namespaces. [0.5]

a) True b) False

127. Namespaces are defined using _____ statements. [0.5]

a) Using c) System

b) Class d) Namespace

128. Which of the following statements correctly declares a namespace? [0.5]

a) Namespace{ ----- ----} c) namespace Namespacename{ ----- ----}

b) Namespacename{ ----- ----} d) public namespace Namespacename{ ----- ----}

129. The “using” alias directives can be used to pull out and bring into scope

Page 48: Đề thi lý thuyết 3 môn C

one component from a namespace. [0.5]

a) True b) False

130. The _______ namespace provides the classes and methods for manipulating arrays. [0.5]

a) System.IO c) System.Array

b) System.Arr d) Array

131. For multiple levels of organizations ___ can be used. [1.0]

a) Classes c) a namespace

b) System namespace d) a nested namespaces

132. The ________namespace contains all code required to interact with the including the console output. [1.0]

a) IO c) Class

b) System d) Namespace

133. When a class is used inside its namespace, the _______ of that class is used. [1.0]

a) Qualified name c) Unqualified name

b) Namespace name

134. _____ keyword is used to import the classes of the namespace [1.0]

a) using c) namespace

b) class d) import

135. The Syntax of a predefined Sort method is: [1.0]

a) Arraytosort.Sort() c) System.Array.Sort(Arraytosort)

Page 49: Đề thi lý thuyết 3 môn C

b) Arraytosort.Array.Sort() d) System.Array.Sort()

136. Classes in the Base Class Library are categorized into ______ based on their functionality. [1.0]

a) Assemblies c) Application

b) Directives d) Namespaces

137. The syntax for declaring array is: [1.0]

a) arrayname DataType[]; c) DataType arrayname[];

b) arrayname[] DataType; d) DataType[] arrayname;

138. namespace space1{ } namespace space2{ } What does the above code implement: [1.5]

a) Nested namespaces c) Hierarchical namespaces

b) Multi level namespaces

139. Within the namespace we can declare following: - [1.5]

a) class d) Interface

b) another namespace e) All the options mentioned

c) delegates

140. namespace Space1{ namespace Space2{ class MyClass{ } }} The fully qualified name of class MyClass is : [1.5]

a) Space1.MyClass() c) Space1.Space2.MyClass()

Page 50: Đề thi lý thuyết 3 môn C

b) Space2.MyClass() d) Space2.Space1.MyClass()

141. namespace College.Library{ namespace Shelf{ class Book{ } } }

The fully qualified name of class Book is: [1.5]

a) Shelf.Book() c) College.Library.Shelf.Book()

b) College.Library.Book() d) Library.Shelf.Book()

142. class Test{ static void Main() { int[] Array1= {3,2,1}; int i=Array.IndexOf(Array1,3); Console.WriteLine(i); } } What will be the output of above code [1.5]

a) 3 c) 1

b) 2 d) 0

143. class Question{ static void Main() { int[] List= {30,20,10}; Array.IndexOf(List,30); } } What will be the output of above code [1.5]

a) 3 c) The code will generate a compile time error.

b) 2 d) 1

144. The _______________ namespace contains classes useful for synchronization. [1.5]

Page 51: Đề thi lý thuyết 3 môn C

a) System c) System.Thread

b) System.Threading d) System.Synchronize

145. When the array is initialized at the same time they are created, the c# compiler determines the size of array using ________ [1.5]

a) the default array size for each data type. c) the number of items in the initialization list.

b) the compilers presetting for each data type array. d) The number present in the square bracket next to the data type at the right hand side.

146. By default the compiler opens _____assembly. [2.0]

a) mscorlib.dll c) system.dll

b) Cdefault.dll d) namespace.dll

147. Which of the following statements are true? [2.0]

a) An array is a data structure that contains a number of variables, which are accessed through computed indices. d) The element type of an array can be any type, but not an array type

b) The dimension lengths are not part of the type of the array, but rather are established when an instance of the array type is created at run-time. e) At run-time, a value of an array type is null or a reference to an instance of that array type.

c) The elements of the array are all of the different types.

148. Which of the following statements are true with respect to an Array type. [2.0]

a) System. Array is itself an array-type d) An implicit reference conversion exists from any array type to System.Array

b) The System.Array type is the abstract base type of all array types e) The members of an array are the members inherited from class System.Array.

c) An implicit reference conversion exists from System.Array to any array type

Page 52: Đề thi lý thuyết 3 môn C

149. 1. using System; 2. class Test{ 3. static void Main() 4. { 5. int[] Array1= {3,2,1}; 6. Display1(Array1); 7. Array.Sort(Array1); 8. Display1(Array1); 9. } 10. static void Display1(Array pArray) 11. { 12. foreach(int t in pArray){ Console.Write(t); 13. } } 14. }

What will be the output of above code? [2.0]

a) The code will generate an error at compile time since the Sort() function of Array returns an integer number. c) The output of code will be 3 2 1 1 2 3

b) The output of the code will be: 321123 d) The code will generate a runtime error.

150. What output does the code below generate when compiled/run? 1. class Employee{ 2. public int EmployeeId; 3. public static Employee getEmpId(int EmpId){ 4. Employee emp=new Employee(); 5. emp.EmployeeId=EmpId; 6. return(emp); 7. } 8. } 9. class Test{ 10. public static void Main(){

Page 53: Đề thi lý thuyết 3 môn C

11. Employee[] emps=new Employee[2]; 12. emps[0]=Employee.getEmpId(1); 13. emps[1]=Employee.getEmpId(2); 14. foreach(Employee e in emps) 15. System.Console.WriteLine(e.EmployeeId);16. }} [2.0]

a) The code will generate a null exception, as the employees are not initialized. c) The code will generate a compile time error at line 12 and line 13.

b) The code will compile successfully and outputs will be: 1 2 d) The code will compile successfully and output will be:0 1

Comment(0 ý kiến)

Đề thi lý thuyết 9 môn C# (2010-07-02)

51. using System; class Test { static void Main() { int @Main; int[] Static= new int[3]; @Main =100*Static[1]; Console.WriteLine(@Main); } } What will be the output of above code? [2.0]

a) The code will return an error. c) The code will display 0.

b) The code will display 100. d) The code cannot compile.

52. For decimal, the default value is [2.0]

a) 0.0d b) 0.0m.

53. Value types differ from reference types as___ [2.0]

a) data can be stored using value types but not in the reference type. c) variables of the

Page 54: Đề thi lý thuyết 3 môn C

reference types directly contain their data, whereas variables of the value types store references to objects.

b) data in the value type variable is easily accessible. d) variables of the value types directly contain their data, whereas variables of the reference types store references to objects.

54. What would be the output of the following code fragment?

int x=0,y=4,z=5; if(x<2) if(y<4){ Console.WriteLine("One"); } else { Console.WriteLine("Two"); } else if(z>5){ Console.WriteLine("Three"); } else { Console.WriteLine("Four"); } [2.0]

a) One c) Three

b) Two d) Code will generate an error;

55. Which statement is true about the following code fragment? 1. int j=2,a=1; 2. switch(j){ 3. case 2: Console.WriteLine("Two");break; 4. case 1+a: Console.WriteLine("Two Two"); break; 5. default: Console.WriteLine(j);6. } [2.0]

a) The code is illegal because of expression at line 4. b) The output would be only the text “Two”.

b) The acceptable type for variable j as the argument to the switch () construct could be any of byte, short, int or long. d) The output would be only the text “Two” followed by the text “Two Two” followed by the text “2”.

56. Which statement is true about the following code fragment?

Page 55: Đề thi lý thuyết 3 môn C

int j=2; switch(j){ case 2: Console.WriteLine("Two");break; case 2+1: Console.WriteLine("Three");break; default : Console.WriteLine(j); } [2.0]

a) The code is illegal because of expression at line 4. c) The output would be the text “Two” followed by the text “Three”.

b) The output would be only the text “Two”. d) The output would be only the text “Three” followed by the text “Two” followed by the text “2”.

57. char c=’a’; switch(c ){ case ‘a’: Console.WriteLine("A");break; default: Console.WriteLine("Default"); } What will happen if you attempt to compile and run code that includes this snippet? [2.0]

a) The code will not compile because the switch statement does not have a legal expression. c) The code will compile and run and the letter “A” will be written to the standard output.

b) The code will compile and run but nothing will be return on the standard output. d) The code will compile and run and the word “Default” will be written to the standard output.

58. Which of the following is a legal loop constructions? (Choose all that apply) [2.5]

a) while(int i<7) { i++; Console.WriteLine("Value of i is {0}",i); } c) int j=0; for(int k=0;j+k!=10;j++,k++) { Console.WriteLine("j= {0} k={1}",j,k); }

b) int i=3; while(i){

Page 56: Đề thi lý thuyết 3 môn C

Console.WriteLine("Value of i is {0}",i); } d) int j=0; do{ Console.WriteLine("Value of i is {0}",,j); if(j==3){continue loop;} }while(j<10);

59. int myVar=3; if (myVar<5) if(myVar<3) Console.WriteLine("<3"); else if (myVar>2) Console.WriteLine(">2"); else Console.WriteLine("Other"); What will appear on the standard output? [2.5]

a) <3 c) Other

b) >2 d) No output

60. Class Book { int num1=1; int num2; public static void Main(){ int num3=3; Console.WriteLine(num1+num2+num3r); } } [2.5]

a) 4 c) The code does not compile because static method cannot access nonstatic variables Var1 and var2.

b) 0 d) The code does not compile because Var2 is not initialized.

61. If you run the following program what lines would be included in its output?

class A { public static void Main () { int i=0; switch (i) {

Page 57: Đề thi lý thuyết 3 môn C

default: System.Console.Write (i); break; case 1: System.Console.Write ("{0}",1); goto default; case 0: System.Console.Write ("{0}",0); goto case 1; } } } [2.5]

a) 100 c) 110

b) 010 d) The program fails to compile.

62. A constructor is a special type of a _______ in a class. [0.5]

a) variable c) method

b) instance d) struct

63. The constructor without parameters is called _________. [0.5]

a) main constructor c) default constructor

b) zero valued constructor d) non-parameterized constructor

64. Static constructor has _______ parameter/s. [0.5]

a) Only one c) no

b) One or more

65. The object invokes the default constructor when no parameters were passed to it. [0.5]

a) True b) False

Page 58: Đề thi lý thuyết 3 môn C

66. If a class has a static constructor then it is automatically called when the class is loaded. Static constructors cannot be invoked explicitly. [0.5]

a) True b) False

67. _______ enables the possibility for a function to be polymorphic when it is overridden in one or more inherited classes. [0.5]

a) static c) overridden

b) parameterized d) virtual

68. Which of the following sentences are true about Constructors? [1.0]

a) The constructor can have the same name as that of its class. c) The constructor may or may not have name same as that of the name of its class.

b) The constructor can have the same name as one of the methods in the class. d) The constructor must have the same name as that of the name of its class.

69. Which of the following methods can act as a constructor for the class “Object” that is used to create an object. [1.0]

a) void object(){} c) Object Object(){}

b) object(){} d) Object(){}

70. Which of the following methods can act as a constructor for the class “Employee” that is used to create an object. [1.0]

a) void employee(int enmpno){} c) employee(int empno){}

b) Employee (){} d) Employee(int empno){}

71. Methods can be overloaded in C# by: [1.0]

a) specifying different return types. c) specifying different number of parameters

b) specifying different names for the methods. d) specifying different types of parameters

Page 59: Đề thi lý thuyết 3 môn C

72. Which of the following is a legal constructor for the class Test. [1.0]

a) constructor Test(){ } d) void Test(int a, string s, int f)

b) Test() { } e) public Test(int a, int b){}

c) Test(int a, int b){}

73. Which of the following statements are true? [1.0]

a) A static constructor is a member that implements the actions required to initialize a class. d) A static constructor cannot have accessibility modifiers.

b) Static constructors may or may not take parameters. e) A static constructor for a class is called automatically when the object is accessed.

c) A static constructor can have public as a accessibility modifiers

74. class A { public static int X = B.Y + 1; } class B { public static int Y = A.X + 1; static void Main() { Console.WriteLine("X = {0}, Y = {1}", A.X, B.Y); } } what will be the output of above code? [1.5]

a) X=0, Y=1 c) X=2, Y=1

b) X=1, Y=2 d) The code fails to compile.

75. Which of the following statements are true with respect to Static constructors. [1.5]

a) Static constructors cannot take parameters. d) Static constructors can be called explicitly or implicitly.

b) Static constructors can have accessibility modifiers. e) Static constructors are called

Page 60: Đề thi lý thuyết 3 môn C

when the class is loaded.

c) Static constructors cannot be called explicitly. f)

76. Which of the following methods can be used as a destructor for a class “myClass”. [1.5]

a) myclass() { } c) ~myClass(int I){ }

b) MyClass() { } d) ~myClass() { }

77. The method that overrides a method in the base class must be prefixed with the ____ keyword. [1.5]

a) virtual c) Sealed

b) new d) Overridden

78. Which of the following statements is correct for a method, which is overriding the following method: public void add(int a) {…} Select the most appropriate answer [1.5]

a) the overriding method must return void c) the overriding method can return whatever it likes

b) the overriding method must return int

79. What error does the following code generate?

1. public class SuperClass { 2. SuperClass(string s) { } 3. }

4. public class SubClass : SuperClass { 5. SubClass(string s) { }

6. public static void Main(){ 7. SuperClass s = new SubClass( "The" ); 8. }} [1.5]

a) The code will generate no error. c) Incompatible type for ’=’ can’t convert SubClass to SuperClass.

Page 61: Đề thi lý thuyết 3 môn C

b) No constructor matching SuperClass() found in class SuperClass d) Wrong number of arguments in constructor.

80. We have the following organization of classes. class Parent { } class DerivedOne :Parent { } class DerivedTwo :Parent { } Which of the following statements is correct for the following expression. 1. Parent p = new Parent(); 2. DerivedOne d1 = new DerivedOne(); 3. DerivedTwo d2 = new DerivedTwo(); 4. p = d1; [1.5]

a) llegal at both compile and runtime, c) Legal at compile and runtime

b) Legal at compile time, but fails at runtime,

81. Given these class definitions:

class Superclass { } class Subclass1 extends Superclass { } and these objects: Superclass a = new Superclass(); Subclass1 b = new Subclass1(); which of the following explains the result of the statement: b = a; Select the correct statement. [1.5]

a) Illegal at compile time c) Definitely legal at runtime

b) Legal at compile time but possibly illegal at runtime

82. At least one _______ constructor must be declared to suppress the automatic generation of a default constructor. [1.5]

a) Default c) Private

b) Static d) Parameterized

83. Which of the following statements are true with respect to Static constructors ?

Page 62: Đề thi lý thuyết 3 môn C

[2.0]

a) A constructor-declaration may include a set of attributes. d) A class has no other constructors than those that are actually declared in the class

b) A constructor-declaration may include a valid combination of the four access modifiers. e) Constructors are not inherited

c) The identifier of a constructor-declarator must not name the class in which the constructor is declared.

84. What is the output of the following code?

1. public class Test{ 2. public Test(int i){ 5. System.Console.WriteLine("Test(" +i +")"); 3. } 4. }

5. public class Q12{ 6. static Test t1 = new Test(1);

7. Test t2 = new Test(2); 8. static Test t3 = new Test(3); 9. public static void Main(){ 10. Q12 Q = new Q12(); 11. } 12. } [2.0]

a) Test(1) Test(2) Test(3) c) Test(2) Test(1) Test(3)

b) Test(3) Test(2) Test(1) d) Test(1) Test(3) Test(2)

85. Which of the following statements are true with respect to destructors. [2.0]

Page 63: Đề thi lý thuyết 3 môn C

a) Destructors can be invoked explicitly. c) When an instance is destructed, the destructors in an inheritance chain are called in order, from most derived to least derived.

b) A class has no other destructors than those that are actually declared in the class. d) Destructors are inherited.

86. Statement I: The sealed modifiers are not permitted in an enum declaration. Statement II: Delegate types are implicitly sealed [2.0]

a) Both the statements are true. c) Only statement I is true.

b) Both the statements are true. d) Only statement II is true.

87. 1. public class Test { 2. void show() { 3. System.Console.WriteLine("non-static method in Test"); 4. } 5. } 6. public class Q3:Test { 7. static override void show() { 8. System.Console.WriteLine("Overridden non-static method in Q3"); 9. } 10. public static void Main() { a. Q3 a = new Q3(); 11. }} [2.0]

a) Compilation error at line 2. c) No compilation error, but runtime exception at line 3.

b) Compilation error at line 7. d) No compilation error, but runtime exception at line 7.

88. class Test{ static void Main() { A.F(); B.F(); } } class A { static A() { Console.WriteLine("Init A");

Page 64: Đề thi lý thuyết 3 môn C

} public static void F() { Console.WriteLine("A.F"); } } class B { static B() { Console.WriteLine("Init B"); } public static void F() { Console.WriteLine("B.F"); } } [2.0]

a) Init A A.F Init B B.F c) A.F Init B Init A A.F

b) Init Init A A.F B.F d) A.F B.F Init B Init A

89. 1. using System; 2. class Test { 3. void show() { 4. Console.WriteLine("non-static method in Test"); 5. } 6. } 7. public class Q3 : Test { 8. static void show() { 9. Console.WriteLine("Overridden non-static method in Q3"); 10. } 11. public static void main(String[] args) { 12. Q3 a = new Q3(); 13. Test t = new Test();

Page 65: Đề thi lý thuyết 3 môn C

14. } } The following code will give [2.5]

a) Compilation error at line 8. c) No compilation error, but runtime exception at line 8.

b) Compilation error at line 13. d) No compilation error, but runtime exception at line 13.

90. Which of the following statements are true with respect to overloading. [2.5]

a) Overloading of methods permits a struct, or interface to declare multiple methods with the same name, provided the signatures of the methods are all unique. c) A class can have more than one method called Main with different number of arguments and data types.

b) It is possible to overload solely based on return type or solely based on the inclusion or exclusion of the params modifier. d) Unary operators cannot be overloaded.

91. What will happen if you compile/run the following code?

1. public class Q21 { 2. int maxElements; 3. void Q21() { 4. maxElements = 100; 5. System.out.println(maxElements); 6. } 7. Q21(int i) { 8. maxElements = i; 9. System.out.println(maxElements); 10. } 11. public static void Main() { 12. Q21 a = new Q21(); 13. Q21 b = new Q21(999); 14. }15. } [2.5]

a) Prints 100 and 999. c) Compilation error at line 2, variable maxElements was not initialized.

b) Prints 999 and 100. d) Compilation error at line 3.

Page 66: Đề thi lý thuyết 3 môn C

92. What will be printed to standard output?

class Super{ public int index = 5; public virtual void printVal() { System.Console.WriteLine( "Super" ); } }

class Sub : Super{ int index = 2; public override void printVal() { System.Console.WriteLine( "Sub" ); } }

public class Runner { public static void Main( ) { Super sup = new Sub(); System.Console.WriteLine( sup.index + "," ); sup.printVal(); } } [2.5]

a) The code will not compile. c) The code compiles and "5, Sub" is printed on the standard output.

b) The code compiles and "5, Super" is printed on the standard output. d) The code compiles and "2, Super" is printed on the standard output.

93. Assume that Sub1 and Sub2 are both subclasses of class Super.

Given the declarations:

Super super = new Super(); Sub1 sub1 = new Sub1(); Sub2 sub2 = new Sub2();

Which statement best describes the result of attempting to compile and execute the following statement: super = sub1; [2.5]

a) Compiles and definitely legal at runtime c) Compiles and may be illegal at runtime

Page 67: Đề thi lý thuyết 3 môn C

b) Does not compile

94. Which statements on the <<< call >>> line are valid expressions?

public class SuperClass { public int x; public int y; public SuperClass(){} } public class SubClass : SuperClass { private float f; public void m2() { return; } public SubClass() {} }

public class T { public static void Main() { int i; float g; SubClass b = new SubClass( ); <<< call >>> } } [2.5]

a) b.m2(); c) i=b.x;

b) g=b.f; d) i=b.y;

95. Which of the following is a valid method declaration? [0.5]

a) public static virtual void Display() { } c) public void virtual Display(){}

b) public virtual void Display(){} d) public virtual static void Display() { }

96. The ______ declares a reference type that has abstract member only. [0.5]

a) static class c) Interface

b) abstract class d) Delegates

Page 68: Đề thi lý thuyết 3 môn C

97. Abstract class cannot be directly instantiated but it can be used to create object references. [0.5]

a) True b) False

98. An interface is a pure abstract class. [0.5]

a) True b) False

99. The ______ method is used to assign some value to a data member in a class. [0.5]

a) value c) get

b) set d) find

100. public class A:B,C,D{ } The above code represents ______ [0.5]

a) multilevel interface c) multiple interface

b) hierarchical interface d) multiple inheritance

Comment(0 ý kiến)

Đề thi lý thuyết 8 môn C# (2010-07-02)

1. .NET is said to accelerate the next generation of the Internet [0.5]

a) True b) False

2. The unique feature of .NET is the ___________supp

Page 69: Đề thi lý thuyết 3 môn C

ort that it provides [0.5]

a) Multi-platform b) Multi-language

3. .NET is a whole new platform centered around the Intranet [0.5]

a) True b) False

4. A program in .NET is first compiled by the language specific compiler into __________________ [1.0]

a) Common Language c) Intermediate Language

b) Runtime Language d) Visual Basic

5. What is the role of the CLR (Select all that apply) [2.0]

a) Manages memory c) Compiles program into machine code

b) Compiles program to a .exe file d) Compile once and run on any CPU & OS that supports the runtime.

6. Microsoft .NET is primarily made up of the following three components. [2.0]

a) Visual Studio .NET c) 3rd party .NET services

b) Microsoft .NET products and services d) .NET platform itself

7. Select the two core technologies on which the .NET platform is based. [2.5]

a) XML c) Internet Protocols

b) WML d) Internet computing

8. Microsoft .NET allows developers to develop applications using different languages, which run on the Unix platform [0.5]

a) True b) False

Page 70: Đề thi lý thuyết 3 môn C

9. The .NET platform is built on Internet Protocols such as _______ and _______ [1.0]

a) TCP /IP c) SOAP

b) IP d) HTTP

10. The .NET platform is built on the following features of the Windows 2000 server family.(Select all that apply) [1.5]

a) Reliability c) Scalability

b) Security d) Manageability

11. Select the core .NET Enterprise Servers [2.5]

a) Commerce Server 2000 c) Apple Server

b) Exchange 2000 Server d) Visual .Net Server

12. Core Microsoft .NET building block services [2.0]

a) Calendar c) Dynamic delivery

b) Dynamic Service d) Notification

13. _______ service allows users to handle their own rules for handling messages and notifications. [1.5]

a) Notification b) Personalization

14. Select the service, which allows users to maintain their schedules thus facilitating timely and manageable interactions with other users. [1.5]

a) Dynamic Service c) Notification

b) Personalization d) Calendar

Page 71: Đề thi lý thuyết 3 môn C

15. ________ allows developers and business analysts work together to define and modify business processes shared between applications. [1.0]

a) Orchestration c) Common Language Runtime

b) Web Service d) .Net Framework

16. Microsoft .Net was formerly known as __________ [0.5]

a) NGUS c) NGWS

b) MGWS d) NWGS

17. C# allows _______ use of native pointers. [0.5]

a) Private c) Public

b) Complete d) Restricted

18. What is the correct syntax for comment entries in C# [1.0]

a) // … // c) /** … **/

b) /*… */ d) / … /

19. The public keyword can be ignored for the Main function in C#. [1.0]

a) True b) False

20. A C# program can have only one using directive [0.5]

a) True b) False

21. The WriteLine method is a part of the ______ class [1.0]

a) System c) Console

b) System.Output d) Console.System

Page 72: Đề thi lý thuyết 3 môn C

22. C# is considered as a modern replacement for the language/s like: (Choose all that apply) [0.5]

a) Java c) C++

b) C d) VB

23. C# is a ____________language. [0.5]

a) purely Procedure-Oriented c) Procedure-Oriented and Object-Oriented

b) partially Procedure-Oriented d) purely Object-Oriented

24. Manual memory management needs to be done in C# [0.5]

a) True b) False

25. Access Modifiers for variables in C# can be the following (Select all that apply) [1.0]

a) Public c) Private

b) Protected d) Public protected

26. In C#, an underscore is allowed as an initial character of a variable. [0.5]

a) True b) False

27. The prefix ______ enables the use of keywords as identifiers, which is useful when interfacing with other programming languages. [0.5]

a) # c) $

b) & d) @

28. In C# array elements are automatically assigned default values [0.5]

a) True b) False

Page 73: Đề thi lý thuyết 3 môn C

29. What statement is used to completely abort the execution of a loop? [0.5]

a) continue d) break

b) goto e) exit

30. Console.ReadLine() returns the input as a ________ [1.0]

a) String c) Stream of Characters

b) Character d) Integer

31. In C# datatypes are divided into two fundamental categories [1.0]

a) Value types and reference types c) Pointers and values

32. __________in simple terms is nothing but conversion of a value type into a reference type. [1.0]

a) Casting c) Unboxing

b) Boxing d) Overriding

33. __________is all about converting a reference type into a value type. [1.0]

a) Overloading c) Unboxing

b) Boxing d) Casting

34. Unboxing requires an ___________cast. [0.5]

a) implicit c) implicit or explicit

b) explicit d) None of the above.

35. The _______class is the ultimate base class for all data types. [0.5]

a) Object c) Type

b) System d) Console

Page 74: Đề thi lý thuyết 3 môn C

36. System namespace is used in the C# programs to: [1.0]

a) interact with the system environment c) interact with other classes in the namespace

b) capture program outputs. d) interact with the operating system

37. Which of the following is a correct statement to declare the class “MyClass”. [1.0]

a) Class myclass c) class MyClass

b) class Myclass d) Class MyClass

38. Which of the following is a valid variable in C#? [1.0]

a) Class c) _Class

b) Class d) @class

39. Basic input and output operations are performed in C# using the methods of the ______ class in the _________namespace. [1.0]

a) InputOutput,Class c) Console,System

b) InputOutput, System d) System,Console

40. C# provides an Unified Type System, which means that all data types are derived from __________ class. [1.5]

a) System c) Variable

b) Object d) Class

41. Which of the following are value types? [1.0]

a) Interface c) Struct

b) String d) Union

Page 75: Đề thi lý thuyết 3 môn C

42. Which of the following will execute without errors at compile time. [1.5]

a) class Object{ static void main(){} } d) class Object{ public static Main(){} }

b) class Object{ static void Main(){} } e) class Object{ static void Main(){}; }

c) Class Object{ static void Main(){} }

43. Which of the following are valid identifiers? [1.5]

a) void c) @void

b) _void d) _var

44. for(int i=0;i<2;i++){ for(int j=0;j<3;j++){ if(i==j) continue; } Console.WriteLine(“i={0} j={1}”,i,j); } Which lines would be the part of output? [1.5]

a) i=0 j=0 d) i=1 j=0

b) i=0 j=1 e) i=1 j=1

c) i=0 j=2

Page 76: Đề thi lý thuyết 3 môn C

45. How can you initialize an array of three Boolean values? [1.5]

a) bool[] b=new bool[3]; c) bool[3] b={true,true,true};

b) bool[] b={true,true,true}; d) bool[3] b=new bool[3]={true,true,true};

46. using System; class MyClass { int Var1=1; int Var2; public static void Main(){ int LocalVar=3; MyClass m1=new MyClass(); Console.WriteLine(m1.Var1+m1.Var2+LocalVar); } } The output of above code will be: [1.5]

a) 4 c) The code does not compile because local variable is not initialized correctly.

b) 0 d) The code does not compile because Var2 is not initialized.

47. What is wrong with the following for statement?

for(i=0;j=0, i<10; ++i,j+=i){ k+=i*j+j*j; } [1.5]

a) It should include more than one statement in the statement block. c) It uses more than one loop index.

b) There should be comma between i=0 and j=0 . d) There should be a semicolon between j=0 and I<10.

48. What is wrong with the following for statement?

for(i=0,,j=0; ++i,j+=i; i<10,++i;) k+=i*j+j*j; [1.5]

a) There should be semicolon between i=0 and j=0.

Page 77: Đề thi lý thuyết 3 môn C

c) It uses more than one loop index.

b) It should include more than one statement in the statement block. d) The syntax of for loop is improper.

49. Array X and Y have integer data types. If these arrays are initialized properly, what is wrong with the following statement? for(int var=0;var<0;++var){ if(x[var]>100) break; if(x[var]<0) continue; x[var+1]=x[var]+y[var]; } [1.5]

a) It is illegal to have a break and continue statements within the same for statement. c) The prefix operator is not allowed in the iteration part of a for statement.

b) The variable var cannot be declared in the initialization part of a for statement. d) There is nothing wrong with the statement.

50. If you ran the following program what lines would be included in its output?

int var1,var2; for(var1=0,var2=0;var1+var2<20;++var1,var2+=1) { Console.WriteLine(var1+var2); } [1.5]

a) 5 c) 13

b) 8 d) The program cannot compile because the for statement’s syntax is incorrect.

Comment(0 ý kiến)

Đề thi lý thuyết 6 môn C# (2010-07-01)

1. .NET is said to accelerate the next generation of the Internet [0.5] a) True b) False

Page 78: Đề thi lý thuyết 3 môn C

2. The unique feature of .NET is the ___________support that it provides [0.5]

a) Multi-platform b) Multi-language 3. .NET is a whole new platform centered around the Intranet [0.5] a) True b) False 4. A program in .NET is first compiled by the language specific compiler into __________________ [1.0] a) Common Language c) Intermediate Language b) Runtime Language d) Visual Basic 5. What is the role of the CLR (Select all that apply) [2.0] a) Manages memory c) Compiles program into machine code b) Compiles program to a .exe file d) Compile once and run on any CPU & OS that supports the runtime. 6. Microsoft .NET is primarily made up of the following three components. [2.0] a) Visual Studio .NET c) 3rd party .NET services b) Microsoft .NET products and services d) .NET platform itself 7. Select the two core technologies on which the .NET platform is based. [2.5] a) XML c) Internet Protocols b) WML d) Internet computing 8. Microsoft .NET allows developers to develop applications using different languages, which run on the Unix platform [0.5] a) True b) False 9. The .NET platform is built on Internet Protocols such as _______ and _______ [1.0] a) TCP /IP c) SOAP b) IP d) HTTP 10. The .NET platform is built on the following features of the Windows 2000 server family.(Select all that apply) [1.5] a) Reliability c) Scalability b) Security d) Manageability 11. Select the core .NET Enterprise Servers [2.5] a) Commerce Server 2000 c) Apple Server b) Exchange 2000 Server d) Visual .Net Server 12. Core Microsoft .NET building block services [2.0] a) Calendar c) Dynamic delivery b) Dynamic Service d) Notification 13. _______ service allows users to handle their own rules for handling messages and notifications. [1.5] a) Notification b) Personalization 14. Select the service, which allows users to maintain their schedules thus facilitating timely and manageable interactions with other users. [1.5] a) Dynamic Service c) Notification b) Personalization d) Calendar 15. ________ allows developers and business analysts work together to define and modify business processes shared between applications. [1.0]

Page 79: Đề thi lý thuyết 3 môn C

a) Orchestration c) Common Language Runtime b) Web Service d) .Net Framework 16. Microsoft .Net was formerly known as __________ [0.5] a) NGUS c) NGWS (Next Generation Windows Services) b) MGWS d) NWGS 17. C# allows _______ use of native pointers. [0.5] a) Private c) Public b) Complete d) Restricted 18. What is the correct syntax for comment entries in C# [1.0] a) // … // c) /** … **/ b) /*… */ d) / … / 19. The public keyword can be ignored for the Main function in C#. [1.0] a) True b) False 20. A C# program can have only one using directive [0.5] a) True b) False 21. The WriteLine method is a part of the ______ class [1.0] a) System c) Console b) System.Output d) Console.System 22. C# is considered as a modern replacement for the language/s like (Choose all that apply) [0.5] a) Java c) C++ b) C d) VB 23. C# is a ____________language. [0.5] a) purely Procedure-Oriented c) Procedure-Oriented and Object-Oriented b) partially Procedure-Oriented d) purely Object-Oriented 24. Manual memory management needs to be done in C# [0.5] a) True b) False 25. Access Modifiers for variables in C# can be the following (Select all that apply) [1.0] a) public c) private b) protected d) public protected 26. In C#, an underscore is allowed as an initial character of a variable. [0.5] a) True b) False 27. The prefix ______ enables the use of keywords as identifiers, which is useful when interfacing with other programming languages. [0.5] a) # c) $ b) & d) @ 28. In C# array elements are automatically assigned default values [0.5] a) True b) False 29. What statement is used to completely abort the execution of a loop? [0.5] a) continue d) break b) goto e) exit 30. Console.ReadLine() returns the input as a ________ [1.0] a) String c) Stream of Characters b) Character d) Integer 31. In C# datatypes are divided into two fundamental categories [1.0]

Page 80: Đề thi lý thuyết 3 môn C

a) Value types and reference types c) Pointers and values 32. __________in simple terms is nothing but conversion of a value type into a reference type. [1.0] a) Casting c) Unboxing b) Boxing d) Overriding 33. __________is all about converting a reference type into a value type. [1.0] a) Overloading c) Unboxing b) Boxing d) Casting 34. Unboxing requires an ___________cast. [0.5] a) implicit c) implicit or explicit b) explicit d) None of the above. 35. The _______class is the ultimate base class for all data types. [0.5] a) Object c) Type b) System d) Console 36. System namespace is used in the C# programs to: [1.0] a) interact with the system environment c) interact with other classes in the namespace b) capture program outputs. d) interact with the operating system 37. Which of the following is a correct statement to declare the class “MyClass”. [1.0] a) Class myclass c) class MyClass b) class Myclass d) Class MyClass 38. Which of the following is a valid variable in C#? [1.0] a) class c) _Class b) Class d) @class 39. Basic input and output operations are performed in C# using the methods of the ______ class in the _________namespace. [1.0] a) InputOutput,Class c) Console,System b) InputOutput, System d) System,Console 40. C# provides an Unified Type System, which means that all data types are derived from __________ class. [1.5] a) System c) Variable b) Object d) Class 41. Which of the following are value types? [1.0] a) Interface c) Struct b) String d) Union 42. Which of the following will execute without errors at compile time. [1.5] a) class Object{ static void main(){} } d) class Object{ public static Main(){} } b) class Object{ static void Main(){} } e) class Object{ static void Main(){};

Page 81: Đề thi lý thuyết 3 môn C

} c) Class Object{ static void Main(){} } 43. Which of the following are valid identifiers? [1.5] a) void c) @void b) _void d) _var 44. for(int i=0;i<2;i++){ for(int j=0;j<3;j++){ if(i==j) continue; } Console.WriteLine(“i={0} j={1}”,i,j); } Which lines would be the part of output? [1.5] a) i=0 j=0 d) i=1 j=0 b) i=0 j=1 e) i=1 j=1 c) i=0 j=2 45. How can you initialize an array of three Boolean values? [1.5] a) bool[] b=new bool[3]; c) bool[3] b={true,true,true}; b) bool[] b={true,true,true}; d) bool[3] b=new bool[3]={true,true,true}; 46. using System; class MyClass { int Var1=1; int Var2; public static void Main(){ int LocalVar=3; MyClass m1=new MyClass(); Console.WriteLine(m1.Var1+m1.Var2+LocalVar); } } The output of above code will be: [1.5] a) 4 c) The code does not compile because local variable is not initialized correctly. b) 0 d) The code does not compile because Var2 is not initialized.

47. What is wrong with the following for statement?

for(i=0;j=0, i<10; ++i,j+=i){ k+=i*j+j*j; } [1.5] a) It should include more than one statement in the statement block. c) It uses more than one loop index. b) There should be comma between i=0 and j=0 . d) There should be a semicolon between j=0 and I<10. 48. What is wrong with the following for statement?

Page 82: Đề thi lý thuyết 3 môn C

for(i=0,,j=0; ++i,j+=i; i<10,++i;) k+=i*j+j*j; [1.5] a) There should be semicolon between i=0 and j=0. c) It uses more than one loop index. b) It should include more than one statement in the statement block. d) The syntax of for loop is improper. 49. Array X and Y have integer data types. If these arrays are initialized properly, what is wrong with the following statement? for(int var=0;var<0;++var){ if(x[var]>100) break; if(x[var]<0) continue; x[var+1]=x[var]+y[var]; } [1.5] a) It is illegal to have a break and continue statements within the same for statement. c) The prefix operator is not allowed in the iteration part of a for statement. b) The variable var cannot be declared in the initialization part of a for statement. d) There is nothing wrong with the statement. 50. If you ran the following program what lines would be included in its output?

int var1,var2; for(var1=0,var2=0;var1+var2<20;++var1,var2+=1) { Console.WriteLine(var1+var2); } [1.5] a) 5 c) 13 b) 8 d) The program cannot compile because the for statement’s syntax is incorrect. 51. using System; class Test { static void Main() { int @Main; int[] Static= new int[3]; @Main =100*Static[1]; Console.WriteLine(@Main); } } What will be the output of above code? [2.0] a) The code will return an error. c) The code will display 0. b) The code will display 100. d) The code cannot compile. 52. For decimal, the default value is [2.0] a) 0.0d b) 0.0m. 53. Value types differ from reference types as___ [2.0] a) data can be stored using value types but not in the reference type. c) variables of the reference types directly contain their data, whereas variables of the value types store references to objects.

Page 83: Đề thi lý thuyết 3 môn C

b) data in the value type variable is easily accessible. d) variables of the value types directly contain their data, whereas variables of the reference types store references to objects. 54. What would be the output of the following code fragment?

int x=0,y=4,z=5; if(x<2) if(y<4){ Console.WriteLine("One"); } else { Console.WriteLine("Two"); } else if(z>5){ Console.WriteLine("Three"); } else { Console.WriteLine("Four"); } [2.0] a) One c) Three b) Two d) Code will generate an error; 55. Which statement is true about the following code fragment? 1. int j=2,a=1; 2. switch(j){ 3. case 2: Console.WriteLine("Two");break; 4. case 1+a: Console.WriteLine("Two Two"); break; 5. default: Console.WriteLine(j);6. } [2.0] a) The code is illegal because of expression at line 4. c) The output would be only the text “Two”. b) The acceptable type for variable j as the argument to the switch () construct could be any of byte, short, int or long. d) The output would be only the text “Two” followed by the text “Two Two” followed by the text “2”. 56. Which statement is true about the following code fragment? int j=2; switch(j){ case 2: Console.WriteLine("Two");break; case 2+1: Console.WriteLine("Three");break; default : Console.WriteLine(j); } [2.0] a) The code is illegal because of expression at line 4. c) The output would be the text “Two” followed by the text “Three”. b) The output would be only the text “Two”. d) The output would be only the text “Three” followed by the text “Two” followed by the text “2”. 57. char c=’a’; switch(c ){ case ‘a’: Console.WriteLine("A");break;

Page 84: Đề thi lý thuyết 3 môn C

default: Console.WriteLine("Default"); } What will happen if you attempt to compile and run code that includes this snippet? [2.0] a) The code will not compile because the switch statement does not have a legal expression. c) The code will compile and run and the letter “A” will be written to the standard output. b) The code will compile and run but nothing will be return on the standard output. d) The code will compile and run and the word “Default” will be written to the standard output. 58. Which of the following is a legal loop constructions? (Choose all that apply) [2.5] a) while(int i<7) { i++; Console.WriteLine("Value of i is {0}",i); } c) int j=0; for(int k=0;j+k!=10;j++,k++) { Console.WriteLine("j= {0} k={1}",j,k); } b) int i=3; while(i){ Console.WriteLine("Value of i is {0}",i); } d) int j=0; do{ Console.WriteLine("Value of i is {0}",,j); if(j==3){continue loop;} }while(j<10); 59. int myVar=3; if (myVar<5) if(myVar<3) Console.WriteLine("<3"); else if (myVar>2) Console.WriteLine(">2"); else Console.WriteLine("Other"); What will appear on the standard output? [2.5] a) <3 c) Other b) >2 d) No output 60. Class Book { int num1=1; int num2; public static void Main(){ int num3=3; Console.WriteLine(num1+num2+num3r);

Page 85: Đề thi lý thuyết 3 môn C

} } [2.5] a) 4 c) The code does not compile because static method cannot access nonstatic variables Var1 and var2. b) 0 d) The code does not compile because Var2 is not initialized. 61. If you run the following program what lines would be included in its output?

class A { public static void Main () { int i=0; switch (i) { default: System.Console.Write (i); break; case 1: System.Console.Write ("{0}",1); goto default; case 0: System.Console.Write ("{0}",0); goto case 1; } } } [2.5] a) 100 c) 110 b) 010 d) The program fails to compile. 62. A constructor is a special type of a _______ in a class. [0.5] a) variable c) method b) instance d) struct 63. The constructor without parameters is called _________. [0.5] a) main constructor c) default constructor b) zero valued constructor d) non-parameterized constructor 64. Static constructor has _______ parameter/s. [0.5] a) Only one c) no b) One or more 65. The object invokes the default constructor when no parameters were passed to it. [0.5] a) True b) False 66. If a class has a static constructor then it is automatically called when the class is loaded. Static constructors cannot be invoked explicitly. [0.5] a) True b) False 67. _______ enables the possibility for a function to be polymorphic when it is overridden in one or more inherited classes. [0.5] a) static c) overridden

Page 86: Đề thi lý thuyết 3 môn C

b) parameterized d) virtual 68. Which of the following sentences are true about Constructors? [1.0] a) The constructor can have the same name as that of its class. c) The constructor may or may not have name same as that of the name of its class. b) The constructor can have the same name as one of the methods in the class. d) The constructor must have the same name as that of the name of its class. 69. Which of the following methods can act as a constructor for the class “Object” that is used to create an object. [1.0] a) void object(){} c) Object Object(){} b) object(){} d) Object(){} 70. Which of the following methods can act as a constructor for the class “Employee” that is used to create an object. [1.0] a) void employee(int enmpno){} c) employee(int empno){} b) Employee (){} d) Employee(int empno){} 71. Methods can be overloaded in C# by: [1.0] a) specifying different return types. c) specifying different number of parameters b) specifying different names for the methods. d) specifying different types of parameters

72. Which of the following is a legal constructor for the class Test. [1.0] a) constructor Test(){ } d) void Test(int a, string s, int f) b) Test() { } e) public Test(int a, int b){} c) Test(int a, int b){} 73. Which of the following statements are true? [1.0] a) A static constructor is a member that implements the actions required to initialize a class. d) A static constructor cannot have accessibility modifiers. b) Static constructors may or may not take parameters. e) A static constructor for a class is called automatically when the object is accessed. c) A static constructor can have public as a accessibility modifiers 74. class A { public static int X = B.Y + 1; } class B { public static int Y = A.X + 1; static void Main() { Console.WriteLine("X = {0}, Y = {1}", A.X, B.Y); } } what will be the output of above code? [1.5] a) X=0, Y=1 c) X=2, Y=1 b) X=1, Y=2 d) The code fails to compile. 75. Which of the following statements are true with respect to Static constructors. [1.5]

Page 87: Đề thi lý thuyết 3 môn C

a) Static constructors cannot take parameters. d) Static constructors can be called explicitly or implicitly. b) Static constructors can have accessibility modifiers. e) Static constructors are called when the class is loaded. c) Static constructors cannot be called explicitly. f) 76. Which of the following methods can be used as a destructor for a class “myClass”. [1.5] a) myclass() { } c) ~myClass(int I){ } b) MyClass() { } d) ~myClass() { } 77. The method that overrides a method in the base class must be prefixed with the ____ keyword. [1.5] a) virtual c) Sealed b) new d) Overridden

78. Which of the following statements is correct for a method, which is overriding the following method: public void add(int a) {…}Select the most appropriate answer [1.5] a) the overriding method must return void c) the overriding method can return whatever it likes b) the overriding method must return int 79. What error does the following code generate? 1. public class SuperClass { 2. SuperClass(string s) { } 3. } 4. public class SubClass : SuperClass { 5. SubClass(string s) { } 6. public static void Main(){ 7. SuperClass s = new SubClass( "The" ); 8. } } [1.5] a) The code will generate no error. c) Incompatible type for ’=’ can’t convert SubClass to SuperClass. b) No constructor matching SuperClass() found in class SuperClass d) Wrong number of arguments in constructor. 80. We have the following organization of classes. class Parent { } class DerivedOne :Parent { } class DerivedTwo :Parent { } Which of the following statements is correct for the following expression. 1. Parent p = new Parent(); 2. DerivedOne d1 = new DerivedOne(); 3. DerivedTwo d2 = new DerivedTwo(); 4. p = d1; [1.5] a) llegal at both compile and runtime, c) Legal at compile and runtime b) Legal at compile time, but fails at runtime, 81. Given these class definitions:

Page 88: Đề thi lý thuyết 3 môn C

class Superclass { } class Subclass1 extends Superclass { } and these objects: Superclass a = new Superclass(); Subclass1 b = new Subclass1(); which of the following explains the result of the statement: b = a; Select the correct statement. [1.5] a) Illegal at compile time c) Definitely legal at runtime b) Legal at compile time but possibly illegal at runtime 82. At least one _______ constructor must be declared to suppress the automatic generation of a default constructor. [1.5] a) Default c) Private b) Static d) Parameterized 83. Which of the following statements are true with respect to Static constructors ? [2.0] a) A constructor-declaration may include a set of attributes. d) A class has no other constructors than those that are actually declared in the class b) A constructor-declaration may include a valid combination of the four access modifiers. e) Constructors are not inherited c) The identifier of a constructor-declarator must not name the class in which the constructor is declared. 84. What is the output of the following code?

1. public class Test{ 2. public Test(int i){ 5. System.Console.WriteLine("Test(" +i +")"); 3. } 4. }

5. public class Q12{ 6. static Test t1 = new Test(1);

7. Test t2 = new Test(2); 8. static Test t3 = new Test(3); 9. public static void Main(){ 10. Q12 Q = new Q12(); 11. } 12. } [2.0] a) Test(1) Test(2) Test(3) c) Test(2) Test(1) Test(3) b) Test(3)

Page 89: Đề thi lý thuyết 3 môn C

Test(2) Test(1) d) Test(1) Test(3) Test(2) 85. Which of the following statements are true with respect to destructors. [2.0] a) Destructors can be invoked explicitly. c) When an instance is destructed, the destructors in an inheritance chain are called in order, from most derived to least derived. b) A class has no other destructors than those that are actually declared in the class. d) Destructors are inherited. 86. Statement I: The sealed modifiers are not permitted in an enum declaration. Statement II: Delegate types are implicitly sealed [2.0] a) Both the statements are true. c) Only statement I is true. b) Both the statements are true. d) Only statement II is true. 87. 1. public class Test { 2. void show() { 3. System.Console.WriteLine("non-static method in Test"); 4. } 5. } 6. public class Q3:Test { 7. static override void show() { 8. System.Console.WriteLine("Overridden non-static method in Q3"); 9. } 10. public static void Main() { a. Q3 a = new Q3(); 11. }} [2.0] a) Compilation error at line 2. c) No compilation error, but runtime exception at line 3. b) Compilation error at line 7. d) No compilation error, but runtime exception at line 7. 88. class Test{ static void Main() { A.F(); B.F(); } } class A { static A() { Console.WriteLine("Init A"); } public static void F() { Console.WriteLine("A.F"); }

Page 90: Đề thi lý thuyết 3 môn C

} class B { static B() { Console.WriteLine("Init B"); } public static void F() { Console.WriteLine("B.F"); } } [2.0] a) Init A A.F Init B B.F c) A.F Init B Init A A.F b) Init Init A A.F B.F d) A.F B.F Init B Init A 89. 1. using System; 2. class Test { 3. void show() { 4. Console.WriteLine("non-static method in Test"); 5. } 6. } 7. public class Q3 : Test { 8. static void show() { 9. Console.WriteLine("Overridden non-static method in Q3"); 10. } 11. public static void main(String[] args) { 12. Q3 a = new Q3(); 13. Test t = new Test(); 14. } } The following code will give [2.5] a) Compilation error at line 8. c) No compilation error, but runtime exception at line 8. b) Compilation error at line 13. d) No compilation error, but runtime exception at line 13. 90. Which of the following statements are true with respect to overloading. [2.5]

Page 91: Đề thi lý thuyết 3 môn C

a) Overloading of methods permits a struct, or interface to declare multiple methods with the same name, provided the signatures of the methods are all unique. c) A class can have more than one method called Main with different number of arguments and data types. b) It is possible to overload solely based on return type or solely based on the inclusion or exclusion of the params modifier. d) Unary operators cannot be overloaded. 91. What will happen if you compile/run the following code?

1. public class Q21 { 2. int maxElements; 3. void Q21() { 4. maxElements = 100; 5. System.out.println(maxElements); 6. } 7. Q21(int i) { 8. maxElements = i; 9. System.out.println(maxElements); 10. } 11. public static void Main() { 12. Q21 a = new Q21(); 13. Q21 b = new Q21(999); 14. }15. } [2.5] a) Prints 100 and 999. c) Compilation error at line 2, variable maxElements was not initialized. b) Prints 999 and 100. d) Compilation error at line 3.

92. What will be printed to standard output?

class Super{ public int index = 5; public virtual void printVal() { System.Console.WriteLine( "Super" ); } }

class Sub : Super{ int index = 2; public override void printVal() { System.Console.WriteLine( "Sub" ); } }

public class Runner { public static void Main( ) { Super sup = new Sub();

Page 92: Đề thi lý thuyết 3 môn C

System.Console.WriteLine( sup.index + "," ); sup.printVal(); } } [2.5] a) The code will not compile. c) The code compiles and "5, Sub" is printed on the standard output. b) The code compiles and "5, Super" is printed on the standard output. d) The code compiles and "2, Super" is printed on the standard output. 93. Assume that Sub1 and Sub2 are both subclasses of class Super.

Given the declarations:

Super super = new Super(); Sub1 sub1 = new Sub1(); Sub2 sub2 = new Sub2();

Which statement best describes the result of attempting to compile and execute the following statement: super = sub1; [2.5] a) Compiles and definitely legal at runtime c) Compiles and may be illegal at runtime b) Does not compile 94. Which statements on the <<< call >>> line are valid expressions?

public class SuperClass { public int x; public int y; public SuperClass(){} } public class SubClass : SuperClass { private float f; public void m2() { return; } public SubClass() {} }

public class T { public static void Main() { int i; float g; SubClass b = new SubClass( ); <<< call >>> } } [2.5] a) b.m2(); c) i=b.x;

Page 93: Đề thi lý thuyết 3 môn C

b) g=b.f; d) i=b.y; 95. Which of the following is a valid method declaration? [0.5] a) public static virtual void Display() { } c) public void virtual Display(){} b) public virtual void Display(){} d) public virtual static void Display() { } 96. The ______ declares a reference type that has abstract member only. [0.5] a) static class c) Interface b) abstract class d) Delegates 97. Abstract class cannot be directly instantiated but it can be used to create object references. [0.5] a) True b) False 98. An interface is a pure abstract class. [0.5] a) True b) False 99. The ______ method is used to assign some value to a data member in a class. [0.5] a) value c) get b) set d) find 100. public class A:B,C,D{ } The above code represents ______ [0.5] a) multilevel interface c) multiple interface b) hierarchical interface d) multiple inheritance

Comment(0 ý kiến)

Đề thi lý thuyết 5 môn C# (2010-07-01)

1. Custom attributes also placed in the namespace System A. False. B. True

2. ____ is the main class for creating threads and controlling them A. WaitHandle B. Monitor C. ThreadStart D. ThreadPool E. Thread

3. The methods represented by ThreadStart can return any type A. False B. True

Page 94: Đề thi lý thuyết 3 môn C

4. The . Net Frameword SDK 2 provides the user with a tool called ____ to peek into the assemblies and explore the classes available within them. A. Explr B. Look C. SN D. ILDASM

5. The methods represented by ThreadStart can have zero, one or more parameters A. Fasle B. True

6. In C#, _______ is a mechanism of adding metadata to a programming element. A. Annotation B. Attribute C. Assembly D. Reflection

7. Sn.exe is used to create strong names for essemblies A. False B. True

8. If the .NET component needs to be accessed from more than one application, the .NET component then needs to be shared assembly and has to be installrd on the GAC A. False B. True 9. Which file comes with .NET frameword SDK to create a Resource file? A. Region.exe B. Resin.exe C. Resource.exe D. Resgen.exe 10. What is the command GacUtil / o NetClient.dll used for? A. To compile the assembly B. To store the assembly in the file C. To generate an assembly containing metadata. D. To enable the assembly to be shared among several applications 11. The ______ command gives you output of COM type library. A. TLBDet B. TLBExp C. TLBLib D. TLBImp 12. Multithread can help to improve application responsiveness A. False B. True 13. Identify the correct statement/s A. Sta

Page 95: Đề thi lý thuyết 3 môn C

14. Identify the 2 abstract classes from the list given below A. XmlDocument B. XmlTextWriter C. XmlReader D. XmlWriter 15. How many CCWs are created by the runtime to manage more then one COM client? A. One CCW can handle any number of COM clients B. The number of CCWs is equal to the number of COM clients C. Five CCWs are created to handle more then one COM clients 16. We write the contents of the dataset to an XML file using the ___ method of the datase object A. WriteXml() B. WriteStartElement() C. WriteStartDocument() D. Write() 17. Which of the following statement/s with reference to Dllimport attribute is/are TRUE? A. It can import a file written in Visual basic only B. It can import a file written in any programming language 18. What must one do to register or unregister the .Net components in the Windows registry? A. Components get registrered / unregistered automatically B. Register / Unregister the .Net components in the windows file. C. Write the code for registering/unregistering .Net components in the assembly D. Run RegAsm.exe on the command line. 19. We can define a custom attribute but its information cannot be retrieved A. Fasle B. True

20. The glable assemblies are saved in the ____ A. Sub folder within the folder containing the calling application B. Same folder as the calling application C. In the :\WINNT\Assembly folder D. Parent folder of the calling application 21. The .exe file in .Net can be executed from any platform A. False B. True

22. What does a change in the build number of the version number indicate? A. It indicates that the assembly is incompatible with previous versions of that assembly B. It indicates that a very minor change has been made to the assembly C. It indicates that the assembly maybe compatible with previous versions of that assembly 23. Which of the following classes in System.XML namespace gives the tree

Page 96: Đề thi lý thuyết 3 môn C

representation of the XML document, so that we can navigate through the entire document and edit if required? A. XMLValidatingReader B. XmlDocument C. XmlWriter D. XmlReader 24. A .Net component is also referred to as assembly A. False B. True

25. fdf 26. The ___ utility can be used to convert a COM Type Library into a .Net assembly A. TlBDet B. TLBExp C. TLBLib D. TLBImp 27. The TLBExp Utility creates the proxy for the COM Dlls A. False B. True

28. what is a Runtime callable wrapper? A. An object used in .NET B. A component used in .Net C. Runtime error in .Net D. It is the proxy through which .Net interacts with the COM 29. ReadXML() and WriteXML() methods belong to the ____class A. Dataset B. xmlTextWriter C. SqlConnection D. SqlDataAdapter 30. Which statement is true to create a thread A. Thread t = new Thread(new ThreadStart()); B. Thread t = new Thread(); C. Thread t = new Thread(new ThreadStart(CallbackMethodName)); D. Thread t = new Thread(CallBackMethodName); 31. which class in the System.Thread namespace is used to synchronize access to objects? A. Timer B. Thread C. Monitor D. ThreadPool

32. Only the Thread class can be used to create a thread object A. Fasle B. True

Page 97: Đề thi lý thuyết 3 môn C

33. which one of the following statement/s with feference to Shared Assemblies is NOT TRUE? A. The shared assembly must have an identifier which makes it unique across the entire system B. Shared assemblies are the default type of assemblies C. For a shared assembly to be used by many applications there should be no naming clash D. You must generate a new strong name for each and every shared assembly that you wish to create 34. the start method in the Thread class stats immediately the thread execution A. false B. true 35. which of the following is/are not a part of the Assembly? A. GAC utility B. Type Metadata C. MSIL Code D. Resources E. Assembly Metadata 36. Descriptive information in the metadata can be extracted using runtime reflection services A. False B. True

37. fdf

38. one of the overloaded constructors of the XmlTextWriter takes in two parameters; the first being the filename for the XML text file that is to be created and the second is the ____ A. Version No. B. EnvironmentPermission C. Encoding style D. File path

39. Which class will point you towards the innerdata of the XML document? A. XMLReader B. XMLNode C. XMLInner D. XmlWriter 40. identify the sytax of the GetDirectories method of System.IO.Directory class/ A. arr1[] getDirectories(); B. string[] GetDirectories(stringPath); C. void GetDirectories(stringPath); D. string GetDirectories(); 41. Attibutes are stored with the metadata of the element they are associated with A. False B. true

Page 98: Đề thi lý thuyết 3 môn C

42. which statement is FALSE about custom attribute? A. A metadata cannot be extracted by another application B. A custom attirbute class cannot be declared as private C. A custom attibute class should inherit from System.Attributes class 43. err 44. The StreamReader class is the superClass of the class TextReader? A. False B. True

45. The Runtime Callable Wrapper does not contain any form of business logic A. False B. True 46. which of the following properties does the Type class have? (Choose 3) A. IsCOMObject B. IsClass C. IsPublic D. ¬¬IsMethod 47. Which term is used for the data conversion from Com to .Net? A. Marshaled B. Marshalling C. Data-conversion D. Type-casting 48. _____ is a concept which allows only one thread to excusively access particular sections of code at a time A. Thread pooling B. Locking C. Reentrant 49. what is the purpose if the Eixsts method of System.IO.Directory class? A. No such method exists B. It gets the current directory C. It checks whether the given path refers to an existing directory D. It checks whether the directory exists and deletes it/\. 50. when there are no more nodes to be read in the file, the XMLReader class returns___ A. EOF B. 0 C. FALSE D. 1 51. ___ is a mechanism to implement thread management A. Immutable object B. Thread pooling C. Critical section D. Locking 52. Version number of an assembly are stored in the follwing format A. <> 53. The extension of an assembly is ______

Page 99: Đề thi lý thuyết 3 môn C

A. .ddl B. .exe C. .cs D. .dll 54. Which part of the assembly displays the picture file or sound file? A. Type Metadata B. Assembly Metadata C. MSIL Code D. Resources 55. Namespace ___ is mandatory foor using DllImport attribute A. System.Runtime.Diagostics B. Systen.Runtime.InteropServices C. System.Runtime D. System.Dianostics 56. A key pair is created using the ______ utility A. Key.snk B. Key.exe C. Snk.exe D. Sn.exe 57. fdfdfdf 58. For versioning the private assemblies, the CLR simply loads the newst assemblies found in the application directory A. False B. True

59. in order to call a .Net component from a COM client, you need to first register the assembly using the ____ utility A. TlbExp B. RegAsm 60. A portion of code which is accessed by multiple threads at the same time is called ___ A. Immutable object B. Critical section C. Reentrant 61. The information about a class can be found out using ___ A. Reflection B. Delegates C. Assemblies D. Manifest 62. ______ is the Proxy used by .Net to interact with COM. A. Executble Callable Wrapper B. Runtime Callable Wrapper C. Route Callable Wrapper 63. When an object of the COM component is created in a .Net managed environment; how is the object destroyed? A. This issue is addressed by the RCW

Page 100: Đề thi lý thuyết 3 môn C

B. The object is destroyed when the count reaches zero C. The object is destroyed by the CLR 64. Which of the following statements are true? (Choose 2) A. Private assemblies are stored in the same folder as that of an applicaton B. Assemblies can be shared by installing it in the global Assembly Cache C. Private assemblies should not be installled in subfolders below the executables folder D. Private assembies have predefined version policy 65. The ____ attribute enumerator is applied for any class elements A. AttributeTargets.AllClasses B. None of those C. AttributeTargets.All D. AttributeTargets.Class 66. XMLValidatingReader class provides the validation against: A. DTDs schemas B. XML schemas C. XDR schemas D. All of the above E. None of the abov

Comment(0 ý kiến)

Đề thi lý thuyết 4 môn C# (1) (2010-07-01)

Q.1) This feature prevents multiple threads from simultaneously modifying the state of the resource , by including various classes and data types.

A. Parallel execution of code. B. Thread interruption C. Thread Synchronization D. Mutual Exclusion E. Thread Waiting

Q.2) This feature is the mechanism of blocking a thread util some condition becomes true

A. Thread Synchronization B. Join C. Thread Waiting (correct answer)

Q.3) Synchronizes access to objects

Page 101: Đề thi lý thuyết 3 môn C

A. Monitor B. Timer C. ThreadPool

Q.4) Contains operating system-specific objects that wait for access to shared resources.

A. TimeOut B. WaitHandle C. Thread

Q.5) This retrieves a value which indicates whether a thread belongs to the managed thread pool.

A. IsAlive B. ManagedThreadId C. IsThreadPoolThread (your answer) D. ThreadState

Q.6) Retrieves the value of execution status of the current thread.

A. IsAlive B. CurrentThread C. ThreadState

Q.7) Retrieves a value which contains the state of the current thread.

A. CurrentThread B. ThreadState C. IsAlive (correct answer)

Q.8) Priority retrieves or specifies a value which indicates the scheduling priority of a thread.

A. True (your answer) B. False

Q.9) This method blocks the calling thread till the thread ends.

A. Sleep B. Start C. Join (your answer) D. Interrupt

Page 102: Đề thi lý thuyết 3 môn C

Q.10) This method obstructs the current thread for the specified time.

A. Join B. Sleep C. Abort

Q.11) A Thread must be in the Running state before the operating System can schedule it.

A. True (correct answer) B. False

Q.12) The default priority of a thread is:

A. Highest B. Normal (your answer) C. AboveNormal D. Lowest

Q.13) This is a language for retrieving information from a XML Document. is used to navigate through elements and attributes in an xml document.

A. XQuery B. XPath (correct answer) C. SXLT D. SLT

Q.14) An XPath expression are returns: - 3 choices

A. a node set B. a integer value C. a boolean D. a String and a number

Q.15) Steps to add data into an existing XML file. 1. Create a Method to create new element 2. add the element after the last child node. 3. write value to the element. 4. Declare the objects

Page 103: Đề thi lý thuyết 3 môn C

5.Save the file.

A. 1-2-3-4-5 B. 3-1-2-4-5 C. 4-1-2-3-5 D. 4-1-3-2-5 (correct answer)

Q.16) This is an abstract class that provides a cursor model for navigating and editing XMl data.

A. XPath B. XQuery C. XEdit D. XPathNavigator (correct answer)

Q.17) How to declare Attributes:

A. [AttributeName(parameters)] Element_Name(parameter){//Implementation} B. [AttributeName(parameters)]; Element_Name(parameter){//Implementation}

Q.18) This attribute can be used as debugging aid in the C# code.

A. DLLImport B. Conditional (correct answer) C. Obsolete

Q.19) Which statements are true? - 3 choices

A. Custom attributes cannot be applied to more than one programming element B. Attributes are a mechanism of adding metadata to a programming element (your answer) C. Attribute information can not be retrieved from custom attributes D. Descriptive information in the metadata can be extracted using runtime reflection services. (your answer) E. Attributes are stored with the metadata of the element they are associated with. (your answer)

Q.20) Code developed outsite the .net framework.

Page 104: Đề thi lý thuyết 3 môn C

A. DLLImport B. System.Diagnostics C. Unmanaged Code

Q.21) Namespace is mandatory for using DLLImport attribute

A. System.DLLImport B. System.Runtime.InteropServices (correct answer) C. System.Diagnostics

Q.22) Used to invoke unmanaged code in a C# program.

A. Unmanaged Code (your answer) B. Conditional Attribute C. DLLImport Attribute (correct answer)

Q.23) Use as debugging aid in the C# code.

A. Conditional Attribute (correct answer) B. System.Debug C. System.Diagnostics

Q.24) Namespace is mandatory for using the Conditional attribute

A. Conditional Attribute. B. System.Diagnostics (your answer) C. System.Runtime.InteropServices

Q.25) A DLL is a library that contains code and data that can be used by more than one program at the same time.

A. True B. False

Q.26) This is a phrase for complications which arise when working with dynamic link libraries.

A. DLLs

Page 105: Đề thi lý thuyết 3 môn C

B. DLL Hell C. DLLImport

Q.27) These are the building blocks used by the .Net Framework used to solve the versioning and deployment problems posed by the DLLs

A. Assemblies B. Attributes C. XPath D. Custom Attributes

Q.28) This is a collection of information required by the runtime to execute an application.

A. Collection B. Attribute C. DLLs D. Assembly (correct answer)

Q.29) This is deployed with an application and is available only for the application.

A. A public assembly B. A private assembly (correct answer) C. A Shared assembly D. A protected assembly

Q.30) A assembly consists of parts: - 3 choices

A. DLLs B. Assembly Metadata C. Type Metadata D. Dll Hell E. MSIL Code & Resources

Q.31) A namespace can contain one or more assemblies and an assembly can contain one or more namespaces.

A. True (correct answer) B. False

Q.32) Which statements are true with assembly.- 3 choices

Page 106: Đề thi lý thuyết 3 môn C

A. Multiple applications can not implement the same DLL file due to versioning problem B. DLLs use fewer resource (your answer) C. Modular programs cannot be built using Dynamic Link Library (your answer) D. Applications must be self describing so that they are no longer dependent of the registry entries. (your answer)

Q.33) Collection of information existing in binary form in a Portable Executable file or a .Net assembly.

A. Type metadata B. Assembly metadata (correct answer) C. MSIL Code

Q.34) File such as JPEG, text, XML and other types that are used in the application.

A. MSIL Code B. Resource (your answer) C. Multifle Assembly

Q.35) Data present in the assembly and its type.

A. Assembly Metadata B. Type Metadata (correct answer)

Q.36) Compilers convert the source code into an intermediate language.

A. Assembly B. MSIL Code C. Resource

Q.37) The System.IO namespace in .Net does not support stream handling.

A. True B. False (your answer)

Q.38) The class named File is a member of System.IO namespace.

A. True (your answer) B. False

Page 107: Đề thi lý thuyết 3 môn C

Q.39) This class reads primary data types as binary values in a specific encoding.

A. TextReader B. BinaryReader C. FileStream

Q.40) This class provides methods for creating, moving and enumerating through directories and sub-directories.

A. DirectoryInfor B. Directory C. MemberInfor

Q.41) This class provides instance methods for creating, moving and enumerating directories and sub-directories.

A. DirectoryInfor B. Directory C. File

Q.42) This class provides static methods for creating and manipulating files.

A. FileStream B. File C. FileInfor D. FileSystemInfor

Q.43) This class contains methods that are common to file and directory manipulation.

A. Stream B. FileSystemInfor (correct answer) C. FileInfor D. File

Q.44) The TextReader class represents a reader that can read a sequence of characters.

A. True B. False

Page 108: Đề thi lý thuyết 3 môn C

Q.45) This class is used to read and write data to memory instead of a disk.

A. BufferedStream B. MemoryStream C. FileStream D. CrypttoStream

Q.46) This class is not part of the system.IO namsepace, It resides within the System.security.

A. NetWorkStream B. CryptoStream

Q.47) These classes are not part of the System.IO namspace.

A. NetWorkStream (your answer) B. CryptoStream (your answer) C. BufferStream D. MemoryStream

Q.48) This class can be used for operations such as creating, copying, moving, deleting and appending to files.

A. FileStream B. FileInfor (correct answer) C. File D. FileManipulate

Q.49) The FileInfor class is used to create FileStream Object.

A. True (your answer) B. Fasle

Q.50) In Directory class, this method returns a DirectoryInfor object which can be used to work with the newly created directory.

A. CreateDirectoryInfor(); B. CreateDir(); C. CreateDirectory()

Q.51) This method of Directory class is also used to rename the directory.

Page 109: Đề thi lý thuyết 3 môn C

A. Rename(); B. Move(); C. Delete(); D. ReMove();

Q.52) Get the names of sub-directories in a specified directory.

A. GetDirectories B. GetDirectory C. GetCurrentDirectory

Q.53) Returns current working directory of the application.

A. GetDirectoties B. GetCurrentDirectory C. SetCurrentDirectory

Q.54) Which the terms do they belong to Directoryinfo class? - 3 choices

A. FullName B. CreateDirectory() C. Move() D. MoveTo() E. Create()

Q.55) Re-order steps of creating a thread in C#. 1.Define a method inside class. 2. Create constructor. 3. Define a class 4. Create one or more objects of the class in the new class 5.Create one or more Thread objects in the new class 6. Start the execution of the thread.

A. 1-2-3-4-5-6 B. 2-4-5-6-1-3 C. 3-2-1-4-5-6 D. 3-1-4-5-6 (correct answer)

Q.56) Only the Thread class can be used to create a thread object.

A. True

Page 110: Đề thi lý thuyết 3 môn C

B. False

Q.57) A portion of thread which is accessed by multiple threads at the same time.

A. Locking B. Reentrant C. Critical Section (correct answer) D. Thread Pooling

Q.58) This object that does not change its state after it is create.

A. Thread object B. Immutable object (correct answer) C. pool object

Q.59) This method which id thread - safe

A. Locking B. Interrupt C. Reentrant (correct answer)

Q.60) Which statements are true?

A. COM has only DCOM as its technology B. COM permits reuse of code across different environments. C. GUID is referred when COM or DCOM object is registered D. COM combines subsystems to form one large system. E. COM uses com-capable tool during the implementation of each subsystem.

Comment(0 ý kiến)

Đề thi lý thuyết môn PCS - new (2010-09-09)

Page 111: Đề thi lý thuyết 3 môn C

1.Which of the following statement about C# varialble is incorrect ? A. A variable is a computer memory location identified by a unique name B. A variable's name is used to access and read the value stored in it C. A variable is allocated or deallocated in memory during runtime D. A variable can be initialized at the time of its creation or later

2. The.……….types feature facilitates the definition of classes ,structures and interfaces over multiple files . A. anonymous B. partial C. named D. unamed

3. The....………....class is a variable-length array that can dynamically increase or decrease in size A. ArrayList B. Stack C. Queue D. SortedList

4. The.………………...interface defines methods to control the different generic collections. A. ICollection B. IDictionary C. IEnumerator D. Ilist

5. The default capacity of an ArrayList class is..... A. 08 B. 16 C. 24 D. 32

6. in C# ...…………………….are created using delegates A. exceptions B. events C. synchronization D. threads

7. Which of the following code declare the delegate Calculation with the return type and the parameter types as integer ? A. public delegate int Calculation(int numOne,int numTwo); B. pulic delegate Caculation(int numOne,int numTwo); C. delegate int Caculation(int numOne,int numTwo); D. delegate Caculation(int numOne,int numTwo);

Page 112: Đề thi lý thuyết 3 môn C

8. The.......constructor initialises an object of the ArrayList class with the specified initial capacity as the parameter . A. ArrayList(String s) B. ArrayList(ICollection) C. ArrayList() D. ArrayList(int)

9. Which of the following statements about the different data types in C# are correct? A. Value type variables store actual value and are stored on the heap. B. Reference type variables store memory address of other variables in a stack . C. Both, value and reference type variables can be built in or user defined data types. D. int and class are examples of value and reference type variables respectively.

10. Which piece of code display a float value as string ? A. Float flotNum = 500.25F; string stNum = flotNum.ToString(); Console.WriteLine(stNum); B. float flotNum = 500.25F; string stNum = flotNum.ToString(); Console.WriteLine(stNum); C. float flotNum = 500.25F; String stNum = flotNum.ToString(); Console.WriteLine(stNum); D. float flotNum = 500.25F; string stNum = flotNum.tostring(); Console.WriteLine(stNum);

11. An ...…….method is created when you instantiate or reference a delegate with a block of ... code. A. anonymous,named B. named,anonymous C. anonymous,unnamed D. unnamed,anonymous

12. The........…...exception is thrown when the stack runs out of space while the.….......exception is thrown when the result of an arithmetic,casting or conversion operation is larger in size than the destination object or variable. A. OverFlowException, OutOfMemoryException B. OutOfMemoryException, NullReferenceException C. NullReferenceException, StackOverFlowException D. StackOverflowException, OverflowException

Page 113: Đề thi lý thuyết 3 môn C

13. What is the output of the following code ? int num =5; while(num>0) { if(num>4) { Console.WriteLine(num+""); } --num if(num--= =4) { Console.WriteLine("(0)",num); } if(num==3) { Console.WriteLine("{0}",num); } num--; } A. 532 B. 533 C. 542 D. 544

14. Which of the following statements about delegates are correct ? A. Delegates are objects that contains references to methods that need to be invoked . B. Delegates can be used to call any method identified during complication or runtime. C. Delegates ,when invoked at runtime,execute the method identified at compile time. D. Delegates can be associated with methods provided they have the same return type and parameter type.

15. Managing memory and verifying code safety are functionalities of..……………...... A. Common Language Runtime B. .Net Framework Class Library C. Common Language Specification D. Common Type System

16. Restriction or constraints can be applied to type parameters by using the......keyword . A. select B. from C. where

Page 114: Đề thi lý thuyết 3 môn C

D. return

17. Which of the following statements about the different operator are correct ? A. The Addition operator performs concatenation of strings if the operands are strings B. The Boolean inclusive OR operator returns true if at least one the expression is true C. The Conditional OR operator evaluates the second expression only if the first is true D. The Relational operators return a boolean value depending on the comparison being made

18. Which of the following statements about the partial class are correct ? A. Partial classes are the only types in C# that support partial definitions B. Partial classes can be defined over multiple locations to store different members C. Partial classes allow storage of private members in one file and public in another D. Partial classes allow multiple developers to work on separate sections simultaneously

19. Which of the following statements about System.Collections.Generic namespace classes are correct ? A. The List class provides a generic collection of items that can be dynamically resized B. The LinkedList implements the doubly linked list by storing elements in it

C. The Queue provides a generic collection that follows the First-In-First-Out principle D. The Dictionary provide a generic collection of sorted key and value pairs

20. The ......………...class is a combination of the.………......and...…………….....classes. A. Hashtable,ArrayList,SortedList B. Hashtable,SortedList,Dictionary C. SortedList,ArrayList,Dictionary D. SortedList,Hashtable,ArrayList

21. Which of the following statements about the defferent types of C# statements are correct ? A. Selection statements help transfer the flew from one block to another in the program. B. Iteration statements help you to repeatedly execute a block of code within program . C. Jump statements transfer control after they check whether a paricular

Page 115: Đề thi lý thuyết 3 môn C

condition is true or false D. Exception handling statements manage situation that hinder the normal execution of the program.

22. The........method of the ArrayList class copies the elements of a list to an array while the........method also copies elements of a list to an array of type Object. A. Contains,TrimToSize B. CopyTo,ToArray C. TrimToSize,Contains D. ToArray,TrimToSize

23. Which of the following statements about constraints on type parameters are correct ? A. The T:struct specifies that the type parameter must be of a value type only. B. The T:new() specifies that the type parameter must be of a reference type such as a class,interface or a delegate C. The T: specifies that the type parameter must be a parent class or its successor. D. The T: specifies that the type parameter must be an interface or should inherit an interface.

24. Which of the following statements about generic methods are correct ? A. Generic methods process values whose data types are known only when they are accessed B. Generic methods are declared with the generic type parameter list enclosed within angular. C. Generic methods can be declared within generic or non generic class declaration. D. Generic method bodies ,when declared within a non-generic class ,refer to the type parameters of the method and class.

25. Can you re-arrange the steps given below to implement delegates in C# ? A. Declare a delegate B. Call method using the delegate object C. Create method to be referenced by delegate D. Instantiate the delegate

A. A B C D B. A C D B C. A D C B D. A B D C

26. The SortedList class behaves like an ......if you access its elements based

Page 116: Đề thi lý thuyết 3 môn C

on their index number otherwise it behaves like a.......... A. array,hash table B. hash table,heap C. heap,queue D. queue,array

27. Which of the following statements about generics are correct ? A. Generic are data structures that guard against reuse of defined C# data type functionalities. B. Generic allow you to reuse the code in a safe manner without casting or boxing. C. Generics are parameterized data structures that can work with reference types only. D. Generics always accept a type parameter,which is a placeholder for the required date type.

28. Which of the following keywords are associated with iteration statements? A. case B. foreach C. switch D. while

29. Which of the following statements about C# are correct ? A. C# applications can easily use or integrate code written in other .NET languages. B. C# allows use of uninitialized variables as well as checks the overflow of types. C. C# can be used to develop both,simple standalone and distributed application. D. C# applications are easy to deploy because of its support for XML and SOAP.

31. A....………...is a set of items of same or different data types. A. array B. event C. collection D. list

32. The.........property of the System.Exception class returns the Exception instance that caused the current exception. A. Message B. Source C. StackTrace D. InnerException

Page 117: Đề thi lý thuyết 3 môn C

33. Exception thrown due to arithmetic operations or null object reference are...........exceptions. A. application-level B. system-defined C. system-level D. user-defined

35. Exceptions thrown due to failure in database connection or network connection are examples of.........exceptions A. application-level C. system-defined D. system-level C. user-defined

36. The...….....fields are accessible by other classes but.…….....fields are accessible only by the class in which they are declared. A. public,private B. private,protected C. protected,internal D. internal,public

37. The....……...interface supports simple iteration over elements a generics ? A. ICollection B. IDictionary C. IEnumerator D. Ilist

38. The.........exception is thrown when a value is assigned null object . A. OverflowException B. OutOfMemoryException C. NullReferenceException D. StackOverFlowException

39. Which of the following statements about delegates in C# are correct? A. A delegate can accept a block code as a parameter. B. A delegate can invoke one method at a time. C. A delegate can encapsulate static methods. D. A delegate is declared using the delegate keyword

40. ........allow you to reuse a code for different data types. A. IDictionary B. LinkedList C. Inheritance

Page 118: Đề thi lý thuyết 3 môn C

D. Generics

41. Which of the following statements about exceptions are correct ? A. The System.Exception class is the base class that allows you to handle all exception. B. The System.Exception class contains methods that cannot be inherited by other exception classes. C. The System.Exception class can be inherited directly or indirectly by all other exception. D. The System.Exception class contains properties that are common to all exceptions.

42. An....…………..method is an inline nameless block of code that can be passed as a delegate parameter ? A. anonymous B. named C. partial D. unnamed

Comment(0 ý kiến)

Đề thi lý thuyết +đáp án môn PCS _2 (2010-07-17)

21. What is the output of following C# code ? Class AClass { sbyte aField ; public AClass(sbyte aField) { this.aField = aField; System.Console.Write(aField); } } class MainClass { static void Main(){} static MainClass() { First = new AClass(5); } AClass Third = new AClass(9);

Page 119: Đề thi lý thuyết 3 môn C

static AClass First = null; static AClass Second = new AClass(- 2); } Select answer : 1. 5-2 2. 5-29 3. -25 (*) 4. -259 5. -295

Answer: 3

22. Which operating system has the .NET Framework and Common Language Runtime(CLR) natively installed? Select answer : 1. Windows .NET Enterprise Servers 2. Windows XP Professional 3. Windows XP Home Edition 4. Windows 9x 5. Windows 2000

Answer: 2

23. Whether the following code will execute perfectly or not? Static void Main(string[] args) { int i = 10 ; try { Console.Write(“I= ”+ i); } catch(Exception ex) { Console.WriteLine(ex.Message); } finally { return; } } Select answer : 1. yes 2. No

Answer: 1 24. Choose the correct differentces between a class and a structure from the

Page 120: Đề thi lý thuyết 3 môn C

following Select answer : 1. Classes are reference types and structures are value types 2. Classes are value types and structures are reference types 3. The instance data for classes is allocated on heap and that of structures is allocated on stack 4. 1 &3 5. 2&3

Answer: 4

25. Which of the following is a valid statement ? Select answer : 1. I = Integer.Parse(S)’Where I is an integer and S is a string 2. I = Parse(S)’Where I is an integer and S is a string 3. S = Parse(I)’Where I is an integer and S is a string 4. None

Answer: 1

26. The implicit conversion of value types to reference types is called Select Answer : 1. Parsing 2. Boxing 3. Buffering 4. None

Answer: 2

27. When creating an array of reference types , declaring and initializing an array implies Select answer : 1. an array is created that is filled with members of that type 2. an array of null references is created that can point to that type 3. array of new object is created 4. None of the above

Answer: 2

28. What is the output of following C# code? class MainClass { static long afield = 1212; static MainClass() { System.Console.Write(aField); }

Page 121: Đề thi lý thuyết 3 môn C

MainClass() { aField = 1000; System.Console.Write(aField); } static void Main() { } } Select answer : 1. 1212 2. 1000 3. No output 4. Syntax Error[Class MainClass already defines a member ‘MainClass()’] 5. Syntax Error [No executable statements in entry point ‘Main()’]

Answer: 1

29. What is the output of following C# code ? Class MainClass { static MainClass() { System.Console.Write(“Static ”); } public MainClass() { System.Console.Write(“Instance”); } class AClass { static void Main() { new MainClass(); } } Select answer : 1. Syntax Error [ambiguous call’static MainClass()’ and ‘MainClass()’] 2. Instance 3. Static 4. Instance Static 5. Static instance

Answer: 5

30. What is the output of following C# code?

Page 122: Đề thi lý thuyết 3 môn C

class MainClass { static void Main() { int i = 10 ; uint j =2 ; i = i + j; System.Console.Write(i); } } Select Answer : 1. Throws ‘InvalidCastException’ 2. 12 3. Syntax Error[Cannot implicitly convert type ‘long’ to ‘int’] 4. Syntax Error [Cannot implicitly convert type ‘int’ to ‘uint’] 5. Syntax Error [Cannot implicitly convert type ‘uint’ to ‘int’]

Answer: 3

31. What is the C# equivalent of System.Single? Select answer : 1. float(16 -bit) 2. float(32 -bit) 3. float(64 - bit) 4. float(128 -bit) 5. decimal(128 - bit)

Answer: 2

32. Which data type has maximum level of precision? Select answer : 1. System.Float 2. System.Single 3. System.Decimal 4. System.Double 5. System.Real

Answer: 3

33. What is the default value of System.Boolean? Select answer : 1. false in C# (False in VB.NET ) 2. true in C# (True in VB.NET) 3. No default value 4. 0 5. null in C#(Nothing in VB.NET)

Page 123: Đề thi lý thuyết 3 môn C

Answer: 1

34. What is the output of following C# code? using System; class MainClass { static void Main() { Console.Write(“{0}{1}{2}{3}”,true^true,true^false, false^true,false^false); } } Select answer: 1. True false false True 2. False True True True 3. True False False False 4. True True True False 5. False True True False

Answer: 5

35. Which of A,B,C,D,E is/are wrong ? A. static int Main(string []args) { //block of statements return (0); } B. static void Main() { //block of statements return ; } C. static int Main() { //block of statements return 1; } D. static uint Main(string []str) { //block of statements return 0;

Page 124: Đề thi lý thuyết 3 môn C

} E. Static public void Main(System.String [] s) { //block of statements } Select answer : 1. D& E 2. D 3. A& C 4. B 5. A&D

Answer: 2

36. Arrays in C# are of which type Select answer : 1. Value type 2. Reference type

Answer: 2

37. Advantages of writing a managed code application instead of unmanaged code application Select answer : 1. Automatic garbage collection 2. Memory management 3. Support for versioning and Security 4. None of the first above three answer 5. All of the first above three answer

Answer: 5

38. In C# single line comments are implemented by Select answer: 1. !—Data 2. //Data 3. /*Data 4. –Data

Answer: 2

39. In C# multiline comments are implemented by Select answer : 1. 2. //Data//

Page 125: Đề thi lý thuyết 3 môn C

3. /*Date*/ 4. Data-->

Answer: 3

40. A null value is an Empty value Select answer: 1. True 2. fasle 3. Not a relevant comparison

Answer: 2

41. The Basic Object – Oriented Concepts are Select Answer : 1. Abstraction, Encapsulation, OverLoading, Overriding 2. Abstraction, Encapsulation, Overriding, Inheritance 3. Abstraction, Encapsulation, Polymorphism, Inheritance 4. Abstraction, Encapsulation, OverLoading, Inheritance

Answer: 3

42. We can add new element to an array name MyArray by : Select answer : 1. MyArray.Add(new value) 2. MyArray[MyArray.Length] = new value 3. Cannot do that 4. MyArray[MyArray.Length -1] = new value

Answer: 3

43. In C#, Default access modifier for class and fields is Select answer : 1. public 2. private 3. internal 4. protected

Answer: 2

44. A character in C# is an Select Answer : 1. signed 32 bit integer 2. unsigned 16 bit integer

Page 126: Đề thi lý thuyết 3 môn C

3. signed 16 bit integer 4. Unsigned 32 bit integer

Answer: 2

45. What will be the output of the following snippet code? int i =12 ; object obj = i; i = 34; Console.WriteLine(obj); 1. 12 2. 34 3. Compile error 4. Runtime it caught Exception

Answer: 1

46. Identifiers in C# can be the same as reserved keywords [True/False] Select answer : 1. False 2. True, you do this by prefixing the identifier with an @ symbol 3. True, you do this by suffixing the identifier with an @ symbol 4. True, you do this by suffixing the identifier with an & symbol

Answer: 2

47. Which of the following are value types? (Choose all that apply.)

A. Decimal B. String C. System.Drawing.Point D. Integer

Answers: A, C, and D 48. You pass a value-type variable into a procedure as an argument. The procedure changes the variable; however, when the procedure returns, the variable has not changed. What happened? (Choose one.)

A. The variable was not initialized before it was passed in. B. Passing a value type into a procedure creates a copy of the data. C. The variable was redeclared within the procedure level. D. The procedure handled the variable as a reference.

Answer: B

Page 127: Đề thi lý thuyết 3 môn C

49. With strict conversions enabled, which of the following would allow an implicit conversion? (Choose all that apply.)

A. Int16 to Int32 B. Int32 to Int16 C. Int16 to Double D. Double to Int16 Answers: A and C

Comment(0 ý kiến)