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 the Run-Time Type Information?

A) Information about an object’s datatype at runtime B) Information about the variables
C) Information about the given block D) None of these
 
Answer & Explanation Answer: A) Information about an object’s datatype at runtime

Explanation:

With the help of RTTI, We can get the information about the data type at the runtime.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3242
Q:

What of the following describes protected access specifier?

A) The variable is visible only outside inside the block B) The variable is visible everywhere
C) The variable is visible to its block and to it’s derived class D) None of these
 
Answer & Explanation Answer: C) The variable is visible to its block and to it’s derived class

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

2 6029
Q:

Which design patterns benefit from the multiple inheritance?

A) Adapter and observer pattern B) Code pattern
C) Glue pattern D) None of these
 
Answer & Explanation Answer: A) Adapter and observer pattern

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

5 10126
Q:

What will happen when introduce the interface of classes in a run-time polymorphic hierarchy?

A) Separation of interface from implementation B) Merging of interface from implementation
C) Separation of interface from debugging D) None of the mentioned
 
Answer & Explanation Answer: A) Separation of interface from implementation

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 6235
Q:

Where does the standard exception classes are grouped?

A) namespace std B) error
C) catch D) none of these
 
Answer & Explanation Answer: A) namespace std

Explanation:

:As these are standard exceptions, they need to be defined in the standard block, So it is defined under namespace std.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3183
Q:

What will happen when an exception is not processed?

A) It will eat up lot of memory and program size B) Terminate the program
C) Crash the compiler D) None of the mentioned
 
Answer & Explanation Answer: A) It will eat up lot of memory and program size

Explanation:

As in the case of not using an exception, it will remain useless in the program and increase the code complexity.

Report Error

View Answer Report Error Discuss

Filed Under: C++

2 4941
Q:

Why is it expensive to use objects for exception?

A) Exception object is created only if an error actually happens B) Because of execution time
C) Memory space involved in creating an exception object D) None of the mentioned
 
Answer & Explanation Answer: A) Exception object is created only if an error actually happens

Explanation:

If an error occurs in program, then only exception object is created otherwise, It will not be created. So it’s expensive to use in the program.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3889
Q:

Which operator is used in catch-all handler?

A) ellipses operator B) ternary operator
C) string operator D) unary operator
 
Answer & Explanation Answer: A) ellipses operator

Explanation:

The ellipses operator can be represented as (…).

Report Error

View Answer Report Error Discuss

Filed Under: C++

0 5642