CS201 Current FinalTerm Paper 22 August 2016

CS201 Current FinalTerm Paper 22 August 2016

11     What is returned by new operator?
22      Which bitwise operator returns true if both bits are different and returns false if both bit are the same?
33      When does an get destroyed?
4 4  Suppose an object of class A is declared as data member of class B:

a.       The constructor of which class will be called first?
b.      The destructor of which class will be called first?

45       Assume that you write a program to read the data from a text file. You have two options to do it, either read the data character by character or reading multiple lines of data at a time. Which option do you think is more better and why?

66      What do you understand by keyword ‘this’ and what are the uses of ‘this’ pointer?
The keyword of ‘this’ we can using the pointer of the object or class. There was trement of this operator easy can understand of keyword?

77    Write a program which defines two variables var1 and var2 of type int and stores two different values in these variables. Print the values of these variable in three different number systems using manipulators dec, hex, oct.
  8  Write a program in C++, which will prompt the user to input 8 values for a 2x4 matrix. The display those values in 2x4 matrix format.
/* Program Output will look like this:
Enter eight values for a 2x4 Matrix:
Matrix entered in its original matrix format:
1              2              3              4
5              6              7              8

9. Identify the errors in the given code and correct them.
for ( int i==0; j<numRows; i--)
for (int j=0;) j<numCols; j--)
elements [I, j] == m.elements[i][j];

110   What will be the output of the following code snipper?
int x = 10;
int &y=x,
cout << x.

   11   Write down the output of the code given below?
#include <iostream>
using name space std;
union Num
{iInt     ValueI,
float  ValueF,
double  ValueD,
char   ValueC,
void main()
// Optional union keyword
// ValueI = 100
Num TestVal = (100),
count <<”\nInteger=”<<testVal ValueI<<endl;
TestVal ValueF =2.123
count <<”Float=”<<TestVal ValueF<<endl;
count <<”Uninitialzed double=”<<TestVal ValueD<<endl;
cout<<”Some rubbish???”<<endl;
TestVal ValueC=’U’,
cout<<”Character=”<<TestVal ValueC<<endl;

1  12  Following code segment contains errors. Give brief description of each error.
Class circle:
double centerX,
double center,
double radius,

Welcome to Our WebSite! - | Virtual Ning | Pakistan NO # 1 . Website for the Students of Virtual University.

Click here for Comments