An Introduction to Programming Through C++ | NPTEL 2022 | Week 11 Answers

This set of MCQ(multiple choice questions) focuses on the An Introduction to Programming Through C++ NPTEL 2022 Week 11 Answers.

Course layout

Answers COMING SOON! Kindly Wait!

NOTE: You can check your answer immediately by clicking show answer button. An Introduction to Programming Through C++ NPTEL 2022 Week 11 Assignment Answers” contains 13 questions.

Now, start attempting the quiz.

An Introduction to Programming Through C++ NPTEL 2022 Week 11 Assignment Answers

Q1. What’s printed by the following code fragment?
set<int> s;
s.insert(100);
s.insert(25);
for(auto e : s) cout << e

Answer: 25100

Q2. What is printed by the following code
map<int,int> m;
m[50] = 24;
m[3] = 77;
for (auto e : m) cout << e.first << e.second;

Answer: 3775024

Q3. Suppose during a certain execution, 5 reallocations happened due to push backs on a certain vector. What is the minimum number of elements that the vector must have at the end of the execution?

Answer: 65

Q4. How many copying operations (overhead) must have happened during the execution?

Answer: 124

Q5. Suppose at a certain time during execution a vector has 100 elements (i.e. there have been 100 pushbacks). How many more push backs can there be without causing a reallocation?

Answer: 28

An Introduction to Programming Through C++ NPTEL Week 11 Assignment Answers

Q6. Answer T if you think the following statement is true and F if false:
The total number of copying operations performed as a part of reallocation is less than twice the number of elements in the vector (i.e. the number of elements pushed back).

Answer: T

Q7. Answer T if you think the following statement is true and F if false:
The amount of memory allocated to a vector that is not in use to store elements is less than the amount of memory that is being used to store elements, i.e. the memory in use is more than the memory not in use.

Answer: F

An Introduction to Programming Through C++ NPTEL Week 11 Assignment Answers

Q8. What number is printed first?

Answer: 1

Q9. What number is printed second?

Answer: 2

Q10. I have information about which cities are in which countries. Using this information I want to write a program that answer questions of the form: (a) Is a city X in country Y. (b) Which cities are in country Y. What data structure is most convenient for representing the required information?

a) A map mapping each country to a vector containing cities in that country.
b) A map mapping each country to a set containing cities in that country.
c) A map mapping each city to the country in which it is present.

Answer: b)

An Introduction to Programming Through C++ NPTEL week 11 Assignment Solutions

An Introduction to Programming Through C++ NPTEL Week 11 Programming Assignment Answers

Programming Assignment 11.1

CODE:

Programming Assignment 11.2

CODE:

<< Prev- An Introduction to Programming Through C++ Week 10 Solutions

>> Next- An Introduction to Programming Through C++ Week 12 Solutions


DISCLAIMER: Use these answers only for the reference purpose. Quizermania doesn't claim these answers to be 100% correct. So, make sure you submit your assignments on the basis of your knowledge.

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.

Leave a Comment

Your email address will not be published. Required fields are marked *