vu cs605 Mid Term Subjective Solved Past Paper No.2

vu cs605 Software EngineeringII Solved Past Papers

Solved Past Papers

This subjective solved past paper is related to book/course code vu cs605 Software EngineeringII which belongs to vu organization. We have 4 past papers available related to the book/course Software EngineeringII. This past paper has a total of 10 subjective questions belongs to topic Mid Term to get prepared. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to get prepared for exams by learning subjective questions online on NVAEducatio.

NVAEducation also facilitates users to download these solved past papers with an affordable prices. However, users are not enforced to pay for money, rather they can use credits to buy such stuff on NVAEducation. Users can earn credits for doing some little tasks and then you will be able to use that credits to buy solved past papers on NVAEducation.

Question 2: Suppose an object of class A is declared as data member of class B.
  1. (i) The constructor of which class will be called first?
  2. (ii) The destructor of which class will be called first?
Answer:
  1. (i) The constructor of which class will be called first? Class A
  2. (ii) The destructor of which class will be called first? Class B
Question 6: Suppose we have the following class.
class Matrix {
private:
Page. No. 12/15
int Elements[3][3];
};
Write the operator function of stream extraction operator (>>) for this class.
Answer:
Element operator >> (Element &element){
cout<<element[0][0]<<element[0][1]<<element[0][2];
cout<<element[1][0]<<element[1][1]<<element[1][2];
cout<<element[2][0]<<element[2][1]<<element[2][2];
}
Question 7: What are manipulators. Give one example.
Answer:
The manipulators are like something that can be inserted into stream, effecting a change in the behavior. For example, if we have a floating point number, say pi (?), and have written it as float pi = 3.1415926 ; Now there is need of printing the value of pi up to two decimal places i.e. 3.14. This is a formatting functionality. For this, we have a manipulator that tells about width and number of decimal points of a number being printed.
Question 8: What are similarities and differences between Structures and Unions?
Answer:

In structures, we have different data members and all of these have their own memory space. In union, the memory location is same while the first data member is one name for that memory location. However, the 2nd data member is another name for the same location and so on. Consider the above union (i.e. intOrChar) that contains an integer and a character as data members. What will be the size of this unionThe answer is the very simple. The union will be allocated the memory equal to that of the largest size data member. If the int occupies four bytes on our system and char occupies one byte, the union intOrChar will occupy four bytes

-- OR --

Structure

In structures, the data members are public by default. It means that these are visible to all and anyone can change them. Is there any disadvantage of this. Think about the date.

syntax
struct student {
char name[60];
char address[100];
float GPA;
};

Unions We have another construct named union. The concept of union in C/C++ is: if we have something in the memory, is there only one way to access that memory location or there are other ways to access it. We have been using int and char interchangeably in our programs. We have already developed a program that prints the ACSII codes. In this program, we have stored a char inside an integer. Is it possible to have a memory location and use it as int or char interchangeablyFor such purposes, the construct union is used. The syntax of union is:

union intOrChar {
int i;
char c;
};
Question 9: What are the advantages and disadvantages of using templates?
Answer:

Many things can be possible without using templates but it does offer several clear advantages not offered by any other techniques:

Advantages:

Templates are easier to write than writing several versions of your similar code for different types. You create only one generic version of your class or function instead of manually creating specializations.
Templates are type-safe. This is because the types that templates act upon are known at compile time, so the compiler can perform type checking before errors occur.
Templates can be easier to understand, since they can provide a straightforward way of abstracting type information.
It helps in utilizing compiler optimizations to the extreme. Then of course there is room for misuse of the templates. On one hand they provide an excellent mechanism to create specific type-safe classes from a generic definition with little overhead.

Disadvantages:

On the other hand, if misused

Templates can make code difficult to read and follow depending upon coding style.
They can present seriously confusing syntactical problems esp. when the code is large and spread over several header and source files.
Then, there are times, when templates can "excellently" produce nearly meaningless compiler errors thus requiring extra care to enforce syntactical and other design constraints. A common mistake is the angle bracket problem.
Question 10: What are the limitations of the friendship relation between classes?
Answer:
friendship relation between classes is a one way relation that is if one class declare friend another class then the another class is the friend of first class but not the first class if the friend of another class.

Solved Past Papers of cs605 Software EngineeringII

Other cs related subjective solved past papers

Other categories of vu Solved Past Papers

Other organizations

Theme Customizer

Gaussian Texture



Gradient Background