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 default return type of a function ?

A) int B) void
C) float D) char
 
Answer & Explanation Answer: B) void

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

19 16683
Q:

In which of the following we cannot overload the function?

A) return function B) caller
C) called function D) none of the mentioned
 
Answer & Explanation Answer: A) return function

Explanation:

While overloading the return function, it will rise a error, So we can’t overload the return function.

Report Error

View Answer Report Error Discuss

Filed Under: C++

2 8346
Q:

What is the output of this program?

#include
        using namespace std;
        void fun(int x, int y)
        {
            x = 20;
            y = 10;
        }
        int main()
        {
            int x = 10;
            fun(x, x);
            cout << x;
            return 0;
        }

A) 10 B) 20
C) compile time error D) none of these
 
Answer & Explanation Answer: A) 10

Explanation:

In this program, we called by value so the value will not be changed, So the output is 10

Report Error

View Answer Report Error Discuss

Filed Under: C++

0 10618
Q:

Which is more effective while calling the functions?

A) call by value B) call by reference
C) call by pointer D) none
 
Answer & Explanation Answer: B) call by reference

Explanation:

In the call by reference, it will just copy the address of the variable to access it, so it will reduce the memory in accessing it.

Report Error

View Answer Report Error Discuss

Filed Under: C++

15 21768
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 & Explanation Answer: A) 252

Explanation:

In this program, We are dividing the values of a and b, printing it.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 8640
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 & Explanation Answer: A) 252

Explanation:

In this program, We are dividing the values of a and b, printing it.

Report Error

View Answer Report Error Discuss

Filed Under: C++

0 11171
Q:

Which of the following is a properly defined structure?

A) struct {int a;} B) struct a_struct {int a;}
C) struct a_struct int a; D) struct a_struct {int a;};
 
Answer & Explanation Answer: D) struct a_struct {int a;};

Explanation:

The a_struct is declared as structure name and its data element is a.

Report Error

View Answer Report Error Discuss

Filed Under: C++

12 23837
Q:

What is meaning of following declaration?
int(*p[5])();

A) p is pointer to function. B) p is array of pointer to function.
C) p is pointer to such function which return type is array. D) p is pointer to array of function.
 
Answer & Explanation Answer: B) p is array of pointer to function.

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

14 29885