Professional Documents
Culture Documents
SET A
Sl.No. Course
Outcomes PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 P10 P11 P12
1 CO1 - 2 2 - 2 - - - - - - 3
2 CO2 - 2 2 - 2 - - - - - - 3
3 CO3 - 2 2 - 2 - - - - - - 3
4 CO4 - 2 2 - 2 - - - - - - 3
5 CO5 - 2 2 - 2 - - - - - - 3
Q. MCQ Marks BL CO PO PI
No Code
1 Find the type of inheritance in which more than one 1 2 3 1 1.3.1
class inherits the property of a single base class.
a. Multiple inheritance
b. Hierarchical inheritance
c. Multi-level inheritance
d. Hybrid inheritance
compiler error.
Explanation: A Base class pointer/reference
can point/refer to a derived class object, but
the other way is not possible.
#include<iostream>
usingnamespace std;
doubledivision(int a,int b){
if( b==0){
throw"Division by zero condition!";
}
return(a/b);
}
try{
z =division(x, y);
cout<< z <<endl;
}catch(constchar*msg){
cerr<<msg<<endl;
}
return0;
}
OR
21 Write a C++ program using class templates. The 10 3 3 3 3.4.2
B template can contain multiple arguments, and it
should use the non-type arguments in addition to the
type T argument.
#include <iostream>
usingnamespacestd;
// Swap operation
swap_(&arr[j], &arr[j +
1]);
}
}
}
}
cout<<arr[size - 1] <<endl;
}
// Driver Code
intmain()
{
// Given array arr[]
floatarr[] = { 1.1, 1.2, 0.3, 4.55,
1.56, 0.6 };
constintsize_arr = sizeof(arr) /
sizeof(arr[0]);
return0;
}
OR
22 Draw a UML component diagram for an online shopping 10 3 4 4 3.4.2
B system with three related subsystems - WebStore,
Warehouses, and Accounting. The necesssary features of
Search Engine, Shopping Cart, and Authentication,
Manage Orders and Manage Customers are provided.
Draw the state chart for the order processing use case.
#include <iostream>
using namespace std;
class Mammals{
public:
void displayMammal() {
cout<< "I am mammal" <<endl;
}
};
class MarineAnimals {
public:
void displayMarine() {
cout<< "I am a marine animal" <<endl;
}
};
class BlueWhale : public Mammals, public MarineAnimals {
public:
void displayBW() {
cout<< "I belong to both the categories: Mammals as
well as Marine Animals" <<endl;
}
};
int main()
{
Mammals m;
MarineAnimals ma;
BlueWhalebw;
m.displayMammal();
ma.displayMarine();
bw.displayBW();
bw.displayMammal();
bw.displayMarine();
return 0;
}
[OR]
23 Write a C++ program for implementing the concept of 10 3 4 3 3.4.3
B class template. Create the template class myFirstclass.
Inside this, create a constructor that will initialize the two
members num1 and num2 of the class. Find minimum and
maximum of that two numbers using different data
arguments such as int, float , double and string concepts
using Function template concepts.
#include <iostream>
using namespace std;
template <class T>
class myFirstclass {
private:
T num1, num2;
public:
myFirstclass (T n1, T n2) {
num1 = n1;
num2 = n2; }
void displayResult() {
cout<< "Numbers: " << num1 << " and " << num2 << "."
<<endl;
cout<< “Minimum” << minimum(num1,num2) << endl;
cout<< “Maximum” <<maximum(num1,num2) <<endl; }
T minimum() { if(num1<num2) return num1; }
T maximum() { if(num1>num2) return num1; }
};
int main() {
myFirstclass <int>intCalc(2, 1);
myFirstclass <float>floatCalc(2.4, 1.2);
myFirstclass <double>doubCalc(22.445, 11.56);
myFirstclass <string>stringCalc(“Hello”,”Hi”);
cout<< "Int results:" <<endl;
intCalc.displayResult();
cout<<endl
<< "Float results:" <<endl;
floatCalc.displayResult();
cout<<endl
<< "Double results:" <<endl;
doubCalc.displayResult();
cout<<endl
<< "String results:" <<endl;
stringCalc.displayResult();
return 0;
}