Live Help (Start Chat)
View Count: 0
Duration: 30 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 30 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 30 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 30 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 30 mins
Accessed date:
Not Yet Viewed
Post your comment / feedback here
 
 

Be the first one to comment about this video

Question No: 1 of 9
What type of Exceptions does C++ handle? 
Options:
  1. Synchronous
  2. Asynchronous
  3. Both
  4. None
View Answer/Explanation:
a
Explanation:
Errors such as out –of –range index and overflow belong to the synchronous exceptions. This type of exceptions can be handled

Question No: 2 of 9
Where does the program control transfers to when exception arises? 
Options:
  1. catch
  2. handlers
  3. Throw
  4. none of the mentioned
View Answer/Explanation:

Explanation:
When an exception is arise mean, the exception is caught by handlers and then it decides the type of exception.

Question No: 3 of 9
Which keyword is used to check exception in the block of code? 
Options:
  1. catch
  2. throw
  3. try
  4. none of the mentioned
View Answer/Explanation:
c
Explanation:
The try() statement is used for exceptions in C++.

Question No: 4 of 9
What will happen when the exception is not caught in the program? 
Options:
  1. error
  2. program will execute
  3. block of that code will not execute
  4. none of the mentioned
View Answer/Explanation:
a
Explanation:

Question No: 5 of 9
What is the output of this program?
#include 
using namespace std;
int main()
{
 int age = 0;
 try
{
if (age < 0)
{
 throw "Positive Number Required";
}
 cout << age;
}
catch(const char *Message)
{
 cout << "Error: " << Message;
}
 return 0;
} 
Options:
  1. 0
  2. Error:Positive Number Required
  3. compile time error
  4. none of the mentioned
View Answer/Explanation:
a
Explanation:
As the zero marks the beginning of the positive number.

Question No: 6 of 9
What is the output of this program?
#include 
using namespace std;
void PrintSequence(int StopNum)
{
 int Num;
 Num = 1;
while (true)
{
 if (Num >= StopNum)
 throw Num;
 cout << Num;
 Num++;
}
}
int main(void)
{
try
{
 PrintSequence(20);
}
 catch(int ExNum)
{
 cout << "Caught an exception with value: " << ExNum;
}
 return 0;
} 
Options:
  1. compile time error
  2. prints first 19 numbers
  3. prints first 19 numbers and throws exception at 20
  4. none of the mentioned
View Answer/Explanation:

Explanation:
In this program, we are printing upto 19 numbers and when executing 20, we are raising an exception.

Question No: 7 of 9
What is the output of this program?
#include 
using namespace std;
int main()
{
   char* buff;
try
{
  buff = new char[1024];
if (buff == 0)
  throw "Memory allocation failure!";
else
   cout << sizeof(buff) << "Byte successfully allocated!"< 
Options:
  1. Byte successfully allocated
  2. 4
  3. 4 Bytes allocated successfully.
  4. 5
View Answer/Explanation:
c
Explanation:
As we are allocating the memory to the variables and if there is not sufficient size means, it will throw an exception.

Question No: 8 of 9
What will happen when the handler is not found for exception? 
Options:
  1. Calls the standard library function terminate()
  2. raise an error
  3. executes the remaining block
  4. none of the mentioned A
View Answer/Explanation:
a
Explanation:

Question No: 9 of 9
Can we write our custom Exceptions? 
Options:
  1. Yes
  2. No
View Answer/Explanation:
a
Explanation:

  1