Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of these keywords are used for the block to handle the exceptions generated by try block?(a) try(b) catch(c) throw(d) checkThe question was posed to me by my college director while I was bunking the class.Asked question is from Try & Catch in Detail topic in portion Indexers and Exception Handling of C#

Answer»

The CORRECT CHOICE is (B) catch

To EXPLAIN: NONE.

2.

Which of the keywords are used for the block to be examined for exceptions?(a) try(b) catch(c) throw(d) checkThe question was posed to me in class test.My question comes from Try & Catch in Detail topic in portion Indexers and Exception Handling of C#

Answer» RIGHT ANSWER is (a) TRY

Easy EXPLANATION - try is used for the block that needs to be checked for the exception.
3.

Choose the statement which is incorrect?(a) try block does not need to be followed by catch block(b) try block can be followed by finally block instead of catch block(c) try can be followed by both catch and finally block(d) try need not to be followed by anythingI have been asked this question by my school teacher while I was bunking the class.Question is taken from Try & Catch in Detail in section Indexers and Exception Handling of C#

Answer»

Right answer is (d) TRY NEED not to be followed by anything

Explanation: try followed by EITHER CATCH or finally block.

4.

What is the use of try & catch?(a) It is used to manually handle the exception(b) It helps to fix the errors(c) It prevents automatic terminating of the program in cases when an exception occurs(d) All of the mentionedI had been asked this question at a job interview.The doubt is from Try & Catch in Detail in portion Indexers and Exception Handling of C#

Answer» RIGHT CHOICE is (d) All of the mentioned

Explanation: NONE.
5.

Which of these classes is related to all the exceptions that are explicitly thrown?(a) Error(b) Exception(c) Throwable(d) ThrowI have been asked this question during an interview.I want to ask this question from Exceptions of Type Finally and Built in Exceptions topic in section Indexers and Exception Handling of C#

Answer»

Correct option is (C) Throwable

The BEST I can explain: NONE.

6.

Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?(a) try(b) throw(c) throws(d) catchI got this question in unit test.This question is from Exceptions of Type Finally and Built in Exceptions topic in portion Indexers and Exception Handling of C#

Answer»

The CORRECT answer is (C) throws

The explanation is: If a method is capable of causing an EXCEPTION that it does not handle. It must specify this BEHAVIOUR so that callers of the method can guard themselves against that exception. This is DONE by using throws clause in methods declaration.

7.

Which of these exceptions will occur if we try to access the index of an array beyond its length?(a) ArithmeticException(b) ArrayException(c) ArrayArguementException(d) IndexOutOfRangeExceptionThis question was addressed to me in final exam.The question is from Exceptions of Type Finally and Built in Exceptions in chapter Indexers and Exception Handling of C#

Answer»

The CORRECT option is (d) IndexOutOfRangeException

Easiest explanation - IndexOutOfRangeException is a built in exception that is CAUSED when we try to access an index LOCATION which is beyond the length of an ARRAY.

8.

A single try block must be followed by which of these?(a) finally(b) catch(c) Both finally & catch(d) None of the mentionedThe question was asked in an internship interview.This intriguing question comes from Exceptions of Type Finally and Built in Exceptions in section Indexers and Exception Handling of C#

Answer»

Correct ANSWER is (c) Both FINALLY & catch

Explanation: TRY block can be FOLLOWED by any of finally or catch block, try block checks for exceptions and work is performed by finally and catch block as per the exception.

9.

Which of these exceptions handles the divide by zero error?(a) ArithmeticException(b) MathException(c) IllegalAccessException(d) IllegarExceptionThe question was posed to me during an online interview.Query is from Exceptions of Type Finally and Built in Exceptions topic in portion Indexers and Exception Handling of C#

Answer» RIGHT OPTION is (a) ArithmeticException

Explanation: NONE.
10.

Which of these clauses will be executed even if no exceptions are found?(a) throws(b) finally(c) throw(d) catchThe question was asked in examination.The doubt is from Exceptions of Type Finally and Built in Exceptions in portion Indexers and Exception Handling of C#

Answer»

Correct choice is (B) FINALLY

Easy explanation - finally keyword is used to define a SET of instructions that will be EXECUTED irrespective of whether the exception is FOUND or not.

11.

Which of the following is the wrong 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 mentionedThis question was addressed to me during an internship interview.My doubt is from Fundamentals of Exception Handling topic in division Indexers and Exception Handling of C#

Answer» CORRECT option is (B) a PROGRAM can CONTAIN multiple FINALLY clauses

Explanation: None.
12.

Which of these keywords is not a part of exception handling?(a) try(b) finally(c) thrown(d) catchThe question was asked by my college professor while I was bunking the class.My doubt is from Fundamentals of Exception Handling in division Indexers and Exception Handling of C#

Answer»

The correct option is (c) thrown

The EXPLANATION is: Exception handling is MANAGED VIA 5 keywords – try, catch, throws, THROW and finally.

13.

Select the correct statement about an Exception?(a) It occurs during loading of program(b) It occurs during Just-In-Time compilation(c) It occurs at run time(d) All of the mentionedI got this question in quiz.Query is from Fundamentals of Exception Handling topic in section Indexers and Exception Handling of C#

Answer» CORRECT choice is (C) It occurs at RUN time

The best explanation: None.
14.

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 logicfrom 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 mentionedI have been asked this question in an interview for internship.This key question is from Fundamentals of Exception Handling topic in chapter Indexers and Exception Handling of C#

Answer» CORRECT OPTION is (d) All of the mentioned

Best EXPLANATION: NONE.
15.

Which of the following is the object oriented way to handle run time errors?(a) Error codes(b) HERRESULT(c) OnError(d) ExceptionsThis question was posed to me in exam.Enquiry is from Fundamentals of Exception Handling in section Indexers and Exception Handling of C#

Answer» CORRECT CHOICE is (d) Exceptions

The EXPLANATION: NONE.
16.

Which among the following is considered as .NET Exception class?(a) Exception(b) StackUnderflow Exception(c) File bound Exception(d) All of the mentionedI have been asked this question in an online interview.My doubt is from Fundamentals of Exception Handling topic in portion Indexers and Exception Handling of C#

Answer» RIGHT ANSWER is (B) StackUnderflow Exception

Best EXPLANATION: NONE.
17.

Which among the following is NOT an exception?(a) Stack Overflow(b) Arithmetic Overflow or underflow(c) Incorrect Arithmetic Expression(d) All of the mentionedI have been asked this question in final exam.I want to ask this question from Fundamentals of Exception Handling topic in section Indexers and Exception Handling of C#

Answer»

Correct option is (C) Incorrect Arithmetic Expression

The BEST I can explain: NONE.

18.

Select the modifiers which can be used with the properties?(a) Private(b) Public(c) Protected Internal(d) All of the mentionedI had been asked this question in my homework.My question comes from Introduction of Properties topic in division Indexers and Exception Handling of C#

Answer»

The CORRECT OPTION is (d) All of the mentioned

The BEST I can EXPLAIN: NONE.

19.

Where the properties can be declared?(a) Class(b) Struct(c) Interface(d) All of the mentionedI have been asked this question during a job interview.This intriguing question comes from Introduction of Properties topic in portion Indexers and Exception Handling of C#

Answer»

The CORRECT OPTION is (d) All of the mentioned

The EXPLANATION is: NONE.

20.

Choose the statements which makes use of essential properties rather than making data member public in C#.NET?(a) Properties have their own access levels like private, public, protected etc. which allows it to have better control about managing read and write properties(b) Properties give us control about what values may be assigned to a member variable of a class they represent(c) Properties consist of set accessor inside which we can validate the value before assigning it to the data variable(d) All of the mentionedThis question was addressed to me in an online quiz.My enquiry is from Introduction of Properties in division Indexers and Exception Handling of C#

Answer» CORRECT ANSWER is (d) All of the mentioned

For EXPLANATION: NONE.
21.

Choose the wrong statement about the properties used in C#.NET?(a) Each property consists of accessor as get and set(b) A property cannot be either read or write only(c) Properties can be used to store and retrieve values to and from the data members of a class(d) Properties are like actual methods which work like data membersI had been asked this question in a job interview.I would like to ask this question from Introduction of Properties in chapter Indexers and Exception Handling of C#

Answer»

The CORRECT OPTION is (a) Each PROPERTY CONSISTS of accessor as get and set

The best explanation: NONE.

22.

Which among the following are the advantages of using indexers?(a) To use collection of items at a large scale we make use of indexers as they utilize objects of class that represent the collection as an array(b) Indexers are also convenient as they can also make use of different types of indexers like int, string etc(c) An indexer allows an object to be indexed such as an array(d) All of the mentionedI had been asked this question in homework.My enquiry is from Introduction of Indexers in portion Indexers and Exception Handling of C#

Answer»

Right choice is (d) All of the mentioned

The best I can explain: Indexers provides a view at large scale to visualize a collection of items as an array. It is really easy to use the object of the class that represents a collection as if it is an array. Hence, INDEXED properties allow us to represent such a view. Indexers can also use different types of indexes like int, string ETC. Use int as an index where SEQUENTIAL ACCESS to a collection is desired. When symbolic access is NEEDED, use string as an index.

23.

Choose the correct statement among the followings?(a) Indexers are location indicators(b) Indexers are used to access class objects(c) Indexer is a form of property and works in the same way as a property(d) All of the mentionedI have been asked this question during an online interview.This interesting question is from Introduction of Indexers topic in division Indexers and Exception Handling of C#

Answer»

The CORRECT OPTION is (d) All of the mentioned

The BEST I can EXPLAIN: By DEFINITION.