0
Q:

What is the output of this program?

 #include
       using namespace std;
       int main()
       {
           int arr[] = {4, 5, 6, 7};
           int *p = (arr + 1);
           cout << arr;
           return 0;
       }

A) 4 B) 5
C) address of arr D) 7

Answer:   C) address of arr



Explanation:

As we couted to print only arr, it will print the address of the array.

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 3061
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 5663
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 9647
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 5915
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 2950
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 4612
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 3597
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 5222