In: Computer Science
Ex: int counter = 0;
is not allowed inside a class definition.
a)
The answer is false.
The c++ does not throw an exception if an element that is not
present in array index bounds is tried to be accessed.
There are some default values or garbage values that are present in
the memory that is allocated to the program.
These values get displayed when such elements are accessed.
In some cases, the program produces segmentation fault error.
b)
The answer is false.
When the assignment statement is used to copy one array to another
it raises error.
In order to copy one array to another array, the operation should
be performed on each element of the array.
Each element should be copied and moved to the second array.
c)
The answer is true.
The exceptions are the unexpected situations that arise during the
run time of the program.
These are not syntactical problems. These can be handled in the
program to prevent the stopping of execution of the program.
d)
The answer is false.
The try catch blocks are used for exception handling
mechanisms.
The syntax errors can not be handled by the try catch blocks. These
are used to test the code and handle the problems that might rise
during the execution.
e)
The answer is true.
The try block must be followed by the catch block.
Each try block can have multiple catch blocks associated with
it.
But there can be no other statements present between try and its
associated catch block.
Note:
Please see that as per the guidelines, only single question can be
answered when multiple questions are present.
In case of multiple choice type questions, upto 4 can be answered.
Thank you.