Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1)Which of the following struct definitions is correct in C++? a. struct studentType { int ID = 1; }; b. struct studentType { int ID;

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

a.

struct studentType { int ID = 1; };

b.

struct studentType { int ID; };

c.

int struct studentType { ID; }

d.

struct studentType { string name; int ID; double gpa;

}

2. A struct variable can be passed as a parameter ____.

a.

only by const

b.

only by reference

c.

only by value

d.

either by value or by reference

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

True

False

4) Consider the following statements. struct circleData { double radius; double area; double circumference; };

circleData circle; Which of the following statements is valid in C++?

a.

cin >> circle.radius;

b.

cin >> circle;

c.

cin >> circle.radius; circle.area = 3.14 * radius * radius;

d.

cin >> circle.radius; circle.area = 3.14 * circle.radius * radius;

5.

Typically, in a program, a struct is defined ____ in the program.

a.

in the main function

b.

before the definitions of all the functions

c.

after the definitions of all the functions

d.

in any function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

41 External labor markets and/or economic factors.

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago