Dear Students, Here you can read Today's CS201 final term Paper of Spring 2017 shared by Virtual University Student. You can read CS201 final term paper from 12 August 2017 to 24 August 2017. This paper is very helpful for you.
Current Spring Paper CS201 22 August
CS201 Current Paper 22 August 2017
QUESTION NO 1
All A template function must have at least ———- generic data type
► Zero
► One (Page 499)
► Two
► Three
QUESTION NO 2
Which of the following statement is best regarding declaration of friend function?
► Friend function must be declared after public keyword
► Friend function must be declared after private keyword.
► Friend function must be declared at the top within class definition.
► It can be declared anywhere in class as these are not affected by the public and private keywords. (Page346)
QUESTION NO 3
Class is a user defined___________.
► data type (Page 317)
► memory referee
► value
► none of the given options.
QUESTION NO 4
Which of the following is the correct C++ syntax to allocate space dynamically for an array of 10 int?
► new int(10) ;
► new int[10] ;
► int new(10) ;
► int new[10];
QUESTION NO 5
A Pointer is a special variable that contain
► Data values
► Memory Address (Page 267)
► Both data and values
► None of the given option
QUESTION NO 6
Operator overloading can be performed through__________________.
► Classes
► Function (Page 371)
► Operators
► Reference
QUESTION NO 7
C is widely known as development language of _______ operating system.
► Linux
► Windows
► Unix (Page 12)
► Mac OS
QUESTION NO 8
new and delete are _____ whereas malloc and free are _____.
► Functions, operators
► Classes, operators
► Operators, functions (Page 342-285)
► Operators, classes
QUESTION NO 9
Like member functions, ______ can also access the private data members of a class.
► Non-member functions
► Friend functions (Page 346)
► Any function outside class
► None of the given options
QUESTION NO 10
In if structure the block of statements is executed only,
► When the condition is false
► When it contain arithmetic operators
► When it contain logical operators
► When the condition is true (Page 38)
QUESTION NO 11
Friend function of a class is ______________ .
► Member function
► Non-member function (Page 348)
► Private function
► Public function
QUESTION NO 12
The first parameter of operator function for << operator,
► Must be passed by value
► Must be passed by reference (Page 446)
► Can be passed by value or reference
► Must be object of class
QUESTION NO 13
While calling function, the arguments are assigned to the parameters from _____________.
► left to right. (Page 295)
► right to left
► no specific order is followed
► none of the given options.
QUESTION NO 14
Which of the following is used with bit manipulation?
► Signed integer
► Un-signed integer (Page 245)
► Signed double
► Un-signed double
QUESTION NO 15
Classes defined inside other classes are called ________ classes
► looped
► nested (Page 492)
► overloaded
► none of the given options.
QUESTION NO 16
The code is written to __________ the program.
► implement (Page 520)
► design
► analysis
► none of the given options.
QUESTION NO 17
What does (*this) represents?
► The current function of the class
► The current pointer of the class
► The current object of the class (Page 390)
► A value of the data member
QUESTION NO 18
What will be the correct syntax to access the value of fourth element of an array using pointer ptr?
► ptr[3]
► (ptr+3)
► *(ptr+3)
► Both 1and 3
QUESTION NO 19
The return type of a function that do not return any value must be ________
► float
► int
► void (Page 79)
QUESTION NO 20
UNIX has been developed in ________ language.
► JAVA
► B
► C (Page 12)
► FORTRAN
QUESTION NO 21
When an operator function is defined as member function for a binary Plus (+) operator then the number of
argument it take is/are.
► Zero
► One
► Two (Page 371)
► N arguments’
QUESTION NO 22
The appropriate data type to store the number of rows and columns of the matrix is____________.
► float
► int (Not sure)
► char
► none of the given options.
QUESTION NO 23
The programs, in which we allocate static memory, run essentially on ________
► Heap
► System Cache
► None of the given options
► Stack (Page 280)
QUESTION NO 24
While calling function, the arguments are assigned to the parameters from _____________.
► left to right. (page 295)
► right to left
► no specific order is followed
► none of the given options.
QUESTION NO 25
In the member initialize list, the data members are initialized,
► From left to right
► From right to left
► In the order in which they are defined within class
► None of the given options
QUESTION NO 26
Which of the following function(s) is/are included in ctype.h header file?
► isdigit(int c)
► isxdigit(int c )
► tolower(int c)
► All of the above (Page 188)
QUESTION NO 27
When we use manipulators in our program then which header file should be
included?
► iostream.h
► stdlib.h
► stdio.h
► iomanip.h (Page 433)
QUESTION NO 28
Overloaded delete operator function takes parameter of void pointer and returns
________.
► void
► void pointer
► pointer to an object
► pointer of type int
QUESTION NO 29
There are mainly ——————– types of software
► Two (Page 9)
► Three
► Four
► Five
QUESTION NO 30
A template function must have at least ———- generic data type
► Zero
► One (Page 499)
► Two
► Three
QUESTION ANSWER
QUESTION NO 1
Allocation:
The process of giving memory space to an object. Also see dynamic storage, static storage, and deal-location.
QUESTION NO 2
Call by reference:
Passing a pointer to an argument to a function. The function can then change the argument value. Also see call by value.
QUESTION NO 3
Write a program which defines three variables of type double which store three different values including decimal points, using set precision manipulators to print all these values with different numbers of digits after the decimal number.(5)
Answer:-
#include
int main ()
{
double x1 = 12345624.72345
double x2 = 987654.12345
double x3 = 1985.23456
cout << setprecision (3) << x1<< endl;
cout << setprecision (4) << x2 << endl;
cout << setprecision (5) << x3<< endl;
return 0;
}
QUESTION NO 4
Read the given below code and explain what task is being performed by this function 5 MARKS
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
Which one (copy constructor or assignment operator) will be
called in each of the following code segment?
1) Matrix m1 (m2);
2) Matrix m1, m2;
m1 = m2;
3) Matrix m1 = m2;
Answer:-
In this code the matrix function is defined, it get the number of rows from the user and create the row of matrix and then get the columns from the user and create the columns. The New is showing for creating more array space for the data which user enters. The elements [i][j] will print the data in matrix.
QUESTION NO 5
What will be the output of following function if we call this function by passing int 5?
template <class T>
T reciprocal(T x)
{
return (1/x);
}
Answer:-
0
The output will zero as 1/5 and its .05 but conversion to int make it
zero
Above is prototype of template class so assume passing an int and
returning an int
I hope this is very helpful for you. Share by Student of Virtual University of Pakistan.
Best of Luck
Post a Comment