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

(1) The primary difference between struct and class is the default access for me

ID: 3758442 • Letter: #

Question

(1)

The primary difference between struct and class is the default access for members.

Select one:

True

False

(2)

We can give components of a record the same name as long as they are of a different data type.

Select one:

True

False

(3) A constructor that takes no parameters is called a ______ constructor. (1 word)

(4) A _______ ( 1 word) is called when you declare a variable (object) of a class's type.

(5)

:: is a scope operator that you use to designate which class a function/method belongs to.

Select one:

True

False

(6)

A struct cannot have another struct as a member.

Select one:

True

False

(7)

Which of the following aggregate operations are allowed on struct variables?

Select one or more:

a. Assignment

b. Return as a function's return value

c. Arithmetic

d. I/O

e. Argument passage

f. Comparison

(8)

By default, class members are public.

Select one:

True

False

(9)

Say we have the following struct, with the variable employee:

How do we access the field lastName of the variable employee ?

Explanation / Answer

(1)

Hence the correct option is “True”

(2)

Hence the correct option is “False”

(3)

Therefore the correct answer is “Default constructor”.

(4)

Hence the correct answer is “ constructor”.

(5)

Hence the correct answer is “ True”.

(6)

            Structure allows to have another struct. That is nested structures are allowed.

Ex:

struct sample

{

            char ch;

            struct

            {

                        int c;

            }b;

}s;

int main()

{

            cout<<"input c:";

            cin>>s.b.c;

            cout<<s.b.c;

            return 0;

}

Hence the correct answer is “False”

7)

Therefore the correct options are:

a. Assignment

f. Comparison

b. Return as a function's return value

e. Argument passage

8)

Hence the correct option is “False”

9)

Hence, we can access the lastName as follows:

employee.lastName;