AmbitionBox

Discover Best Places to work in India

C# Programming

C# Programming Questions and Answers

Showing 61 - 70 of 174 questions

61

The method called by clients of a class to explicitly release any resources like network,connection,open files etc.When the object is no longer required?

a

Finalize()

b

End()

c

Dispose()

d

Close()

correct answer c

Dispose() is only method called by clients of a class to explicitly release any resource like network connection,open files etc.when object is no longer required.Hence,Dispose() provides programmer with such programming control.

62

Which of the following statements are correct?

a

There is one garbage collector per program running in memory

b

There is one common garbage collector for all programs

c

To garbage collect an object set all references to it as null

d

We have to specify run the garbage collector after executing VISUAL STUDIO.NET

correct answer b,c

Answer: Option (B) and Option (C)

63

Select correct statement about destructor in C#?

a

A class can have one destructor only

b

Destructors cannot be inherited or overloaded

c

Destructors can have modifiers or parameters

d

All of above mentioned

correct answer a,b

Answer: Option (A) and Option (B)

64

What is the return type of destructor ?

a

int

b

void

c

float

d

None of the mentioned

correct answer d

Destructors do not have any return type not even void

65

Name a method which has the same name as that of class and which is used to destroy objects also called automatically when application is finally on process of being getting terminated.

a

Constructor

b

Finalize()

c

Destructor

d

End

correct answer c

Definition of destructor.

66

Operator used to free the memory when memory is allocated ?

a

new

b

free

c

delete

d

None of the mentioned

correct answer c

‘New’ is used to allocate memory in the constructors.Hence,we should use ‘delete’ to free that memory.

67

Which among the following is NOT considered as .NET Exception class?

a

Exception

b

StackUnderflow Exception

c

File Found Exception

d

Divide By zero Exception

correct answer b,c

Answer: Option (B) and Option (C)

68

Select the statements which describe the correct usage of exception handling over conventional error handling approaches?

a

As errors can be ignored but exceptions cannot be ignored

b

Exception handling allows separation of program’s logic from error handling logic making software more reliable and maintainable

c

try – catch – finally structure allows guaranteed cleanup in event of errors under all circumstances

d

All of the above mentioned

correct answer d

Answer: Option (D)

69

Which among the following is NOT an exception?

a

Stack Overflow

b

Arithmetic Overflow or underflow

c

Incorrect Arithmetic Expression

d

All of the above mentioned

correct answer c

Answer: Option (C)

70

Which of the following is the correct statement about exception handling in C#.NET?

a

finally clause is used to perform cleanup operations of closing network and database connections

b

a program can contain multiple finally clauses

c

The statement in final clause will get executed no matter whether an exception occurs or not

d

All of the above mentioned

correct answer a,c

Answer: Option (A) and Option (C)

Select a company to compare with

vs

Similar Companies