adplus-dvertising

NPTEL An Introduction To Programming Through C++ Assignment 11 Answers 2022

NPTEL An Introduction To Programming Through C++ Assignment 11 Answers 2022 :- Here All The Questions and Answers Provided to Help All The Students and NPTEL Candidate as a Reference Purpose, It is Mandetory to Submit Your Weekly Assignment By Your Own Understand Level.

 

Are you looking for the Assignment Answers to NPTEL An Introduction To Programming Through C++ Assignment 11 Answers 2022? If Yes You are in Our Great Place to Getting Your Solution, This Post Should be help you with the Assignment answer to the National Programme on Technology Enhanced Learning (NPTEL) Course “NPTEL An Introduction To Programming Through C++ Week 11 Solution 2022

 

An Introduction To Programming Through C++

From My Side : This course provides an start to problem solving and programming using the C++ programming language. The topics tallying together occurring:
Basic programming notions. Control flow, variables and assignments statements, conditional be swift, looping, action calls including recursion. Arrays and structures. Elementary aspects of classes. Heap memory.
Program design. How human beings solve problems manually. Strategies for translating calendar strategies to computer programs. Organizing large programs into units such as functions and classes. Introduction to assertions and invariants.
Programming applications. Arithmetic going a propos for polynomials, matrices. Root finding. Sorting and searching. Design of editors and simulators, including graphical editors. Elementary buoyancy. A rudimentary graphics system will be discussed.
Standard Library of C++. The string, vector and map classes.
C++ is an slant-oriented programming language which gives a sure structure to programs and allows code to be reused, lowering fee costs

This course provides an introduction to problem solving and programming using the C++ programming language. The topics include:

  • Basic programming notions. Control flow, variables and assignments statements, conditional execution, looping, function calls including recursion. Arrays and structures. Elementary aspects of classes. Heap memory.
  • Program design. How human beings solve problems manually. Strategies for translating manual strategies to computer programs. Organizing large programs into units such as functions and classes. Introduction to assertions and invariants.
  • Programming applications. Arithmetic on polynomials, matrices. Root finding. Sorting and searching. Design of editors and simulators, including graphical editors. Elementary animation. A rudimentary graphics system will be discussed.
  • Standard Library of C++. The string, vector and map classes.
INTENDED AUDIENCE : BE/BTech  in all disciplines BCA/MCA/M. Sc
INDUSTRY SUPPORT   : All IT Industries

CRITERIA TO GET A CERTIFICATE

This course can have Associate in Nursing unproctored programming communication conjointly excluding the Proctored communication, please check announcement section for date and time. The programming communication can have a weightage of twenty fifth towards the ultimate score.

Final score = Assignment score + Unproctored programming exam score + Proctored Exam score
  • Assignment score = 25% of average of best 8 assignments out of the total 12 assignments given in the course.
  • ( All assignments in a particular week will be counted towards final scoring – quizzes and programming assignments). 
  • Unproctored programming exam score = 25% of the average scores obtained as part of Unproctored programming exam – out of 100
  • Proctored Exam score =50% of the proctored certification exam score out of 100
YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF ASSIGNMENT SCORE >=10/25 AND
UNPROCTORED PROGRAMMING EXAM SCORE >=10/25 AND PROCTORED EXAM SCORE >= 20/50. 
If any one of the 3 criteria is not met, you will not be eligible for the certificate even if the Final score >= 40/100. 

CHECK HERE OTHERS NPTEL ASSIGNMENTS ANSWERS 

BELOW YOU CAN GET YOUR NPTEL An Introduction To Programming Through C++ Assignment 11 Answers 2022? :

 

NPTEL An Introduction To Programming Through C++ Assignment 11 Answers 2022

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 By SciShowEngineer:- 25100

Answer By SciShowEngineers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW

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 By SciShowEngineer: 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 By SciShowEngineer: 65

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

Answer By SciShowEngineer: 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 By SciShowEngineer: 28

👇FOR NEXT WEEK ASSIGNMENT Answer By SciShowEngineerS👇

Q6. Answer By SciShowEngineer 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 By SciShowEngineer:- T

Q7. Answer By SciShowEngineer 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 By SciShowEngineer: T

Consider the following code fragment.

map<string, set<string>> friends;
friends[“Dharmendra”].insert(“Amitabh”);
friends[“Dharmendra”].insert(“Vinod”);
cout << friends[“Dharmendra”].count(“Amitabh”) << endl;
cout << friends[“Dharmendra”].size() << endl;
Q8. What number is printed first?

Answer By SciShowEngineer: 1

Q9. What number is printed second?

Answer By SciShowEngineer: 2

If there are any changes in Answer By SciShowEngineers will notify you on telegram so you can get a 100% score, So Join

Q10. I have information about which cities are in which countries. Using this information I want to write a program that Answer By SciShowEngineer 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 map mapping each country to a vector containing cities in that country.
A map mapping each country to a set containing cities in that country.
A map mapping each city to the country in which it is present.
Answer By SciShowEngineer: b

Programming Assignment Answer By SciShowEngineers:-
Q1. In processing documents, we often build something called an index, or an inverted index. This is simply a set of pairs (word, occurrences)where word is a word occurring in the document, and occurrences is a sequence of integers giving the positions (in increasing order) at which theword occurs. You are to write a program which takes a document as input and prints the index for it, with the words in ascending order (lexicographically).

Code:-

int main()
{
string s;

int i=0,second;
bool end=false;
map<string,vector<int>>word;
while(!end)
{
cin>>s;
if(s[s.size()-1]==’.’)
{
s.resize(s.size() – 1);
end=true;
}

word[s].push_back(i++);
}
for(auto it:word)
{
cout<<it.first;
for(auto index:it.second)
cout<<‘ ‘<<index;
cout<<endl;
}
return 0;
}
Q2. In the lectures we discussed a way to store a fare table: a fare table gives the fare between two cities, and is stored in the following data structure:

Code:-

map<string ,map<string,double>> faretable;
int findfare(string c1,string c2)
{
map<string, map<string, double> >::iterator itr;
map<string, double>::iterator ptr;
for(itr = faretable.begin(); itr != faretable.end(); itr++)
{

for(ptr = itr->second.begin(); ptr != itr->second.end(); ptr++)
{
if((itr->first==c1 && ptr->first==c2)||(itr->first==c2 && ptr->first==c1))

{
return ptr->second;
}
}
}

return 0;
}

int main()
{
string s,c1,c2,c;

double f;
bool end=false;
int flag;

map<string, map<string,double> >::iterator itr,itr1;
map<string,double>::iterator ptr,ptr1;

while(!end)
{
cin>>s;

if(s==”Insert”)
{

cin>>c1>>c2>>f;
faretable[c1][c2]=f;
}
else if(s==”Fare”)
{
cin>>c1>>c2;
flag=findfare(c1,c2);
if(flag==0)
cout<<“unknown”<<endl;
else
cout<<flag<<endl;
}
else if(s==”Onechange”)
{
cin>>c1>>c2;
flag=findfare(c1,c2);
if(flag!=0)
cout<<flag<<endl;

else
{
for(itr=faretable.begin(); itr!= faretable.end(); itr)
{
for(ptr=itr->second.begin(); ptr!=itr->second.end(); )
{
if(c1==itr->first)
{
c=ptr->first;
flag=findfare(c,c2);
if(flag==0)
continue;
else
goto L;
}
}
}
}
L:if(flag==0)
cout<<“impossible”<<endl;
else
cout<<(flag+ptr->second)<<endl;
}

else

end=true;
}
return 0;
}

NPTEL An Introduction To Programming Through C++ Programming Assignment 11 Answers 2022

 

Related Posts

Leave a Reply

Your email address will not be published.