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 are the features of C++ different from C?

Answer

All the features of C are similiar to C++ except some features, such as polymorphism, operator overloading which are supported in C++ but not in C language.

Both C and C++ language is similiar in their functionality but C++ provides with more tools and options.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2964
Q:

What are the basic concepts of object oriented programming?

Answer

It is necessary to understand some of the concepts used extensively in object oriented programming.These include


Objects
Classes
Data abstraction and encapsulation
Inheritance
Polymorphism
Dynamic Binding
Message passing

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2132
Q:

What is C++

Answer

C++ is created by Bjarne Stroustrup of AT&T Bell Labs as an extension of C, C++ is an object-oriented computer language used in the development of enterprise and commercial applications. Microsoft’s Visual C++ became the premier language of choice among developers and programmers.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2773
Q:

What is the difference between stack and array?

Answer

Stack:


 - Stack is a ordered collection of items


 - Stack is a dynamic object whose size is constantly changing as items are pushed and popped .


 - Stack may contain different data types


Array:


- Array is an ordered collection of items


- Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array


- It contains same data types.

Report Error

View answer Workspace Report Error Discuss

Subject: C++ Exam Prep: GATE

24 15475
Q:

What is the Standard Template Library?

Answer

A library of container templates approved by the ANSI committee for inclusion in the standard C++ specification. A programmer who then launches into a discussion of the generic programming model, iterators, allocators, algorithms, and such, has a higher than average understanding of the new technology that STL brings to C++ programming

Report Error

View answer Workspace Report Error Discuss

Subject: C++
Job Role: Software Architect

2 10172
Q:

What is an explicit constructor?

Answer

A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It’s purpose is reserved explicitly for construction

Report Error

View answer Workspace Report Error Discuss

Subject: C++
Job Role: Software Architect

0 2965
Q:

A special member function of a class, which is invoked automatically whenever an object goes out of the scope is called

A) Constructor B) Destructor
C) Friend function D) None of the above
 
Answer & Explanation Answer: B) Destructor

Explanation:

Destructor is a special member function of a class, which is invoked automatically whenever an object goes out of the scope. It has the same name as its class with a tilde character prefixed.

Report Error

View Answer Report Error Discuss

Filed Under: C++
Job Role: Software Architect

1 4936
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 7102