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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started