Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

8 Given a container named product codes that provides a random-access iterator, which of the ollowing techniques could you use to get an iterator that

image text in transcribed
image text in transcribed
8 Given a container named product codes that provides a random-access iterator, which of the ollowing techniques could you use to get an iterator that points to the third element of the container? a. auto iter product_ codes.begin0 iter -iter + 2: b. auto iter product_codes.begin) ++iter ++iter c. auto iter -product oodes begin) d. all of the above e. a and c only iter 2 Which of the following for loops could you use to iterate the data in a vector named days if you need to be able to work with iterators within the loop? a for (auto p: days) b. for (int-0: scores 1 1 70, 80, 90, 100 vectorcint scores 2 65, 75, 5, 95 int sooze-sooros 1.back ): scores 2 push back (score) scores 2.front 0 60 acozes 2.aasign (ecores 1.begin), scores 1.begino * 3 scores 2.resize (4) a scores 2.pash back (scores 1.back ) a. 70, 80, 90, 100 b. 70, 80, 90, 0, 100 c. d. 70, 80, 90, 100, 100 60, 70, 80, 90, 100 41. Which of the following techniques could you use to define an array of strings named with S elements? a. conat int siz arraycstring, Bize> products b. arraycstring, 5> products: c. int size; ein >>size arraycstring, sire a and b only products d. all of the above e. 42. What are the values of the elements in the list named wages_1 after the following code is executed listcdouble> wages 11 10.5, 12.5, 14.5, 15.5 listcdouble> wagos 2 18.5, 21.5, 24.5 wages 2.splice (wages_2.begin ), wages_1, wages_1.begin)vages 1 end )) wages1.push-front (18.5) ; wages 1.sort ) wages 2.sort) wages 1.merge (wages 2): ages 1.remove (18.5) vages 1.pop_frontO a. 12.5, 14.5, 18.5, 21.5, 24.5 b. 12.5, 14.5, 15.5, 21.5, 24.5 c. 10.5, 12.5, 12.5, 14.5, 14.5, 15.5, 21.5,24.5 d. 10.5, 12.5, 14.5, 15.5, 21.5, 24.5 43. What are the values of the elements in the stack named products after the executed? following code is stack years2016, 1985, 2001 : yoars.insert(1992) years.insert (2001) auto iter years. find (1985); if (iter t years.end O) years.erase (iter) a. 2016, 2001, 2001, 1992 b. 2016, 2001, 1992 c. d. 1992, 2001, 2001, 2016 1992, 2001, 2016 45. Why is static cast-sint (19.23) preferred over (int) 19.237 a. (int) 19.23 leads to data loss due to demoting a double to an integer. b. (int) 19.23 forces the compiler to choose from several types of casts. c. static _cst

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions