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 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 2961
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 2126
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 2769
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 15469
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 10169
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 2963
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 4931
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 7092