C++ Questions

Q:

What are the mandatory part to present in function pointers?

A) & B) retrun values
C) data types D) none of these
 
Answer & Explanation Answer: C) data types

Explanation:

The data types are mandatory for declaring the variables in the function pointers.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 7721
Q:

To which type of class, We can apply RTTI?

A) Encapsulation B) Polymorphic
C) Derived D) None of these
 
Answer & Explanation Answer: B) Polymorphic

Explanation:

RTTI is available only for classes which are polymorphic, which means they have at least one virtual method.

Report Error

View Answer Report Error Discuss

Filed Under: C++

0 7576
Q:

Which among the following are not access Specifiers in C++?

A) Public B) Protected
C) Default D) Private
 
Answer & Explanation Answer: C) Default

Explanation:

Default is the access specifier in java not in C++

Report Error

View Answer Report Error Discuss

Filed Under: C++

4 7411
Q:

Which keyword is used to declare the min and max functions?

A) iostream B) string
C) algorithm D) None of these
 
Answer & Explanation Answer: C) algorithm

Explanation:

Algorithm header file contain the supporting files needed for the execution of these functions.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 7375
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 7273
Q:

How many ways are there to initialize int with a constant?

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

Explanation:

There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.

int foo = 123;

 

int bar (123);

Report Error

View Answer Report Error Discuss

Filed Under: C++
Job Role: Software Architect

1 7194
Q:

How many types of macros are there in c++?

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

Explanation:

There are two types of macros. They are object-like and function-like.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 7096
Q:

Which of the following can derived class inherit?

A) members B) functions
C) both a & b D) None of the above
 
Answer & Explanation Answer: C) both a & b

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

2 7007