adplus-dvertising
frame-decoration

Question

Which of the following statement is correct about the program given below?
#include<iostream.h> 
class BitsArray
{
    int array[3][3];
    public:
    BitsArray(int arr[3][3] = NULL)
    { 
        if(arr != NULL)
        for(int i = 0; i < 3; i++) 
            for(int j = 0; j < 3; j++) 
                array[i][j] = i+j; 
    } 
    void Display(void)
    {
        for(int i = 0; i < 3; i++) 
            for(int j = 0; j < 3; j++)
                cout<< array[i][j] << " "; 
    }
};
int main()
{
    BitsArray objBA;
    objBA.Display();
    return 0; 
}

a.

The program will report error on compilation.

b.

The program will display 9 garbage values.

c.

The program will display NULL 9 times.

d.

The program will display 0 1 2 1 2 3 2 3 4.

Answer: (b).The program will display 9 garbage values.

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the following statement is correct about the program given below?

Similar Questions

Discover Related MCQs

Q. The variable that are listed in the function's calls are called

Q. A programmer can create custom header files that must be end with

Q. Unary scope resolution operator is denoted by

Q. To make large programs more manageable programmers modularize them into subprograms that are called

Q. The maths function acos (x) stands for

Q. Which from the following is not a storage class specifier in C++?

Q. Which of the following function returns no value?

Q. A variable that is declared inside a block is called

Q. For accessing a global variable when a local variable of the same name is in scope, C++ provides a

Q. The () parenthesis in a function call

Q. Modules in C++ are called

Q. Which from the following is used for invoking a function?

Q. There are how many ways to invoke a function in C++?

Q. All variables declared in function definition are called

Q. Which operator is used for accessing global variables if the local variable of same name exists in the code?

Q. A function that need no return value, is called

Q. An identifier's scope is

Q. The standard C library file < stdlib.h> is used for

Q. Not initializing a reference variable will cause

Q. In which circumstances the recursion function is called?