An Introduction To Programming Through C++

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

NPTEL An Introduction To Programming Through C++ Assignment 12 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 12 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 12 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 12 Answers 2022? :

 

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

Quiz: Week 12 : Assignment 12

Q1 : 91

Q2 : 3

Q 3 : -12

Q 4 : 50

Q 5 : Whether any cities are stored for India in citiesInCountry, (0: none, 1: some).

Q 6 : c

Q7 : (a)euler1 will return the exactly correct answer for this case. (c)euler2 will return the exactly correct answer for this case.

Q 8 : (b)euler1 will not return the exactly correct answer for this case. (d)euler2 will not return the exactly correct answer for this case. ——————————————————————————– *Programming Assignment 12.1*

string pasttense(map<string,string> &m,string &verb) { if(m.find(verb)!=m.end()) return m[verb]; char lc=verb[verb.length()-1]; if(lc==’e’) return verb+”d”; return verb+”ed”; } void add(map<string,string> &m,string &verb,string &pt) { char lc=verb[verb.length()-1]; string past_tense=””; if(lc==’e’) past_tense=verb+”d”; else past_tense=verb+”ed”; if(past_tense!=pt) m[verb]=pt; }

————————————————————————– *Programming Assignment 12.2*

int open1box(vector<int> &x, int y) { int out = 1; while (true) { out++; int temp = x[y]; if (temp == 0) break; y = temp; } return out; } int open2boxes(vector<int> &x, int y, int z) { int len_x = open1box(x, y),dis = 0; int len_y = open1box(x, z); int a[len_x], b[len_y]; a[0] = y; b[0] = z; for (int i = 1; i < len_x; i++){ a[i] = x[y]; y = a[i]; } for (int j = 1; j < len_y; j++) { b[j] = x[z]; z = b[j]; } int arr[len_x+len_y]; for (int i = 0; i < len_x+len_y; i++) { if (i < len_x) arr[i] = a[i]; else arr[i] = b[i-len_x]; } for (int i = 0; i < len_x+len_y; i++) { bool flag = 1; for (int j = 0; j < i; j++) { if (arr[i] == arr[j]) {flag = 0; break;} } if (flag) dis++; } return dis; }

 

Q1. For Answer By SciShowEngineering this question you will need to see the program given in the announcement “The circuit simulator program” made on 2022-03-31. On line number 146, there is a call to a member function addNode. What is the number of the line starting from which this function is defined?

If you look at the program you will see one addNode member function starts on line number 32 and another on line number 91. You have to choose the correct line number out of these two.

Answer By SciShowEngineer:-

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

Q2. For Answer By SciShowEngineering this question you will need to see the program given in the announcement “The circuit simulator program” made on 2022-03-31. The program contains a selectNode member function. When this function executes, the computer waits for the user to click. What value will this function return if the user clicks on the third button from the top?

Answer By SciShowEngineer:

Q3. What will be the value of A[5][6]?

Answer By SciShowEngineer:

Q4. What will be the value of A[5][5]?

Answer By SciShowEngineer:

Q5. Consider the definitionmap<string,set<string> > citiesInCountry;

where citiesInCountry maps the country name to its set of cities.

What does citiesInCountry.count(“India”) return?

How many cities are there in India, as stored in citiesInCountry.
Whether any cities are stored for India in citiesInCountry, (0: none, 1: some).
This expression is invalid.
Answer By SciShowEngineer: b

👇FOR NEXT WEEK ASSIGNMENT Answer By SciShowEngineerS👇

Q6. The following code is supposed to print the cities in India, as stored incitiesInCountry.
for(auto c : citiesInCountry[“India”]) cout << blank <<‘ ‘;
What should blank be?

Answer By SciShowEngineer:- c

Q7. Suppose fdash is a constant function, i.e. the derivative is the same throughout. Suppose fdash(t) = 3 for all t, t0 = 0, t1= 1, f0=0 and n=4. These parameters are used to call euler1. Select the correct alternative(s) from the following by reasoning out or by manually executing the function. Ignore roundoff errors.

Answer By SciShowEngineer:

Q8. Suppose fdash is a linear function, say fdash(t) = 2t for all t. Suppose t0 = 0, t1= 1, f0=0 and n=4.Select the correct alternative(s) from the following by reasoning out or by manually executing the function. Ignore roundoff errors.

Answer By SciShowEngineer:

Programming Assignment Answer By SciShowEngineers:-
Q1. Given below is the main program in a program to print the past tense of a verb in the English language. If the verb ends in “e”, then it simply adds a “d” and returns the result as the past tense. If the verb ends in any other letter, it adds “ed” and returns the result. However, both these behaviours are superseded if the verb supplied to it is in an exception table that it maintains.

The exception table also holds the past tense of each word in the table, and so that is returned instead. The program can also be told that a certain word x has a certain past tense y. If y can be obtained from x using the basic rules given above, the program does nothing. If y cannot be obtained from x using the basic rules, then x, y are added to the table.

The table is implemented as a map from strings to strings. In addition, the program has a command which causes it to terminate. The main program is given below, and already entered in your submission. You only have to supply the code for the functions it calls. The code will be placed above the main program so that separate declarations are not needed.

Code:-

Q2. Suppose I have a box which contains some boxes, each of which contain more boxes and so on, for a total of n + 1 boxes. Suppose the boxes are numbered from 0 to n with the outermost box receiving the number 0. Now the configuration can be described by specifying numbers x_1, 
 , x_n,where x_i denotes the number of the box directly containing box i. For example, the configuration shown below is described by the sequence 0, 3,4, 0

Code:-

 

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