You must reserve memory for the data members when you create


1. When you define a class and add data members to it: 
You must reserve memory for the data members when you create objects.
The class automatically reserves memory for the data members.
The class automatically creates the objects for you.
The class automatically reserves the memory for private members.

2. When you declare an object: 
A class is automatically created.
The memory for its data members is reserved.
The memory for all other objects is reserved.
It will not have a constructor.

3. int myVar[3]; 
myVar contains 4 values.
myVar does not have any memory reserved for it.
The first value of myVar is stored in myVar[0]
myVar is not a valid variable name in C++

4. Find the error in this statement:

double d(4) = {1,2,3,4}; 
d is not a valid variable name
d does not contain 4 members
The initialization should use [1,2,3,4] instead of {1,2,3,4}
The declaration should use d[4] instead of d(4)

5. If variable myArray has 2 rows and 3 columns and stores integer values, it may be declared as follows: 
double myArray[3][2];
int myArray[2][3];
int myArray[3][2];
int myArray[2,3];

6. How many elements does this array have?

int myArray[4][5]; 
9
45
20
10

7. What notation would you use if you wanted to print the memory location of this variable?

int c = 3; 
c
*c
3
&c

8. If you wanted to print the memory address of this variable, what notation would you use?

int* c; 
c
*c
&c
int

9. If you want to print the value stored in c, what notation would you use to access the variable?

int c = 3; 
&c
*c
c
c[1]

10. int c = 3;
int* d;
d = &c;

Which of the following statements prints the memory address of c? 
cout << c;
cout << (*d);
cout << *c;
cout << d; 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: You must reserve memory for the data members when you create
Reference No:- TGS0128633

Expected delivery within 24 Hours