Programming in Modern C++ Week 5 : Programming Assignment 1 2 and 3 Solutions

 

Week 5 : Programming Assignment 1

Due on 2022-03-03, 23:59 IST
Consider the following program. Fill in the blanks as per the instructions given below:

• at LINE-1 with appropriate initialization list to initialize the data members,
• at LINE-2 to call printContact(),

such that it will satisfy the given test cases.
Your last recorded submission was on 2022-03-02, 22:45 IST
Select the Language for this assignment. 
1
#include<iostream>
2
using namespace std;
3
4
class Contact{
5
    private:
6
        int phone_no;
7
        string address;
8
    public:
9
        Contact(int phone_no_, string address_) : phone_no(phone_no_), 
10
                                                      address(address_){}
11
        void printContact(){
12
            cout << "phone: " << phone_no << endl;
13
            cout << "address: " << address << endl;
14
        }
15
};
16
17
class Student : private Contact{
18
    private:
19
        int roll_no;
20
        string name;
21
    public:
22
        Student(int roll_no_, string name_, int phone_no_, string address_) 
23
                        : Contact(phone_no_, address_){
24
                          roll_no=roll_no_;
25
                          name=name_;
26
                        }    //LINE-1
27
      void printContact()
28
      {
29
        Contact ::printContact(); //LINe-2
30
      }
0
        void print(){
1
            cout << "roll: " << roll_no << endl;
2
            cout << "name: " << name << endl;
3
        }
4
5
};
6
7
int main(){
8
    int a, b;
9
    string s1, s2;
10
    cin >> a >> b;
11
    cin >> s1 >> s2;
12
    Student s(a, s1, b, s2);
13
    s.print();
14
    s.printContact();
15
    return 0;
16
}
You may submit any number of times before the due date. The final submission will be considered for grading.
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program , your assignment will not be graded and you will not see your score after the deadline.
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
23 234529
Rajiv Delhi
roll: 23\n
name: Rajiv\n
phone: 234529\n
address: Delhi\n
roll: 23\n
name: Rajiv\n
phone: 234529\n
address: Delhi\n
Passed
Test Case 2
54 239990
Komal Mumbai
roll: 54\n
name: Komal\n
phone: 239990\n
address: Mumbai\n
roll: 54\n
name: Komal\n
phone: 239990\n
address: Mumbai\n
Passed



Week 5 : Programming Assignment 2

Due on 2022-03-03, 23:59 IST
Consider the following program. Fill in the blanks as per the instructions given below:

• at LINE-1 and LINE-3 with appropriate inheritance statement,
• at LINE-2 and LINE-4 with appropriate initialization lists,

such that it will satisfy the given test cases.
Your last recorded submission was on 2022-03-02, 22:51 IST
Select the Language for this assignment. 
1
#include<iostream>
2
using namespace std;
3
4
class Vehicle{
5
    protected: 
6
        int no_of_wheels;
7
    public:
8
        Vehicle(int nw) : no_of_wheels(nw){}
9
        friend ostream& operator<<(ostream& os, const Vehicle& d); 
10
};
11
12
class Car : public Vehicle{    //LINE-1
13
    protected: 
14
        int no_of_passengers;
15
    public:
16
        Car(int nw, int np) : Vehicle(nw) {
17
          no_of_passengers=np;
18
        } //LINE-2
19
        friend ostream& operator<<(ostream& os, const Car& d); 
20
};
21
22
class Truck : public Vehicle {    //LINE-3
23
    protected: 
24
        int load_capacity;
25
    public:
26
        Truck(int nw, int lc) :  Vehicle(nw) {
27
        load_capacity=lc;
28
        } //LINE-4
0
        friend ostream& operator<<(ostream& os, const Truck& d); 
1
};
2
3
ostream& operator<<(ostream& os, const Vehicle& ob) { 
4
    os << "no_of_wheels: " << ob.no_of_wheels << endl;
5
    return os;
6
}
7
8
ostream& operator<<(ostream& os, const Car& ob) { 
9
    os << "no_of_wheels: " << ob.no_of_wheels << ", no_of_passengers: " 
10
                   << ob.no_of_passengers << endl;
11
    return os;
12
}
13
14
ostream& operator<<(ostream& os, const Truck& ob) { 
15
    os << "no_of_wheels: " << ob.no_of_wheels << ", load_capacity: " 
16
                << ob.load_capacity << endl;
17
    return os;
18
}
19
20
int main(){
21
    int i, j, k, l, m;
22
    cin >> i >> j >> k >> l >> m;
23
    Vehicle v(i);
24
    Car c(j, k);
25
    Truck t(l, m);
26
    cout << v << c << t;
27
    return 0;
28
}
You may submit any number of times before the due date. The final submission will be considered for grading.
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program , your assignment will not be graded and you will not see your score after the deadline.
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
2 4 4 6 20000
no_of_wheels: 2\n
no_of_wheels: 4, no_of_passengers: 4\n
no_of_wheels: 6, load_capacity: 20000\n
no_of_wheels: 2\n
no_of_wheels: 4, no_of_passengers: 4\n
no_of_wheels: 6, load_capacity: 20000\n
Passed
Test Case 2
3 4 6 8 50000
no_of_wheels: 3\n
no_of_wheels: 4, no_of_passengers: 6\n
no_of_wheels: 8, load_capacity: 50000\n
no_of_wheels: 3\n
no_of_wheels: 4, no_of_passengers: 6\n
no_of_wheels: 8, load_capacity: 50000\n
Passed







Week 5 : Programming Assignment 3

Due on 2022-03-03, 23:59 IST
Consider the following program. Fill in the blanks as per the instructions given below:

• at LINE-1, LINE-2 and LINE-3 with initialization list,
• at LINE-4, LINE-5 and LINE-6 with function definitions,

such that it will satisfy the given test cases.
Your last recorded submission was on 2022-03-03, 20:25 IST
Select the Language for this assignment. 
1
#include<iostream>
2
using namespace std;
3
4
class A{
5
    int a;
6
    public:
7
        A(int _a = 0);
8
        int sum(); 
9
};
10
11
class B : public A{
12
    int b;
13
    public:
14
        B(int _a = 0, int _b = 0);
15
        int sum(); 
16
};
17
18
class C : public B{
19
    int c;
20
    public:
21
        C(int _a = 0, int _b = 0, int _c = 0);
22
        int sum(); 
23
};
24
25
A::A(int _a) : a{_a}{}    //LINE-1
26
B::B(int _a, int _b) : A{_a}{b=_b;}  //LINE-2
27
C::C(int _a, int _b, int _c) : B{_a,_b}{c=_c;}    //LINE-3
28
int A::sum(){ return a;}    //LINE-4 
29
int B::sum(){ return(A::sum()+b) ;}    //LINE-5
30
int C::sum(){ return(B::sum()+c) ; }    //LINE-6
0
int main(){
1
    int a, b, c;
2
    cin >> a >> b >> c;
3
    A aObj(a);
4
    B bObj(a, b);
5
    C cObj(a, b, c);
6
    cout << aObj.sum() << ", " << bObj.sum() << ", " << cObj.sum();
7
    return 0;
8
}
You may submit any number of times before the due date. The final submission will be considered for grading.
This assignment has Public Test cases. Please click on "Compile & Run" button to see the status of Public test cases. Assignment will be evaluated only after submitting using Submit button below. If you only save as or compile and run the Program , your assignment will not be graded and you will not see your score after the deadline.
   


 
 
Public Test CasesInputExpected OutputActual OutputStatus
Test Case 1
10 20 30
10, 30, 60
10, 30, 60
Passed
Test Case 2
10 -10 10
10, 0, 10
10, 0, 10
Passed

netaji gandi Thursday, March 3, 2022
Introduction to industry 4.0 and industrial internet of things Week 5 Assignment NPTEL Jan 22

 

Week 5 : Assignment 5

Due date: 2022-03-02, 23:59 IST.
Your last recorded submission was on 2022-03-02, 20:20 IST
1 point
Amazon applies the features of IIoT to reduce the operational cost and increase the operational latency in ______________.
 
 
 
 
1 point
The smart factory features of Cisco & Fanuc include ____________.
 
 
 
 
1 point
Which of the following does John Deere facilitate?
 
 
 
 
1 point
Which of the following belongs to the building blocks of a generic business model?
 
 
 
 
1 point
The Subscription Model is capable of generating _________.
 
 
 
 
1 point
In which of the following scenarios can IoT products be used as “a proxy to sell another product”?
 
 
 
 
1 point
Which of the following raise(s) the need for new business models for IoT?
 
 
 
 
1 point
Which of the following is a type of IIoT business model?
 
 
 
 
1 point
Which of the following is/are the challenge(s) of the security framework in IIoT business model?
 
 
 
 
1 point
Which of the following is/are considered as the safety requirement(s) in IIRA infrastructure?
 
 
 
 
1 point
What is IIRA?
 
 
 
 
1 point
IIRA v1.8 includes a _____-tier architecture.
 
 
 
 
1 point
The gateway-mediated edge architecture in IIRA v1.8 consists of ___________.
 
 
 
 
1 point
How many types of IIRA viewpoints are described by IIC?
 
 
 
 
1 point
Execution of a task in the usage viewpoint of IIRA includes ______________.
 
 
 
 

netaji gandi Wednesday, March 2, 2022
NPTEL Data Analytics with Python Week 5 Quiz Assignment Solutions | Jan 2022

 

              Week5 : Asignment 5

Due date: 2022-03-02, 23:59 IST.
Your last recorded submission was on 2022-03-02, 20:07 IST
1 point
In the analysis of variance procedure (ANOVA) the term "factor" refers to:
 
 
 
 
1 point
In a problem of ANOVA, involving 3 treatments and 10 observations per treatment, SSE = 500. The MSE for this situation is:
 
 
 
 
1 point
The ‘F’ ratio in a completely randomized ANOVA is the ratio of
 
 
 
 
1 point
An ANOVA procedure is applied to data obtained from 7 samples where each sample contains 10 observations. The degrees of freedom for the critical value of F are:
 
 
 
 
1 point
In an ANOVA problem if SST = 200 and SSTR = 80, then SSE is
 
 
 
 
1 point
The critical F value with 8 numerator and 29 denominator degrees of freedom at alpha = 0.01 is
 
 
 
 
1 point
Two Independent simple random samples are taken to test the difference between the means of two populations. The standard deviations are not known, but are assumed to be equal. The sample sizes are n1 = 15 and n2 = 35. The correct distribution to use is the:
 
 
 
 
1 point
Stare true or false:
Statement: The sampling distribution of two populations P bar1 -P bar2   is approximated by a normal distribution
 
 
1 point
Mean marks obtained by male and female students of school ABCD in first unit test are shown as below.
Male Female
Sample Size 64 36
Sample Mean Marks 44 41
Population Variance 128 72

The standard error for the difference between the two means is
 
 
 
 
1 point
Mean marks obtained by male and female students of school ABCD in first unit test are shown as below.
Male Female
Sample Size 64 36
Sample Mean Marks 44 41
Population Variance 128 72

If you are interested in testing whether or not the average marks of males is significantly greater than that of females, the test statistic is:
 
 
 
 

netaji gandi

Smart India Hackathon (SIH) 2025: Complete Guide with Problem Statements, Timeline & Idea PPT Template

  Smart India Hackathon (SIH) 2025: Complete Guide with Problem Statements, Timeline & Idea PPT Template Lets Code • September 8, 2025 I...