Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the representation of the element at the first row and first column? a[1

ID: 3698334 • Letter: W

Question

What is the representation of the element at the first row and first column?

a[1][0]

a[0][0]

a[1][1]

a[0][1]

Which of the following function declaration is correct?

int f(int a[3][], int rowSize);

int f(int a[][], int rowSize, int columnSize);

int f(int[][] a, int rowSize, int columnSize);

int f(int a[][3], int rowSize);

Which of the following statements are true?

C++ allows you to separate class declaration from implementation.

The class declaration describes the contract of the class and the class implementation implements the contract.

The class declaration and implementation are in two separate files. Both files should have the same name, but with different extension names.

The class declaration simply lists all the data fields, constructor prototypes, and the function prototypes. The class implementation implements the constructors and functions.

The class declaration file has an extension name .h and the class implementation file has an extension name .cpp.

Analyze the following code:
#include <iostream>
using namespace std;
class A
{
public:
int s;
A(int newS)
{
s = newS;
}
void print()
{
cout << s;
}
};
int main()
{
A a;
a.print();
}

The program has a compilation error because class A does not have a default constructor.

The program compiles and runs fine and prints nothing.

The program would compile and run if you change A a to A a(5).

The program has a compilation error because class A is not a public class.

a[1][0]

a[0][0]

a[1][1]

a[0][1]

Which of the following function declaration is correct?

int f(int a[3][], int rowSize);

int f(int a[][], int rowSize, int columnSize);

int f(int[][] a, int rowSize, int columnSize);

int f(int a[][3], int rowSize);

Which of the following statements are true?

C++ allows you to separate class declaration from implementation.

The class declaration describes the contract of the class and the class implementation implements the contract.

The class declaration and implementation are in two separate files. Both files should have the same name, but with different extension names.

The class declaration simply lists all the data fields, constructor prototypes, and the function prototypes. The class implementation implements the constructors and functions.

The class declaration file has an extension name .h and the class implementation file has an extension name .cpp.

Analyze the following code:
#include <iostream>
using namespace std;
class A
{
public:
int s;
A(int newS)
{
s = newS;
}
void print()
{
cout << s;
}
};
int main()
{
A a;
a.print();
}

The program has a compilation error because class A does not have a default constructor.

The program compiles and runs fine and prints nothing.

The program would compile and run if you change A a to A a(5).

The program has a compilation error because class A is not a public class.

Explanation / Answer

Answer:

1. a[1][1] , In a[1][1] , first [1] represents first row, second [1] represents second columb

2. int f(int a[][3], int rowSize); , In an array , array you always need to give second dimension.

3. The class declaration file has an extension name .h and the class implementation file has an extension name .cpp , its just thedefinition of a class.

4. The program compiles and runs fine and prints nothing, everything is fine, it will run and call default constructor and print garbage or nothing.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote