Tải bản đầy đủ (.pdf) (100 trang)

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

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.14 MB, 100 trang )

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

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 …
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

2

a. Static
b. Private
c. Local
d. Serial
e. B and D
Cau 8. Defining two methods with the same name but with different parameters is called.
a. Loading
b. Overloading
c. Multiplexing
d. Duplexing
Cau 9. Find any errors in the following BankAccount constructor; Public int
BankAccount() { balance = 0;}
a. Name
b. Formal parameters
c. Return type
d. No errors
Cau 10. In the body of a method, C# uses the variable named … to refer to the current
object whose method is being
a. Call
b. This

c. Do
d. That
Cau 11. String mystring; Creates a(n)
a. Class
b. Constructor
c. Object
d. A and B
Cau 12. An Event is
a. The result of a users action
b. Result of a party
c. Code to force users action
Cau 13. A delegate defines
a. A Wahsington representative
b. A class that encapsulates methods
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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
a. True
b. False
Cau 15. All interfaces must contain IDrivable
a. True
b. False
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
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

4

b. Maintain the same return type and arguments as the parent class, but implement
it differently
c. Have different return types and arguments than the parent class
d. Are Virtual
Cau 21. Tho output the value of multidimensional array, Console.WriteLines(___)
a. myArray[1][3];

b. myArray[1,3];
c. myArray{1}{3};
d. myArray(1),(3);
Cau 22. All methods in an abstract base class must be declared abstract.
a. True
b. False
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
d. A and B
Cau 26. Classes declared with the sealed keyword cannot be base class
a. True
b. False
Cau 27. A method ….an exception when that method detects that a problem has
occurred.
a. Trys
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

5


b. Catches
c. Throws
d. A and B
Cau 28. Exception objects are derived from the class.
a. Try
b. Catch
c. Exception
d. Event
e. System
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.
a. Try
b. Catch
c. Exception
d. Error
e. A and B
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
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

6

c. Nanoseconds
d. All of the above
Cau 34. When a thread returns from a WaitSleepJoin or Suspended state it returns to the:
a. Unstarted state
b. Stopped state
c. Started state (now considering a part of the running state)
d. Resume state
Cau 35. The ThreadPriotity enumeration does not contain:
a. Lowest
b. Highest
c. BelowNormal
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:
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

7

a. !string
b. @string
c. #string
d. $string
Cau 41. String indexers treat strings as:
a. Binary code
b. 1 to string Length
c. Arrays of characters
d. A character
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. Generates an error

Cau 43. Concatenating with strings are done with:
a. Reserved words
b. Method calls
c. Operator overloading
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);




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

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
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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 26
th

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
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

10

d. None of the Above
Cau 12. What model does ASP.NET request processing is based on?
a. Pipeline
b. Waterfall
c. Top-down
d. Bottom-up
Cau 13. To set page title dynamically in ASP.NET which of the following is used?
a. <head> section
b. <tail> section
c. <sheet> section
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
ASP.NET?
a. Public
b. Private
c. No-cache
d. All the Above
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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

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

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?
a. ROOT
b. System
c. Application
d. None of the above
Đề .NET Framework
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.
A. Only 1 and 2
B. Only 1, 2 and 4
C. 1, 2, 3, 4
D. Only 4 and 5
E. Only 3 and 4
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
A. 1, 5 C. 1, 2
B. 3, 4 D. 4, 5
3. Which of the following statements is correct about Managed Code?
A .Managed code is the code that is compiled by the JIT compilers.
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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?
A.
gacutil
B.
ngen
C.
sn
D.
dumpbin
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
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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
B.
CLR
C.
Garbage Collector
D.
Class Loader
E.
CTS



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.
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

16

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

Which of the following constitutes the .NET Framework?
1. ASP.NET Applications
2. CLR
3. Framework Class Library
4. WinForm Applications
5. Windows Services
A.
1, 2
B.
2, 3
C.
3, 4
D.
2, 5



11. Which of the following assemblies can be stored in Global Assembly Cache?
A.
Private Assemblies
B.
Friend Assemblies
C.
Shared Assemblies
D.
Public Assemblies
E.
Protected Assemblies












12. Code that targets the Common Language Runtime is known as

A.
Unmanaged
B.

Distributed
C.
Legacy
D.
Managed Code
E.
Native Code

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.
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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
4. Authentication Security
5. Biorhythm Security
A.
1, 4, 5
B.
2, 5
C.
2, 3
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án


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
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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
5. Mobile Applications
A.
Only 1, 2, 3
B.
Only 1, 2
C.
Only 1, 2, 4
D.
Only 4, 5
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.
s1 = new Student();
s2 = new Student();
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;
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án


20

private void DisplayData()
{
Console.WriteLine(i + " " + j);
}
public void ShowData()
{
Console.WriteLine(i + " " + j);
}
}
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.
A. 1, 3, 5
B. 2, 4
C. 3, 5
D. 2, 4, 5
E. None of these
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();
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

21

2. Sample s;
3. Sample s; s = new Sample();
4. s = new Sample();
A.
1, 3
B.
2, 4
C.
1, 2, 3
D.
1, 4
E.
None of these



6.
Which of the following will be the correct output for the C#.NET program given
below?
namespace IndiabixConsoleApplication
{
class Sample
{
int i;
Single j;
public void SetData(int i, Single j)
{
i = i;
j = j;
}
public void Display()
{
Console.WriteLine(i + " " + j);
}
}
class MyProgram
{
static void Main(string[ ] args)
{
Sample s1 = new Sample();
s1.SetData(10, 5.4f);
s1.Display();
}
}
}

A.
0 0
B.
10 5.4
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

22

C.
10 5.400000
D.
10 5
E.
None of the above

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

A. True B. False

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.
A.

1, 3, 5
B.
1, 4
C.
2, 4, 5
D.
1, 2, 3
E.
None of these


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

namespace IndiabixConsoleApplication
{
class Sample
{
public int index;
public int[] arr = new int[10];

public void fun(int i, int val)
{
arr[i] = val;
}
}

class MyProgram
{
static void Main(string[] args)

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

23

Sample s = new Sample();
s.index = 20;
Sample.fun(1, 5);
s.fun(1, 5);
}
}
}
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 ].
D.
The call Sample.fun(1, 5) cannot work since fun() is not a shared function.
E.
arr being a data member, we cannot declare it as public.


10. Which of the following statements are correct about the C#.NET code snippet
given below?
sample c;
c = new sample();
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.
A.
1, 3
B.
2, 4
C.
3, 5
D.
4, 5
E.
None of these


11. Which of the following statements is correct about the C#.NET code snippet
given below?
int i;
int j = new int();
i = 10;
j = 20;
String str;
str = i.ToString();
str = j.ToString();
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

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 th is 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
function.
5. While calling an instance member function we are not required to pass the this reference
explicitly.
A.
1, 4
B.
2, 3, 5
C.
3, 4
D.
2, 5
E.

None of these


13. Which of the following will be the correct output for the C#.NET program
given below?

namespace IndiabixConsoleApplication
{
class Sample
{
int i;
Single j;
public void SetData(int i, Single j)
{
this.i = i;
this.j = j;
}
public void Display()
{
Console.WriteLine(i + " " + j);
}
}
class MyProgram
{
Câu hỏi trắc nghiệm C# bằng tiếng anh có đáp án

25

static void Main(string[ ] args)
{

Sample s1 = new Sample();
s1.SetData(36, 5.4f);
s1.Display();
}
}
}


A.
0 0.0
B.
36 5.4
C.
36 5.400000
D.
36 5
E.
None of the above



14. Which of the following statements are correct about objects of a user-defined
class called Sample?
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.

A.
1, 3
B.
2, 4
C.
4, 5
D.
3, 5
E.
None of these

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

namespace IndiabixConsoleApplication
{
class Sample
{
int i, j;
public void SetData(int ii, int jj)
{
this.i = ii;
this.j = jj
}
}

×