What is Programming in Modern C++?
This course introduces 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 techniques to computer programs. Organizing large programs into units such as functions and classes. Introduction to assertions and invariants.
- Programming applications. Arithmetic on polynomials, and 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.
W6_Programming_Qs-1
Due on 2023-03-09, 23:59 ISTComplete the program with the following instructions. • Fill in the blank at LINE-1 with proper access specifier. • Fill in the blanks at LINE-2 to declare area() as a pure virtual function.The program must satisfy the given test cases.
Solution :
#include<iostream>
using namespace std;
class Shape{
protected: //LINE-1
double ar;
public:
virtual void area() = 0; //LINE-2
void show(){
cout << ar << " ";
}
};
Complete the program with the following instructions.
• Fill in the blank at LINE-1 with proper access specifier.
• Fill in the blanks at LINE-2 to declare area() as a pure virtual function.
The program must satisfy the given test cases.
Solution :
#include<iostream>
using namespace std;
class Shape{
protected: //LINE-1
double ar;
public:
virtual void area() = 0; //LINE-2
void show(){
cout << ar << " ";
}
}; |
W6_Programming_Qs-2
Due on 2023-03-09, 23:59 IST
Consider the following program with the following instructions.
• Fill in the blank at LINE-1 with appropriate destructor declaration.
• Fill in the blank at LINE-2 with appropriate initialization list of derived class constructor.
The program must satisfy the sample input and output.
Solution :
#include<iostream>
using namespace std;
class Base{
public:
Base(){ cout << "1 "; }
Base(int n){ cout << n << " "; }
virtual ~Base(){ cout << "2 "; }; //LINE-1
};
class Derived : public Base{
int num;
public:
Derived(){ cout << "3 "; }
Derived(int n) : Base(n), num(n*3){ cout << num << " "; } //LINE-2
virtual ~Derived(){ cout << "4 "; }
}; |
W6_Programming_Qs-3
Due on 2023-03-09, 23:59 IST
Consider the following program. Fill in the blanks as per the instructions given below:
• Fill in the blanks at LINE-1 with an appropriate keyword.
• Fill in the blank at LINE-2 with an appropriate function declaration.
• Fill in the blank at LINE-3 with an appropriate statement.
such that it will satisfy the given test cases.
Solution :
#include<iostream>
using namespace std;
class B{
protected:
int s;
public:
B(int i=0) : s(i){}
virtual ~B(){ } //LINE-1
virtual int fun(int x) = 0; //LINE-2
};
class D : public B{
public:
D(int i) : B(i) {}
~D();
int fun(int x){
return s+x;
}
};
class Z{
public:
void fun(int a, int b){
B *t = new D(a); //LINE-3
int i = t->fun(b);
cout << i << " ";
delete t;
}
}; |
CRITERIA TO GET A CERTIFICATE
Average assignment score = 25% of the average of the best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100
Final score = Average assignment score + Exam score
YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND THE EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.
| An Introduction To Programming Through C++ | Answers |
| Assignment 1 | Click Here |
| Assignment 2 | Click Here |
| Assignment 3 | Click Here |
| Assignment 4 | Click Here |
| Assignment 5 | Click Here |
| Assignment 6 | Click Here |
| Assignment 7 | NA |
| Assignment 8 | NA |
| Assignment 9 | NA |
| Assignment 10 | NA |
| Assignment 11 | NA |
| Assignment 12 | NA |
Comments
Post a Comment