What will be printed on the console?
void f() throw (float) {
throw 10.0f;
}
int main() {
try {
std::cout << 'A';
fO;
std::cout << 'B';
} catch(...) {
std::cout << 'C';
}
return 0;
}
Answers
Answer:
Explanation:
Concept:
void:
In several programming languages derived from C and Algol68, the void type is the type for a function's result that returns correctly but does not give its caller a result value. Typically, these functions are used for the side effects they produce, such carrying out a task or writing to their output parameters.
Float:
The floating point numbers are represented by the datatype float. It is a 32-bit IEEE 754 single precision floating point integer (sign is 1 bit, exponent is 8 bits, and value is 23* bits). The precision is 6 decimal digits.
throw:
The throw keyword enables the definition of unique exceptions by programmers. The catch keyword, which comes after the try block, is where exception handlers are declared in C++. Each handler (catch expression) can have a separate exception type, allowing for the chaining of several handlers.
int:
Only whole numbers are contained in an int variable.
The fundamental variable type int, which stands for "integer," is included in the compiler and is used to define numeric variables that carry entire integers. The float and double data types are additional ones. Numerous computer languages, including C, C++, C#, and others, support the data type "int."
catch:
You can specify a block of code to be executed if an error occurs in the try block using the catch statement.
count:
The COUNT function counts the number of parameters in the list as well as the number of cells that contain numbers. Get the number of entries in a number field that is part of a range or array of numbers by using the COUNT function.
return:
Returning control to the caller function puts an end to the execution of a function. At the instant after the call, execution picks back up in the caller function. The calling function may get a value from a return statement.
What will be printed on the console?
Output:
AC.
#SPJ2