MST Solution With Markingscheme 23 Oct 2024
MST Solution With Markingscheme 23 Oct 2024
cout << "The triangle with the larger area is: " << endl;
largerTriangle.display();
return 0;
}
QN Solution [Evaluation Parameter: Syntax and logic] Marks
#include<iostream> 1 mark
using namespace std;
namespace items
{
int count=20;
}
1(b) namespace customers 1 mark
{
int count=12;
}
using namespace items;
int main()
{
cout<<count; }
QN Solution [Evaluation Parameter: Syntax] Marks
2(a) #include <iostream> No marks
using namespace std;
class Car { 1 mark
private:
int speed; Irrespective of
double fuel; datatype and
punctuation.
public: 1 mark
Car(int speed, double fuel) {
this->speed = speed;
this->fuel = fuel;
}
void displayDetails() { 1 mark
cout << "Car Speed: " << speed << " km/h" << endl;
cout << "Car Fuel: " << fuel << " liters" << endl;
}};
int main() { No mark
// Create a car object with speed 120 km/h and fuel 50 liters
Car myCar(120, 50.0);
return 0;
}
2(b) Data Abstraction: Data abstraction is an OOP concept that focuses on 1 mark
exposing only the essential details of an object while hiding the complex
or irrelevant internal workings. This helps in simplifying the interaction
with the object, allowing users to work with it without needing to
understand the implementation details.
return 0;
}
QN Solution [Evaluation Parameter: Required Construct and Logic] Marks
4 #include <iostream> 1 mark
#include <string>
using namespace std;
class Recipient;
class Donor { 1 mark
private:
string donor_name;
double balance;
public:
void set_details(string name, double amount) {
donor_name = name;
balance = amount;
}
void display() {
cout << "Donor Name: " << donor_name << endl;
cout << "Donor Balance: $" << balance << endl;
}
double get_balance() {
return balance;
}
friend void transfer(Donor &donor, Recipient &recipient, double amount);
};
public:
void set_details(string name, double balance, double amount) {
recipient_name = name;
account_balance = balance;
amount_required = amount;
}
void display() {
cout << "Recipient Name: " << recipient_name << endl;
cout << "Recipient Balance: $" << account_balance << endl;
cout << "Amount Needed: $" << amount_required << endl;
}
double get_balance() const {
return account_balance;
}
friend void transfer(Donor &donor, Recipient &recipient, double amount);
};
void transfer(Donor &donor, Recipient &recipient, double amount) { 1 mark
if (donor.get_balance() >= amount) {
donor.balance -= amount; // Deduct from donor's balance
recipient.account_balance += amount; // Add to recipient's balance
cout<< " completed successfully!" << endl;
} else {
cout << "Insufficient funds for the transfer!" << endl; } }
int main() { 1 mark
Donor donor;
Recipient recipient;
donor.set_details("Alice", 500); // Donor Alice has $500
recipient.set_details("Bob", 100, 200); // Recipient Bob has $100 and needs
$200
cout << "\nDonor and Recipient Details After Transfer:" << endl;
donor.display();
recipient.display();
return 0;
}
Marking scheme of Q6
1 mark for base class constructor
1 mark for intermediate class constructor
1 mark for derived class constructor
1 mark for display function
1 mark for main
List of Evaluators
S.N. Question No. Evaluator
1 Q1 Dr. Suresh Raikwar
2 Q2 All here
3 Q3 Dr. Palika Chopra (coordinator)
4 Q4 Dr. Lokendra Vishwakarma
5 Q5 Dr. Seemu Sharma
6 Q6 Dr. Nidhi Kalra (coordinator)
Thanks