3
Q:

What is the output of this program ?

       #include
        using namespace std;
        int n(char, int);
        int (*p) (char, int) = n;
        int main()
        {
            (*p)('d', 9);
            p(10, 9);
            return 0;
        }
        int n(char c, int i)
        {
            cout << c <<  i;
            return 0;
        }

A) d99 B) d9d9
C) d9 D) compile time error

Answer:   A) d99



Explanation:

In this program, we have declared the values as integer instead of character, So it is printing as d99 but it will not arise an error.

Subject: C++
Q:

What is meant by exception specification?

A) A function is limited to throwing only a specified list of exceptions. B) A catch can catch all types of exceptions.
C) A function can throw any type of exceptions. D) none of the mentioned
 
Answer & Explanation Answer: A) A function is limited to throwing only a specified list of exceptions.

Explanation:

C++ provides a mechanism to ensure that a given function is limited to throwing only a specified list of exceptions. It is called as exception specification.

Report Error

View Answer Report Error Discuss

Filed Under: C++

0 4074
Q:

How to handle error in the destructor?

A) throwing B) terminate
C) both a & b D) none of the mentioned
 
Answer & Explanation Answer: B) terminate

Explanation:

It will not throw an exception from the destructor but it will the process by using terminate() function.

Report Error

View Answer Report Error Discuss

Filed Under: C++

3 7236
Q:

What are the operators available in dynamic memory allocation?

A) new B) delete
C) compare D) both a & b
 
Answer & Explanation Answer: D) both a & b

Explanation:

new and delete operators are mainly used to allocate and deallocate
during runtime.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 2788
Q:

Where does the exception are handled?

A) inside the program B) outside the regular code
C) both a & b D) none of these
 
Answer & Explanation Answer: B) outside the regular code

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3401
Q:

Where does the exceptions are used?

A) Exceptions are used when postconditions of a function cannot be satisfied. B) Exceptions are used when postconditions of a function can be satisfied.
C) To preserve the program D) none of these
 
Answer & Explanation Answer: B) Exceptions are used when postconditions of a function can be satisfied.

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3849
Q:

How do define the user-defined exceptions?

A) inheriting and overriding exception class functionality. B) overriding class functioality.
C) inheriting class functionality D) none of the mentioned
 
Answer & Explanation Answer: A) inheriting and overriding exception class functionality.

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

4 10221
Q:

How many kinds of entities are directly parameterized in c++?

A) 1 B) 2
C) 3 D) 4
 
Answer & Explanation Answer: C) 3

Explanation:

C++ allows us to parameterize directly three kinds of entities through templates: types, constants, and templates.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 4532
Q:

What is meant by template specialization?

A) It will have certain data types to be fixed. B) It will make certain data types to be dynamic.
C) Certain data types are invalid D) None of the mentioned
 
Answer & Explanation Answer: A) It will have certain data types to be fixed.

Explanation:

In the template specialization, it will make the template to be specific for some data types.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 4149