Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ multiple choice problems 1)The size of a vector: a)must be a constant. b) must be a variable. c)may be omitted when declaring the vector.

C++ multiple choice problems

1)The size of a vector:

a)must be a constant.

b) must be a variable.

c)may be omitted when declaring the vector.

d)is not known and is not relevant.

e)is established on declaration and cant be changed.

2)Which of these will fill a vector with 100 random numbers:

a) for(int i=0;i<100;i++) //Declared: V[i] = rand(); // vector V(100);

b)for(int i=0;i<100;i++) // Declared: V.push_back(rand()); // vector V;

c)i=0; while(i<100) //Declared: { // vector V; V.push_back(rand()); i++; }

d) All of them

e)None of them

3) Given the following code: vector text(2); text.push_back(XXXX); which element of the vector will get set toXXXX?

a)text[0]

b)text[1]

c)text[2]

d)text[3]

e)None, there is a syntax error

4)To declare a vector of strings, the correct definition is:

a)vector names[];

b)vector names;

c)string names();

d)string vector names[];

e)vector() names;

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_2

Step: 3

blur-text-image_3

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

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago