Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

CS304 Final Term Papers Spring 2020 & Past Solved Papers, MCQs for Exam Preparation

 

CS304 Share Your Current Final Term Papers Spring 2020 (05 September 2020 Onward) (Questions/Pattern) & Past Papers as well here to help each other. Thanks

 

 

CS304 Solved MCQs, Short Notes, Solved Past Papers, Solved Online Quizzes, E-Books, FAQs, Short Questions Answers & More. You must view all the featured Discussions one by one in this subject group by clicking on the below link

CS304

View All Featured Discussions

Views: 1848

Replies to This Discussion

Cs304%20final%20term%20paper%20oct.docx

Cs304 final term paper oct-3-2020

 

(5marks questions)

èWrite C++ code for declaring the following:

 

Class Name:               Course

 

Attributes:

                                    Name of type String

                                    Code of type String

 

Method: 

                                    getCode()

 

 

èAnalyze the following program carefully and answer the given questions.

 

  1. Identify the error
  2. Correct the error

 

class LandVehicle{

public:

int GetMaxLoad();

};

class WaterVehicle{

public:

int GetMaxLoad();

};

class AmphibiousVehicle: public LandVehicle, public WaterVehicle {

};

int main(){

AmphibiousVehicle obj;

obj.GetMaxLoad();    

return 0;

}

 

è Carefully analyze the given C++ code and perform the following tasks:

  • Indicate the line no. containing error(s)
  • Mention the reason of error(s)
  • Correct the error(s)

 

  1. #include <iostream>
  2. #include <stdlib.h>

 

  1. using namespace std;
  2. template <typename T>
  3. class MyClass{
  4. public:
  5. MyClass(){
  6. cout"This is class1"endl;
  7. }
  8. };
  9. template <typename T>
  10. class MyClass<int*>{
  11. public:
  12. MyClass(){
  13. cout"This is class2"endl;
  14. }
  15. };
  16. int main(int argc, char *argv[])
  17. {
  18. MyClass<int> c1;
  19. MyClass<int*> c2;
  20. system("PAUSE");
  21. return 0;

}

 

èIn how many ways stack unwinding can take place. Explain any one with code example.

 

è Suppose we have a Person class with an attribute age and we want another class Voter with same attribute but with restriction that age can only be greater than 18 years. Both classes have a SetAge function that set their respective attribute age with passed value if value is fulfilling the classes conditions (value is greater than zero in case of Person class and value is greater than 18 in case of Voter class).

You have to give the code of implementation of this specialization relation in terms of classes Person and Voter in c++.

 

(3 marks questions)

è Write C++ code to inherit a complete specialization from another complete specialization.

 

è Analyze the following class diagram carefully and implement it in C++ by keeping the concept of multiple inheritance in your mind.

 

 

 

è Analyze the following program carefully and write its output.

#include<iostream>

using namespace std;

class Value

{

    private:

               int x;

    public:

            Value (int a)

            {

                 x = a;

            }

            Value( Value &b)

            {

                x = b.x;

        }

            int display( )

            {

                 return x;

            }

};

 

int main()

{

        Value c1(20);

            Value c2(c1);

            Value c3 = c1;

            Value c4 = c2;

            cout "Value of c1 = " c1.display() endl;

            cout "Value of c2 = " c2.display() endl;

            cout "Value of c3 = " c3.display() endl;

            cout "Value of c4 = " c4.display() endl;

            return 0;

}

 

è Write the general syntax of nested try catch blocks.

 

 

è class A

{

…….

string s;

…..

};

 int main()

{

A a;

     A b;

     a=b;            // copy data

}

Above is a class (only relevant part is shown). In the last statement it’s clear that some data is copied. Do you think this kind of copy respects OOP semantics? Give solid justifications.

 

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service