Try new tool: URL Shortener

https://res.cloudinary.com/hg6hswtwo/image/upload/v1/media/pics/oop_toolsandjobs_se2jyx_upuwlh
secondyear

Exception Handling MCQs In Object Oriented Programming Part 1





Exception Handling MCQs In Object Oriented Programming. This is part 1 mcqs most helps in competitive, placements exams & SPPU online exams 2020-21.

1.What is meaning of template parameter?

A) It is used to pass a type as argument
B) Used to evaluate a type
C) It can of no return type
D) None of the mentioned

Answer A

2. ____Keyword is used in template.

A) Class
B) Typename
C) Both a and b
D) Using

Answer C


3. What is scope of template parameter?

) AInside a block only
B) Inside the class only
C) Throughout program
D) All of the above

Answer A

4. Function overloading is also similar to which of the following

A) Operator overloading
B) Destructor overloading
C) Constructor overloading
D) Virtual function

Answer B
 

5. Generic programming is approach of__________which are applicable for all types

A) Generalised algorithm
B) Pseude algorithm
C) Both a and b
D)None of the above

Answer A


6. Template are of types

A) Function template
B) Class template
C) Both aand b
D) None of the above

Answer C


7. Class template can be created using____syntax.

A) Template<class T>class classname
B) Template<class T1,class T2> class classname
C) Both a and b
D) None of the above mentioned

Answer C

8. Syntax for creating a function template is

A) Template<typename t>returntype function name
B) Template<class T> returntype function name
C) Both a and b
D) None of the above mentioned

Answer C

9. Pick up the correct statementi)template allow us to define generic classes and functions
ii)template support generic programmingiii)function template overloading is possible

A) i only
B) i and ii only
C) ii and iii only
D) i, ii and iii

Answer D

10. Template function can be overloaded

A) True
B) False 
Answer A

11. Why we use :: template-template parameter?

A) binding
B) rebinding
C) both a &b
D) none of these

Answer C

12. Which of the things does not require instantiation?

A) functions
B) non virtual member function
C) member class
D) all of the mentioned

Answer D

13. A template provides a convenient way to make a family of

A) variables
.B) functions
C) classes
D) B and C

Answer D

14. Templates automatically create different versions of a function, depending on user input.

A) TRUE
B) FALSE

Answer B

15. A template class

A is designed to be stored in different containers.
B works with different data types.
C generates objects which must all be identical.
D generates classes with different numbers of member functions.

Answer B


16. There can be more than one template argument.

A TRUE 
B FALSE

Answer A

17. Actual code for a template function is generated when

A the function declaration appears in the source code.
B the function definition appears in the source code.
C a call to the function appears in the source code.
D the function is executed at runtime.

Answer C

18. An exception is typically caused by

A the programmer who writes an application‟s code.
B the creator of a class who writes the class member functions.
C a runtime error.
D an operating system malfunction that terminates the program

Answer C

19. Statements that might cause an exception must be part of a catch block

A TRUE
B FALSE

Answer B

20. Exceptions are thrown

A from the catch block to the try block.
B from a throw statement to the try block.
C from the point of the error to a catch block.
D from a throw statement to a catch block.

Answer D

21. A statement that throws an exception does not need to be located in a try block. 

A TRUE
B FALSE

Answer B

22. The following is/are errors for which an exception would typically be thrown

A An excessive amount of data threatens to overflow an array.
B new cannot obtain the requested memory.
C A power failure shuts down the system.
D A and B

Answer D

23. Additional information sent when an exception is thrown may be placed in

A the throw keyword.
B the function that caused the error.
C the catch block.
D an object of the exception class.

Answer D

24. A program can continue to operate after an exception has occurred.
 
A TRUE 
B FALSE

Answer A

25. What is the advantage of exception handling?
 1) Remove error-handling code from the software's main line of code.
 2) A method writer can chose to handle certain exceptions and delegate others to the caller.
 3) An exception that occurs in a function can be handled anywhere in the function call stack. 

A Only 1
B 1, 2 and 3
C 1 and 3
D 1 and 2

AnswerB

26. What should be put in a try block?1. Statements that might cause exceptions2. Statements that should be skipped in case of an exception

A Only 1
B Only 2
C Both 1 and 2
D None of the above

Answer C





Publish Your Great Work

Your AD here