CS127-8L quiz3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What operator to use if you want to set more than one open mode?

or ( | )

Statement to close an ofstream outFile of filename "studentData.dat".

outFile.close();

Suppose that outFile is an ofstream variable an output is to be stored in the file "outputData.out". Which of the following statements opens the file "outputData.out" and associates outFile to the output file?

outFile.open ("outputData.out");

In structs, you access a component by using the struct name together with the relative position of the component.

False

Memory is allocated when you defined a struct.

False

Relational operators can be used on struct variables.

False

The components of the struct are called the variable of the struct.

False

A function can return a value of type struct.

True

A member of a struct can be another struct.

True

A struct can be passed as a parameter to a function by value or by reference .

True

An array can be a member of a struct.

True

Both arrays and structs are example of structured data types.

True

Data in a struct variable must be read one member at a time.

True

If all members of a struct are of the same type, you can also use an array as data structure to manipulate the data.

True

In C++, struct is a reserved word.

True

In C++, the dot (.), is an operator, called the member access operator.

True

The components of a struct are accessed by name.

True

The contents of struct variable must be written one member at a time.

True

Typically, in a program, a struct is defined before the definitions of all functions.

True

You can declare struct variables when you define the struct.

True

You can use an assignment statement to copy the contents of one struct into another struct of the same type.

True

You can use the assignment statement on structs.

True

Consider the following statements: struct rectangleData { double length, width, area, perimeter; }; rectangleData bigRect; Which of the following statements is valid in C++?

cin >> bigRect.length;

Consider the following statements: struct circleData { double radius, area, circumference; }; circleData circle; Which of the following statements is valid in C++?

cin >> circle.radius;

In C++, the _ symbol is an operator, called the indirect member access operator.

-> (dash and greater than)

The syntax for accessing a struct member is structVariableName_________.

.memberName

Which of the following is an allowed aggregate operation on a struct?

Assignment

Step number 3 for general file I/O.

Associate the file stream variables with the input/output sources.

A struct is a definition and a declaration.

False

A struct is a homogenous data structure with all components of the same type.

False

Consider the following statements: struct supplierType {string name; int supplierID; }; struct applianceType {supplierType supplier, string modelNo; double cost; }; applianceType applianceList[25]; Which of the following best decribes applianceList?

It is an array of structs

Consider the following statements: struct rectangleData { double length, width, area, perimeter; }; rectangleData bigRect; Which of the following statements correctly initializes the component length of bigRect?

bigRect.length = 10;

Consider the following statements: struct rectangleData { double length, width, area, perimeter; }; rectangleData bigRect; Which of the following statements is valid in C++?

cout << bigRect.length;

A struct variable can be passed as a parameter ______.

either by value or by reference

Consider the following statements: struct supplierType {string name; int supplierID; }; struct applianceType {supplierType supplier, string modelNo; double cost; }; applianceType applianceList[25]; Which of the following statements correctly initializes the cost of each appliance to 0?

for (int j = 0; j < 25; j++) { applianceList.cost[j] = 0; }

Library header file that contains information for performing file I/O operations.

fstream

A struct is typically a ______ data structure.

heterogenous

Consider the following statements: struct rectangleData { double length, width, area, perimeter; }; rectangleData bigRect, smallRect; Which of the following statements is legal in C++?

if (bigRect.length == smallRect.width)

Statement to close an ifstream inFile of filename "studentData.dat".

inFile.close();

Consider the following statement to open an input file stream: ifstream inFile; ______________; Supply the correct statement to open the file "progData.txt".

inFile.open("progData.txt");

File open mode where all data you write, is put at the end of the file and it calls ios::out.

ios::app

File open mode that delete all previous content in the file.

ios::trunc

To compare struct variables, you compare them ______.

member- wise

The components of a struct are called the _____ of the struct.

members

Consider the following statements: struct personalInfo {string name; int age; double height, weight; }; struct commonInfo {string name; int age }; personalInfo person1, person2; commonInfo person3, person4; Which of the following statements is valid in C++?

person2 = person1;

Consider the following struct definition: struct rectangleData { double length, width, area, perimeter; }; Which of the following variable declaration is correct?

rectangleData myrectangle;

Which of the following struct definitions is correct in C++?

struct studentType { int ID; } ;

Consider the following statements: struct studentType1 {string name; int ID; double gpa; }; studentType1 stud1, stud2; struct studentType2 {string name; int ID; double gpa; }; studentType2 stud3, stud4; Which of the following statements is valid in C++?

stud1.ID = stud3.ID;

Consider the following statements: struct supplierType {string name; int supplierID; }; struct paintType {supplierType supplier, string color, paintID; }; paintType paint; What is the data type of paint.supplier?

supplierType

You can assign the value of one struct variable to another struct variable of _ type.

the same


Set pelajaran terkait

Biology Chapter 49: Osmoregulation

View Set

Anatomy of Abdomen Part 1- Peritoneum

View Set

Health and Society Exam 2 Review

View Set

Comparing Poetry: Poetic Devices

View Set

BYU APUSH/APHIST Part 1 All Questions

View Set