Question: QUESTION 1 Given the following code fragment: struct X { int x; }; int main(){ X x1; x1. x = 99; cout < < x1.x

QUESTION 1

Given the following code fragment:

struct X { int x; }; int main(){ X x1; x1. x = 99; cout << x1.x << endl; }

You get a runtime error.

The output of the program is 99

None of the other answers are correct

Program will not compile

QUESTION 2

Which syntax is the correct way to access the age field in the following struct?

struct person_t{ int age; int weight; };

person_t mary = {21, 160};

mary.getAge()

getAge(mary)

mary->age

mary.age

QUESTION 3

When a struct is defined, what do we have a new thing of?

A new variable name.

A new function.

A new data type.

A new constant variable.

QUESTION 4

If Circle is a structure tag, the following statement:

Circle doSomething(Circle c2)

can be header line for a function that ____________________

Determines and returns the area of a circle.

takes a Circle structure as a parameter, does something, and returns a Circle structure.

operates as a constant reference to a Circle structure

takes two Circle parameters and does something.

QUESTION 5

Operator and function overloading are examples of what OOP concept?

Polymorphism

inheritance

data

encapsulation

QUESTION 6

This is like a structure, except all members occupy the same memory area.

union

array

array of pointers

array

QUESTION 7

Before a structure can be used, it must be ___________________

defined

dereferenced

initialized

declared

QUESTION 8

A file must be ____________________ before data can be written or read from it.

opened

buffered

initialized

closed

QUESTION 9

To write to a file define an object of this type.

ofstream

outstream

fstream

outfile

QUESTION 10

The file should be _________ when you are done writing or reading from it

removed

closed

copied

opened

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!