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 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 3239
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 6023
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 10123
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 4939
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 3880
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 5640