Can anyone help me solve these C++ questions? Please give a detailed explanation
ID: 3699066 • Letter: C
Question
Can anyone help me solve these C++ questions? Please give a detailed explanation toward why a choice is correct so I can understand.
1.) Which of the following C code segments will produce a syntax error? Select all that apply.
typedef struct {
float acceleration;
int users;
} coaster;
coaster C1;
struct coaster {
int users;
float acceleration;
coaster Hulk;
};
struct coaster C1;
struct {
float acceleration;
int users;
} MrFreeze;
struct coaster {
float acceleration;
int users;
};
coaster Revolution;
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.) What is the output of the following code segment?
int coaster_wait[9] = {100, 90, 80, 75, 20, 30, 90, 0, 45};
int *titan = coaster_wait;
int *giant = coaster_wait + 1;
if (giant - titan < 0)
cout << "Giant Wait Time Too Long";
else if (titan > giant)
cout << "Titan Wait Time Too Long";
else if (titan + 4 == giant + 3)
cout << "Equal Wait Time";
else
cout << "Undetermined Wait Time";
Possible Answers:
a.) Giant Wait Time Too Long
b.) Equal Wait Time
c.) Undetermined Wait Time
d.) Titan Wait Time Too Long
Explanation / Answer
Question 1
Answer:
struct {
float acceleration;
int users;
} MrFreeze;
struct coaster {
float acceleration;
int users;
};
coaster Revolution;
b.) Equal Wait Time
Question 2
Answer:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.