1
Q:

What is the output of this program?

#include
        using namespace std;
        struct sec {
            int a;
            char b;
        };
        int main()
        {
            struct sec s ={25,50};
            struct sec *ps =(struct sec *)&s;
            cout << ps->a << ps->b;
            return 0;
        }

A) 252 B) 253
C) 254 D) 262

Answer:   A) 252



Explanation:

In this program, We are dividing the values of a and b, printing it.

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 4064
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 7223
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 2787
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 3393
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 3839
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 10187
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 4524
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 4140