Question: Question 1 Which data structure is appropriate to store customers waiting in line at a clinic for a flu shots? Queue Stack Linked List Array
Question 1
Which data structure is appropriate to store customers waiting in line at a clinic for a flu shots?
|
| Queue | |
|
| Stack | |
|
| Linked List | |
|
| Array |
Question 2
Suppose a template function is defined as follows: template
|
| int list[] = {1, 2, 3, 4}; printArray(list, 4); | |
|
| double list[] = {1, 2, 3, 4}; printArray(list, 4); | |
|
| int list[] = {1, 2.5, 3, 4}; printArray(list, 4); | |
|
| string list[] = {"Atlanta", "Dallas", "Houston", "Chicago"}; printArray(list, 4); |
Question 3
Suppose the rule of the party is that the participants who arrive later will leave earlier. Which data structure is appropriate to store the participants?
|
| Queue | |
|
| Stack | |
|
| Linked List | |
|
| Array |
Question 4
If you have to randomly add or delete the elements anywhere in a container and you could not know its size in advance, what containers should you use?
|
| array | |
|
| linked list | |
|
| vector | |
|
| stack |
Question 5
If the number of elements in the program is fixed, what data structure should you use?
|
| array | |
|
| stack | |
|
| linked list | |
|
| vector |
Question 6
Which of the following statements are true?
|
| Friends are used exactly the same for template and nontemplate classes. | |
|
| A nontemplate class can be derived from a class template specialization.d. Stack | |
|
| A class template can be derived from a nontemplate class. | |
|
| You can define static members in a template class. Each template specialization has its own copy of a static data field. | |
|
| A class template can be derived from a class template. |
Question 7
Which of the following two versions of the class declarations is correct? Version I: class A { public: A() { } private: A* a; int i; }; Version II: class A { public: A() { } private: A a; int i; };
|
| Both versions are wrong. | |
|
| Version I is correct. | |
|
| Version II is correct. | |
|
| Both versions are correct. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
