Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 void printArray(T list[], int arraySize) { for (int i = 0; i < arraySize; i++) { cout << list[i] << " "; } cout << endl; } Which of the following statements are correct?

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 s;

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

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

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

=+ Who do you think is right? Why?

Answered: 1 week ago