1. Trang chủ
  2. » Công Nghệ Thông Tin

Câu hỏi trắc nghiệm C#, .NET framework bằng tiếng anh có đáp án

100 5,6K 32

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 100
Dung lượng 2,14 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Cau 1. A local variablea. Can be used anywhere in the programb. Is declared within a methodc. Must accept a classd. Represent a class objectCau 2. An instance variablea. Is an object of a classb. Represents an attribute of an objectc. Is a method of a classd. A and CCau 3. Private Button print = new button();a. Creates a button controlb. Initializes a button controlc. Instantiates button controld. A and Be. A and CCau 4. An instance methoda. Represents the behavior of an objectb. Represents the attribute of an objectc. Represents another classd. A and B

Trang 1

Cau 1 A local variable

a Can be used anywhere in the program

b Is declared within a method

c Must accept a class

d Represent a class object

Cau 2 An instance variable

a Is an object of a class

b Represents an attribute of an object

c Is a method of a class

d A and C

Cau 3 Private Button print = new button();

a Creates a button control

b Initializes a button control

c Instantiates button control

d A and B

e A and C

Cau 4 An instance method

a Represents the behavior of an object

b Represents the attribute of an object

c Represents another class

d A and B

Cau 5 A Constructor

a Is used to create objects

b Must have the same name as the class it is declared within

c Maybe overloaded

d B and C

e All of the above

Cau 6 Class Test: Form{}

a Creates the class Test: Form

b Creates the class Test that inherits the class Form

c Creates the class form that inherits the class Test

d A and B

Cau 7 A variable declared inside a method is called a …

Trang 2

Cau 10 In the body of a method, C# uses the variable named … to refer to the current

object whose method is being

c Code to force users action

Cau 13 A delegate defines

a A Wahsington representative

b A class that encapsulates methods

Trang 3

c A means of passing arrays into methods

d A substiue for an inherited method

Cau 14 Is it possible to pass methods as arguments for other

Cau 16 What is the proper header for a class that intends to use

a Class MyClass IFace

b Class MyClass ; IFace

c Class MyClass : IFace

d Class MyClass {IFace}

e Class MyClass(IFace)

Cau 17 In order for a class to use an interface, it must

a Inherit the properties of interface

b Contain the same methods as the interface

c Create an interface objects

d A and B

e All of the above

Cau 18 Every class directly or indirectly extends the … class

a System

b Object

c Drawing

d Console

Cau 19 The concept of composition specifies that you can

a Compose good code with C#

b Compose C# projects with different objects

c Reduce errors by remaining composed during programming

d All of the above

Cau 20 Polymorphism occurs when the methods of the child

a Override the parent class methods but maintain the implementation

Trang 4

b Maintain the same return type and arguments as the parent class, but implement

Cau 23 Methods that are declared abstract in the base class must show implementation

at the time of declaration

a True

b False

Cau 24 The code public class B : A {}

a Difines a class that inherits all the methods of A

b Defines a class inherits the public and protected methods of A only

c Errors

d A and B

Cau 25 Assuming that public class B : A { public B(int i)) :base (i) {}} compiles and

runs correctly, what can we conclude about the constructors in the class A?

a One constructor takes an argument of type i

b There is only a default constructor

c One constructor takes an arguments of the type int

Trang 5

Cau 29 An abstract class

a May contain instance variables

b May contain constructors

c May extend another class

d A and B

e All of the above

Cau 30 A … block enclose the code that could throw an exception

Cau 31 A Thread is:

a An object that allows computer multitasking

b An object that wraps itself with other threads

c A deprecated object that is no longer used

Cau 32 Synchronization is:

a The delaying of a thread until there is sufficient memory and work to keep it up

b Making every thread start and end at the same time

c Make each thread do the same thing

d Have each thread start at the same time but not necessarily finish together

e Wait until the required resources, that are used by other threads become available

Cau 33 In C# Thread.Sleep(time) measures time in:

a Seconds

b Miliseconds

Trang 6

c Nanoseconds

d All of the above

Cau 34 When a thread returns from a WaitSleepJoin or Suspended state it returns to the:

d None of the above

Cau 36 The way of returning a thread from s suspended state is:

a Pulse

b PulseAll

c Resume

d ReStart

Cau 37 In order to lock/unlock an object use the

a Lock an Unlock methods

b Enter and Exit methods

c Close and Open methods

d Close and Allow methods

Cau 38 Class String and the Char structure found the:

a System.Strings namespace

b System.Text namespace

c System.Chars namespace

d System namespace

Cau 39 A String literal is a:

a Only contains one character

b Contains numbers rather than letters

c Sequence of characters in double quotation marks

d Contains exactly its variable name and nothing else

Cau 40 To create a string literal exclude escape sequence, use:

Trang 7

Cau 42 If an IndexofAny method is passed an array of characters it:

a Finds the first occurrence of each letter in the string

b Searches for the first occurrence of any of the characters in the string

c Will search for the first occurrence of the sequence of characters

d Operator overloading and method calls

Cau 44 If two StringBuilder objects contain the same string then

a They represent the same meory location

b The are two different objects

c If one changes, so will the other

d None of the above

Cau 45 The proper way to convert a string to all lowercase is:

a String = string.ToLower(string);

b ToLower(string);

c string.ToLower();

d string.ToLower(string);

Trang 8

ASP.NET

Cau 1 In ASP.NET what does the following return

<%

Respone.Write(System.Environment.WorkingSet.ToString())

a gives the memory working set

b return Null value

c Gives Error

d None of the Above

Cau 2 Which of the following denote page code model in ASP.NET?

a Single-file

b Code-bihind

c Both A and B

d None of the above

Cau 3 Which of the following denote the web control associated with Table control

function of ASP.NET?

a DataList

b ListBox

c TableRow

d All the Above

Cau 4 Which of the following denote New Data-bound Controls used with ASP.NET?

a GridView

b FormView

c SplDataSource

d Both A and B

e All the Above

Cau 5 In ASP.NET if you want to allows page developers a way to specify static

connections in a content page then the class used is?

a WebPartManger

b ProxyWebPartManger

c System.Activator

d None of the Above

Cau 6 On which of the operating system bolow ASP.NET can run?

a Winsows XP Professional

Trang 9

b Windows 2000

c Both A and B

d None of the Above

Cau 7 There is a requirement as follows:

A client side already has 25 COM objects and if the requirement is to add a 26th

function that must exists only for NET object without affecting the existing one how

to achieve the above?

a By CCW

b By RCW

c By RCA

d None of the Above

Cau 8 If a developer of ASP.NET defines style information in a common location Then

that location is called as?

a Master Page

b Theme

c Customization

d None of the Above

Cau 9 In ASP.NET if one uses Windows authentication the current request attaches an

object called as?

a Serialization

b WindowsPrincipal

c WindowDatset

d None of the Above

Cau 10 Forms based authentication is otherwise called in ASP.NET as Cookie

Authentication because Forms authentication uses cookies to allow applications to track users throughout their visit?

a Cookie Authentication

b Passport Authentication

c Windows Authentication

d None of the Above

Cau 11 Which of the following is true about session in ASP.NET?

a ASP.NET automatically delete sessions after configurable timeout interval

b Programmers has to take care of detete sessions after configurable timeout interval

c The default time interval is 5 minutes

Trang 10

d None of the Above

Cau 12 What model does ASP.NET request processing is based on?

d None of the above

Cau 14 In ASP.NET page framework an automatic way to associate page events and

methods is?

a AutoEventWireup attribute of the Page directive is set to true

b AutoEventWireup attribute of the Page directive is set to False

c It is not possible to set automatically page events and methods

d None of the Above

Cau 15 In ASP.NET if one wants to set the focus on a particular control?

a Call SETFOCUS

b Call SETCONTROL

c Call FOCUS method

d None of the above

Cau 16 A developer wanted to achieve graphics in his display using ASP.NET which of

the following web controls are available in ASP.NET to achieve the above?

a AdRotator

b LinkButton

c Both A and B

d None of the Above

Cau 17 Which of the following denote value that can be taken by Cache-Control of

Trang 11

Cau 18 I have an ASP.NET application I have a page loaded from server memory At

this instance which of the following methods gets fired?

a PreRender()

b Load()

c Unload()

d None of the Above

Cau 19 Setting the following properties for object in ASP.NET results in

Response.Buffer = True Response.ExpiresAbsolute = Now ().Subtract(New

TimeSpan(1,0,0,0)) Response.Expires = 0 Respose.CacheControl = ‘no-cache’

a The session expires

b Clears the buffer area

c Avoid page to be cached

d None of the Above

Cau 20 If one uses ASP.NET configuration system to restrict access which of the

following is TRUE?

a The access is restricted only to ASP.NET files

b The access is restricted only to static files and non-ASP.NET resources

c Both A and B

d None of the Above

Cau 21 ASP.NET separetes the HTML output from program logic using a feature named

as?

a Exception

b Code-behind

c Code-front

d None of the above

Cau 22 An organization has developed a web service in which the values of the forms

are validated using ASP.NET application Suppose this web service is got and used by a customer then in such a scenario which of the following is TRUE?

a Such a situation cannot happen at all

b The customer must be having technology that run ASP

c The customer can run on any platform

d None of the above

Cau 23 Which of the following is used to write error message in event Log File?

a System.Diagnostics

Trang 12

b System.EnterpriseServices

c System.Data

d None of the above

Cau 24 The feature in ASP.NET 2.0 that is used to fire a normal postback to a different

page in the application is called?

a Them

b Cross Page Posting

c Code-front

d None of the above

Cau 25 Which of the following can be used to debug NET application?

a Visual Studio NET

b Runtime Debugger

c Systems.Diagnostics classes

d All the above

Cau 26 In ASP.NET if one wants to maintain session then which of the following is

used?

a In-process storage

b Session State Service

c Microsoft SQL Server

d All the above

Cau 27 The control used in ASP.NET to display information form data set but with

better formatting and editing behavior is?

a Panel

b Button

c DataList

d None of the above

Cau 28 If in an ASP.NET application one want to create http handlers which of the

interface is used?

a IHttppHandlerFactory

b Handler

c Pipeline

d None of the above

Cau 29 The GridView control in ASP.NET has which of the following features?

a Automatic data binding

Trang 13

b Automatic paging

c Both A and B

d None of the above

Cau 30 In ASP.NET application the Global.asax file lie in which directory?

1 Which of the following statements are TRUE about the NET CLR?

1 It provides a language-neutral development & execution environment

2 It ensures that an application would not be able to access memory that it is not authorized to access

3 It provides services to run "managed" applications

4 The resources are garbage collected

5 It provides services to run "unmanaged" applications

2 Which of the following are valid NET CLR JIT performance counters?

1 Total memory used for JIT compilation

2 Average memory used for JIT compilation

3 Number of methods that failed to compile with the standard JIT

4 Percentage of processor time spent performing JIT compilation

5 Percentage of memory currently dedicated for JIT compilation

3 Which of the following statements is correct about Managed Code?

A Managed code is the code that is compiled by the JIT compilers

Trang 14

B Managed code is the code where resources are Garbage Collected

C Managed code is the code that runs on top of Windows

D Managed code is the code that is written to target the services of the CLR

E Managed code is the code that can run on top of Linux

4 Which of the following utilities can be used to compile managed assemblies into processor-specific native code?

E. ildasm

5 Which of the following are NOT true about NET Framework?

1 It provides a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely

2 It provides a code-execution environment that minimizes software deployment and versioning conflicts

3 It provides a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party

4 It provides different programming models for Windows-based applications and Web-based applications

5 It provides an event driven programming model for building Windows Device Drivers

A 1, 2

B 2, 4

C 4, 5

D 1, 2, 4

6 Which of the following components of the NET framework provide an

extensible set of classes that can be used by any NET compliant programming language?

A. .NET class libraries

B. Common Language Runtime

Trang 15

C. Common Language Infrastructure

D. Component Object Model

E. Common Type System

7 Which of the following jobs are NOT performed by Garbage Collector?

1 Freeing memory on the stack

2 Avoiding memory leaks

3 Freeing memory occupied by unreferenced objects

4 Closing unclosed database collections

5 Closing unclosed files

A 1, 2, 3

B 3, 5

C 1, 4, 5

D 3, 4

8 Which of the following NET components can be used to remove unused

references from the managed heap?

A. Common Language Infrastructure

C Garbage Collector

D. Class Loader

9 Which of the following statements correctly define NET Framework?

A It is an environment for developing, building, deploying and executing Desktop Applications, Web Applications and Web Services

B It is an environment for developing, building, deploying and executing only Web Applications

C It is an environment for developing, building, deploying and executing Distributed Applications

D It is an environment for developing, building, deploying and executing Web

Services

Trang 16

E It is an environment for development and execution of Windows applications

13 Which of the following statements is correct about the NET Framework?

A .NET Framework uses DCOM for achieving language interoperability

B .NET Framework is built on the DCOM technology

Trang 17

C .NET Framework uses DCOM for making transition between managed and unmanaged code

D .NET Framework uses DCOM for creating unmanaged applications

E .NET Framework uses COM+ services while creating Distributed

Applications

15 Which of the following benefits do we get on running managed code under CLR?

1 Type safety of the code running under CLR is assured

2 It is ensured that an application would not access the memory that it is not authorized to access

3 It launches separate process for every application running under it

4 The resources are Garbage collected

A. Only 1 and 2

B. Only 2, 3 and 4

C. Only 1, 2 and 4

D. Only 4

E All of the above

16 Which of the following security features can NET applications avail?

1 PIN Security

2 Code Access Security

3 Role Based Security

Trang 18

D 3, 4

17 Which of the following jobs are done by Common Language Runtime?

1 It provides core services such as memory management, thread management, and remoting

2 It enforces strict type safety

3 It provides Code Access Security

4 It provides Garbage Collection Services

A Only 1 and 2

B Only 3, 4

C Only 1, 3 and 4

D Only 2, 3 and 4

E All of the above

18 Which of the following statements are correct about a NET Assembly?

1 It is the smallest deployable unit

2 Each assembly has only one entry point - Main(), WinMain() or DLLMain()

3 An assembly can be a Shared assembly or a Private assembly

4 An assembly can contain only code and data

5 An assembly is always in the form of an EXE file

A 1, 2, 3

B 2, 4, 5

C 1, 3, 5

D 1, 2

19 Which of the following statements are correct about JIT?

1 JIT compiler compiles instructions into machine code at run time

2 The code compiler by the JIT compiler runs under CLR

3 The instructions compiled by JIT compilers are written in native code

4 The instructions compiled by JIT compilers are written in Intermediate

Language (IL) code

5 The method is JIT compiled even if it is not called

A 1, 2, 3

B 2, 4

C 3, 4, 5

D 1, 2

Trang 19

20 Which of the following are parts of the NET Framework?

1 The Common Language Runtime (CLR)

2 The Framework Class Libraries (FCL)

3 Microsoft Published Web Services

4 Applications deployed on IIS

E All of the above

Câu hỏi Classes and Objects

1 Which of the following statements is correct about the C#.NET code snippet given below?

class Student s1, s2; // Here 'Student' is a user-defined class

A Contents of s1 and s2 will be exactly same

B The two objects will get created on the stack

C Contents of the two objects created will be exactly same

D The two objects will always be created in adjacent memory locations

E We should use delete() to delete the two objects from memory

2 Which of the following statements is correct about the C#.NET code snippet given below?

class Sample

{

private int i;

public Single j;

Trang 20

private void DisplayData()

A j cannot be declared as public

B DisplayData() cannot be declared as private

C DisplayData() cannot access j

D ShowData() cannot access to i

E There is no error in this class

3 Which of the following statements are correct?

1 Instance members of a class can be accessed only through an object of that class

2 A class can contain only instance data and instance member function

3 All objects created from a class will occupy equal number of bytes in memory

4 A class can contain Friend functions

5 A class is a blueprint or a template according to which objects are created

4 Which of the following statements is correct?

A Procedural Programming paradigm is different than structured programming paradigm

B Object Oriented Programming paradigm stresses on dividing the logic into

smaller parts and writing procedures for each part

C Classes and objects are corner stones of structured programming paradigm

D Object Oriented Programming paradigm gives equal importance to data and the procedures that work on the data

E C#.NET is a structured programming language

5 Which of the following is the correct way to create an object of the class Sample ?

1 Sample s = new Sample();

Trang 22

C 10 5.400000

7 The this reference gets created when a member function (non-shared) of a class is called

8.

Which of the following statements are correct?

1 Data members ofa class are by default public

2 Data members of a class are by default private

3 Member functions of a class are by default public

4 A private function of a class can access a public function within the same class

5 Member function of a class are by default private

public int index;

public int[] arr = new int[10];

Trang 23

Sample s = new Sample();

A s.index = 20 will report an error since index is public

B The call s.fun(1, 5) will work correctly

C Sample.fun(1, 5) will set a value 5 in arr[ 1 ]

1 It will create an object called sample

2 It will create a nameless object of the type sample

3 It will create an object of the type sample on the stack

4 It will create a reference c on the stack and an object of the type sample on the heap

5 It will create an object of the type sample either on the heap or on the stack

depending on the size of the object

Trang 24

A This is a perfectly workable code snippet

B Since int is a primitive, we cannot use new with it

C Since an int is a primitive, we cannot call the method ToString() using it

D i will get created on stack, whereas j will get created on heap

E Both i and j will get created on heap

12 Which of the following statements are correct about the this reference?

1 this reference can be modified in the instance member function of a class

2 Static functions of a class never receive the this reference

3 Instance member functions of a class always receive a this reference

4 this reference continues to exist even after control returns from an instance member

Trang 25

static void Main(string[ ] args)

1 All objects of Sample class will always have exactly same data

2 Objects of Sample class may have same or different data

3 Whether objects of Sample class will have same or different data depends upon a Project Setting made in Visual Studio.NET

4 Conceptually, each object of Sample class will have instance data and instance member functions of the Sample class

5 All objects of Sample class will share one copy of member functions

Trang 26

A The code will not compile since we cannot explicitly use this

B Using this in this program is necessary to properly set the values in the object

C The call to SetData() is wrong since we have not explicitly passed the thisreference to

it

D The definition of the this reference SetData() is wrong since we have not explicitly collected

16 Which of the following statements is correct about classes and objects in C#.NET?

B Since objects are typically big in size, they are created on the stack

Câu hỏi Interfaces

1 Which of the following statements is correct about the C#.NET code snippet given

Trang 27

D MyClass is an abstract class

E The definition of fun1() in class MyClass should be void IMyInterface.fun1()

3 A class implements two interfaces each containing three methods The class contains

no instance data Which of the following correctly indicate the size of the object created from this class?

4 Which of the following statements is correct about an interface used in C#.NET?

Trang 28

B In a program if one class implements an interface then no other class in the same program can implement this interface

5 Which of the following statements is correct about Interfaces used in C#.NET?

A All interfaces are derived from an Object class

C All interfaces are derived from an Object interface

6 Which of the following statements is correct about an interface used in C#.NET?

D An interface can contain static data

E Multiple interface inheritance is not allowed

7 Which of the following statements is correct about an interface?

interface

8 Which of the following statements are correct about an interface in C#.NET?

1 A class can implement multiple interfaces

2 Structures cannot inherit a class but can implement an interface

3 In C#.NET, : is used to signify that a class member implements a specific interface

4 An interface can implement multiple classes

Trang 29

5 The static attribute can be used with a method that implements an interface declaration

Trang 30

}

10 Which of the following statements is correct?

A When a class inherits an interface it inherits member definitions as well as its

implementations

public as well as static

11 Which of the following statements are correct about an interface used in C#.NET?

1 An interface can contain properties, methods and events

2 The keyword must implement forces implementation of an interface

3 Interfaces can be overloaded

4 Interfaces can be implemented by a class or a struct

5 Enhanced implementations of an interface can be developed without breaking existing code

Trang 31

A Class MyClass is an abstract class

E The compiler will report an error since the interface IMyInterface is only partially implemented

14 Which of the following statements is correct about the C#.NET code snippet given

Trang 32

A Properties cannot be declared inside an interface

15 Which of the following is the correct way to implement the interface given below?

Trang 33

Câu hỏi Operators

1 Which of the following are the correct ways to increment the value of variable a by 1 ?

1 ++a++;

2 a += 1;

3 a ++ 1;

4 a = a +1;

Trang 35

A A value 0 will be assigned to d

C A value -1 will be assigned to d

E The code snippet will work correctly if ! is replaced by Not

7 Which of the following is the correct output for the C#.NET code snippet given below?

1 The & operator can be used to Invert a bit

2 The & operator can be used to put ON a bit

3 The & operator can be used to put OFF a bit

4 The & operator can be used to check whether a bit is ON

5 The & operator can be used to check whether a bit is OFF

Trang 36

A ifConsole.WriteLine( ((n&16) == 16) "Fourth bit is ON");

B. ifConsole.WriteLine( ((n&8) == 8) "Fourth bit is ON");

Console.WriteLine("Fourth bit is ON");

D ifConsole.WriteLine( ((n ^ 8) == 8) "Fourth bit is ON");

Trang 37

(Here 1 is the 4th bit from right)

Now perform logical AND operation (n & myByte)

If the result is true, then we can understand that 4th bit is ON of the given datamyByte

11 What will be the output of the C#.NET code snippet given below?

Trang 38

A The | operator can be used to put OFF a bit

B The | operator can be used to Invert a bit

C The | operator can be used to check whether a bit is ON

D The | operator can be used to check whether a bit is OFF

Trang 39

18 Which of the following statements are correct about the following code snippet?

bool c;

c = !(a > b);

1 There is no error in the code snippet

2 An error will be reported since ! can work only with an int

3 A value 1 will be assigned to c

4 A value True will be assigned to c

5 A value False will be assigned to c

19 Which of the following statements is correct about Bitwise ^ operator used in C#.NET?

A The ^ operator can be used to put ON a bit

B The ^ operator can be used to put OFF a bit

D The ^ operator can be used to check whether a bit is ON

E The ^ operator can be used to check whether a bit is OFF

Trang 40

20 Which of the following statements are correct?

1 The conditional operator (?:) returns one of two values depending on the value of a Boolean expression

2 The as operator in C#.NET is used to perform conversions between compatible reference

types

3 The &* operator is also used to declare pointer types and to dereference pointers

4 The -> operator combines pointer dereferencing and member access

5 In addition to being used to specify the order of operations in an expression, brackets [ ] are used to specify casts or type conversions

Câu hỏi Attributes

1 The [Serializable()] attribute gets inspected at

2 Which of the following are correct ways to specify the targets for a custom

attribute?

C Once an attribute is declared it applies to all the targets

3 Which of the following are correct ways to pass a parameter to an attribute?

Ngày đăng: 04/06/2015, 20:26

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w