Difference b/w exceptions and assertions. Define call stack mechanism. Is it possible to create user define exception. If yes then explain how? Write a program to print the sum of array using fine-grained exception handling. Exceptions are the mechanism used by many programming languages to describe what to do when something unexpected happens. Typically something unexpected is an error of some sort, for example when a method is invoked with unacceptable arguments, or a network connection fails, or the user asks to open a non-existent file. Assertions are a way to test certain assumptions about the logic of a program. Assertions are used to test assumptions about local program logic inside a method, and usually not to test that external exceptions are met. For example , if we believe that that at particular point the value of a variable will always be positive, then an assertion can test this. Assertions can be removed entirely from the code when it runs. This make it poss...
PhD || Artificial Intelligence, Machine Learning, Soft Computing, Quantum Machine Learning, Data Sciences.