vu cs605 Mid Term Subjective Solved Past Paper No.1

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 1: Identify the errors in the following code segment and give the reason of errors.
main(){
int x = 10
const int *ptr = &x ;
*ptr = 5 ;
}
Answer:
Int x=10….No ending semicolon. *ptr=5... Declaring a pointer to constant integer. You cannot use this pointer to change the value being pointed to.
Question 2: Identify the errors in the following member operator function and also correct them.
math * operator(math m);
math * operator (math m)
{
math temp;
temp.number= number * number;
return number;
}
Answer:

The errors are in the arguments of the member operation function and also in the body of operator member function. Correct function should be

math *operator (math *m) {
math temp;
temp = m;
temp.number= number * number;
return temp.number;
}
Page. No. 9/15
Question 3: If int array[10]; is an integer array then write the statements which will store values at Fifth and Ninth location of this array,
Answer:
cout <<"Enter fifth postion ";
cin >> array[4];
cout <<"Enter Ninth postion ";
cin >> array[8];
Question 4: If is not available in the system then what does calloc/malloc and new operator return?
Answer:
calloc/malloc and new operator return returns a null pointer to indicate that no memory is available
Question 7: Is it possible to define two functions as given below. Justify your answer.
func(int x, int y)
func(int &x, int &y)
Answer:
Yes, function can be defined in both given ways, as in function no.1 , function is calling the variable by its value (which is default function call method). In the second function, function call is done by using call by reference methos.
Question 8: Let we have a class,
class String {
private:
char buf[25];
};
Write code for assignment (=) operator function which assign one String object to other object. Your code should also avoid self assignment
Answer:
void String::operator = ( const String &other ) {
int length ;
length = other.length();
delete buf;
buf = new char [length + 1];
strcpy( buf, other.buf );
}Page. No. 15/15
Question 10: Read the given below code and explain what task is being performed by this function
Matrix :: Matrix ( int row , int col ) {
numRows = row ;
numCols = col ;
elements = new ( double * ) [ numRows ] ;
for ( int i = 0 ; i < numRows ; i ++ ) {
elements [ i ] = new double [ numCols ] ;
for ( int j = 0 ; j < numCols ; j ++ )
elements [ i ] [ j ] = 0.0 ;
}
}
Hint : This function belong to a matrix class, having
Number of Rows = numRows
Number of Columns = numCols
Answer:
In the above mentioned code, first of all programmer call the constructor who have two parameters for the number of rows & columns in the matrix. Then this constructor also dynamically allocates the memory for the elements of the matrix & also initializes the value of the all elements of matrix with 0.0

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