An Introduction To Programming Through C++

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

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

 

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

Q1. Which of the following is true

a. The code creates a structure type named x.
b. The code creates a structure variable named x.
c. The code creates variables y and z.
d. The code has a syntax error.

Answer By SciShowEngineer:- a. The code creates a structure type named x.

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

Q2. What is the value of Q.x?

Answer By SciShowEngineer: 60

Q3. What is the value of L2.p1.y?

Answer By SciShowEngineer: 12

Q4. Which of the following statements will be syntactically incorrect following the code given above?

L1 = L2;
L1.p1 = L2;
L1.p2 = L2.p1;
L2.p2.x = L2.p1.y;

Answer By SciShowEngineer: b. L1.p1 = L2;

Q5. What should blank1 be?

Answer By SciShowEngineer: marklist[i].name[0]

👇FOR NEXT WEEK ASSIGNMENT Answer By SciShowEngineerS👇

Q6. What should blank2 be?

Answer By SciShowEngineer:- marklist[i].marks

Q7. What is the first number printed?

Answer By SciShowEngineer: 12

Q8. What is the second number printed?

Answer By SciShowEngineer: 9

Q9. Which of these lines give a compiler error:

Line 1, Line 2
Line 2, Line 3
Only Line 3
Only Line 1
Answer By SciShowEngineer: c

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

Q10. We can prevent the compiler error by:

Writing a constructor for the Counter class
Changing the access specifier for the member variable x
Changing the access specifier for the member function inc
Including iostream in the program
Answer By SciShowEngineer: b

Q11. Which the following is true?

Answer By SciShowEngineer: b

Q12. Which of the following is true?

Answer By SciShowEngineer: a

Q13. What is the first number printed by this code?

Answer By SciShowEngineer: 15

Q14. What is the second number printed by this code?

Answer By SciShowEngineer: 5

Q15. What is the third number printed by this code?

Answer By SciShowEngineer: 16

Q16. What is the fourth number printed by this code?

Answer By SciShowEngineer: 5

 

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

Programming Assignment Answer By SciShowEngineers:-
Q1. Define a class for storing time durations. A time duration is a triple h, m, s of non negative integers, respectively denoting the number of hours, minutes and seconds. The numbers should satisfy the natural condition that h >= 0, 60 > m >=0, and 60 > s >= 0. Define constructors that create a duration given arguments h, m, s, and also a constructor with no arguments which creates a duration of 0 hours 0 minutes 0 seconds. It should be possible to add durations but in the result duration you should ensure that the natural condition is satisfied. Similarly it should be possible to multiply a duration D by a non negative integer I, this should result in a duration that is I time as large as D. Again the result should satisfy the natural constraints. Thus 4 times 1 hour 30 minutes 23 seconds should give the duration 6 hours 1 minute 32 seconds. Finally the class should support a member function print which prints h,m,s i.e. only with intervening commas and no spaces nor new lines.

Code:-

class Duration
{
int hour, min, sec;
public:
Duration(int h, int m, int s)
{
hour = h;
min = m;
sec = s;
}
Duration()
{
hour = 0;
min = 0;
sec = 0;
}
void format()
{
min = min + sec / 60;
hour = hour + min / 60;
sec = sec % 60;
min = min % 60;
}
Duration operator +(Duration &d)
{
Duration t;
t.sec = sec + d.sec;
t.min = min + d.min;
t.hour = hour + d.hour;
t.format();
return (t);
}
Duration operator *(int i)
{
Duration t;
t.sec = sec*i;
t.min = min*i;
t.hour = hour*i;
t.format();
return(t);
}
void print()
{
cout << hour << “,” << min << “,” << sec;
}
};
Q2. Rectangles whose sides are parallel to the coordinate axes can be represented by specifying the coordinates of diagonally opposite vertices.Suppose the southwest and northeast corners are (x1, y1) and (x3, y3). Clearly these 4 numbers determine the other two corners as well:they will be (x1, y3) and(x3 , y1). Define a struct Rect with integer members x1, y1, x3, y3. Define a function intersect which takes 2

Code:-

struct Rect
{
int x1, y1, x3, y3;
};
struct Rect intersect(struct Rect r1, struct Rect r2)
{
struct Rect r;
if((r1.x1 >= r2.x3) || (r2.x1 >= r1.x3) || (r1.y1 >= r2.y3) || (r2.y1 >= r1.y3))
{
r.x1 = r.x3 = r.y1 = r.y3 = 0;
}
else
{
if(r1.x1 > r2.x1)
r.x1 = r1.x1;
else
r.x1 = r2.x1;
if(r1.y1 > r2.y1)
r.y1 = r1.y1;
else
r.y1 = r2.y1;
if(r1.x3 < r2.x3)
r.x3 = r1.x3;
else
r.x3 = r2.x3;
if(r1.y3 < r2.y3)
r.y3 = r1.y3;
else
r.y3 = r2.y3;

}
return (r);
}