**NPTEL An Introduction To Programming Through C++ Assignment 6 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 5 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 **Nation**** al Programme on Technology Enhanced LearningÂ (NPTEL)** Course “

**NPTEL An Introduction To Programming Through C++Â Week 6Â**

**Solution 2022**”

Table of Contents

## 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.

- 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 6 Answers 2022***?** :

**?**:

## NPTEL An Introduction To Programming Through C++ Assignment 6 Answers 2022

Q1. What is V(6), the number of poetic meters of total duration 6?

Answer By SciShowEngineer: 13

Suppose I have a supply of red blocks (R) all of height 1 and blue blocks (B) all of height 3. I can stack the blocks one above the other to build a tower. For example, if I stack in the order RBR or BRR from bottom to top I will get towers of height 5. Let T(n) denote the number of towers possible of height n. Clearly T(1) is 1 because the only order possible is R.T(2) is 1 because the only possible order is RR.T(3) is 2, because the possible orders are RRR or B.

BR RB RRRR

Q2. What is T(4)?

Answer By SciShowEngineer: 3

Q3. What is T(5)?

Answer By SciShowEngineer: 4

Q4. Using the same logic as in the lecture, you could say that the bottom most block can either be red or it can be blue. Following this logic, what is T(n) equal to?

a) T(n-1) + T(n-2)

b) T(n-1) + T(n-2) + T(n-3)

c) T(n-1) + T(n-3)

d) T(n-2) + T(n-3)

Answer By SciShowEngineer: c) T(n-1) + T(n-3)

Q5. What does the call f(100) return, if f is defined as follows?Int f(n){

if (n == 0) return 0;

else return f(nâ1) + 2;

}

Answer By SciShowEngineer: 200

Q6. I will get an error if I execute s++ f1.cpp

a) True

b) False

Answer By SciShowEngineer: a) True

Q7. I will get an error if I execute s++ -c f2.cpp

a) True

b) False

Answer By SciShowEngineer: b) False

Q8. I will get an error if I execute s++ f1.cpp f3.cpp

a) True

b) False

Answer By SciShowEngineer: a) True

Q9. What is the result of executing the following program, if the input given is 3? #include <simplecpp> #include <functional> double ssum(function<double(int)> f, int n){ double sum = 0; for(int i=0; i<n; i++) sum = sum + f(i); return sum; } int main(){ int n; cin >> n; cout << ssum([](int i){return i*i;}, n)<<endl; }

Answer By SciShowEngineer: 5

Consider the following program. #include <simplecpp> int f(int a, int b, int c=10, int d=20){return a+b+c+d;} int main(){ cout<<f(5,6,7,8)<<â,'<<f(5,6,7)<<â,'<<f(5,6); }

Q10. What is the first number printed?

Answer By SciShowEngineer: 26

Q11. What is the second number printed?

Answer By SciShowEngineer: 38

Q12. What is the third number printed?

Answer By SciShowEngineer: 41

## NPTEL An Introduction To Programming Through C++ Programming Assignment 6 Answers 2022

**Q1. Suppose there are two types of blocks: Red blocks (R) of height 1 and Blue blocks (B) of height 4. These blocks can be stacked one above the other to build a tower. You have to write a program that counts the number of distinct towers of a given height n that can be built using these 2 types of blocks.**

**Note: 2 towers of the same height are called distinct if the order in which R and B blocks occur in them is different.**

**Write a recursive program that takes n and returns the number of distinct towers of height n.**

Code:-

long int tower_count (int x) {

if(x <= 3)

return 1;

return tower_count(x-4) + tower_count(x-1);

}

main_program {

int n;

cin >> n;

cout << tower_count(n) << endl;

}

**Q2. Given below is a main program with calls to a function inches. Given a distance measured in yards, feet and inches, the function is supposed toreturn the equivalent number of inches. In particular, given y, f, i as the values of the parameters yards, feet, inches, the function should returny*36+f*12+i. However, it is acceptable to call the function with just two arguments y, f, in which case they should be interpreted as yards and feet,and the value returned should be y*36+f*12. The function might also be called with a single argument y, in which case it should return y*36. Youhave to write the code for the function inches. Your code may implement inches using default values for the parameters or by overloading it. Youdo not need to give the main program. It will be added automatically. The main program is given below for your reference.**

**Note: You donât need to write/copy the main program. You just need to write the inches function, without the main_program or any of theheader files. Ensure that the function is correctly named as inches.**

main_program{

int y,f,i; cin >> y >> f >> i;

cout << inches(y,f,i) <<â,â<<inches(y,f) <<â,â<<inches(y) << endl;

}

Code:-

int inches(int y, int f = 0, int i = 0) {

int inch;

inch = y * 36 + f * 12 + i;

return inch;

}

Yhaa You have done it but next? if YOU Want to your Others * NPTEL An Introduction To Programming Through C++ Assignments Answers* Then

**Follow US HERE**and Join Telegram.