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:

Which of the following gives the memory address of the first element in array?

A) array[0]; B) array[1];
C) array(2); D) array;
 
Answer & Explanation Answer: D) array;

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

23 21893
Q:

The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is

A) int **fun(float**, char**) B) int *fun(float*, char*)
C) int ***fun(float*, char**) D) int ***fun(*float, **char)
 
Answer & Explanation Answer: C) int ***fun(float*, char**)

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

3 6480
Q:

What is the difference between class and structure?

Answer

Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public.
Class: Class is a successor of Structure. By default all the members inside the class are private.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2425
Q:

What is the difference between realloc() and free()?

Answer

The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines. Undefined results occur if the Pointer parameter is not a valid pointer.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 4936
Q:

What do you mean by multiple inheritance in C++ ?

Answer

Multiple inheritance is a feature in C++ by which one class can be of different types. Say class teaching Assistant is inherited from two classes say teacher and Student.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2136
Q:

What do you mean by early binding?

Answer

Early binding refers to the events that occur at compile time. Early binding occurs when all information needed to call a function is known at compile time. Examples of early binding include normal function calls, overloaded function calls, and overloaded operators. The advantage of early binding is efficiency.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2214
Q:

What do you mean by late binding?

Answer

Late binding refers to function calls that are not resolved until run time. Virtual functions are used to achieve late binding. When access is via a base pointer or reference, the virtual function actually called is determined by the type of object pointed to by the pointer.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2769
Q:

What is namespace?

Answer

The C++ language provides a single global namespace.Namespaces allow to group entities like classes, objects and functions under a name.

Report Error

View answer Workspace Report Error Discuss

Subject: C++

0 2882