We are Permanently Move to www.VUpk.net Please Join us there.

CS201 Final term Paper 2010 - 5

Friday 3 August 2012
 FINALTERM  EXAMINATION
Spring 2010
CS201- Introduction to Programming

Time: 90 min
M a r k s: 58

Question No: 1      ( M a r k s: 1 ) 
If it is required to copy an array to another array then,
       ► Both arrays must be of the same size and data type
       ► Both arrays may be of different size
       ► Both arrays may be of different data type
       ► Both arrays may be of different size and type


Question No: 2      ( M a r k s: 1 )
Dealing with structures and functions passing  by reference is the most economical method
       ► True
       ► False


Question No: 3      ( M a r k s: 1 ) 
eof( ), bad( ), good( ), clear( ) all are manipulators.
       ► True
       ► False
(zubair,vuzs,jul2011)
Question No: 4      ( M a r k s: 1 ) 
Overloaded new operator function takes parameter of type size_t and returns
       ► void (nothing)
       ► void pointer
       ► object pointer
       ► int pointer


Question No: 5      ( M a r k s: 1 )
When new operator is overloaded at global level then corresponding built-in new operator will not be visible to whole of the program.
       ► True
       ► False


Question No: 6      ( M a r k s: 1 ) 
If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
       ► parentheses ( )
       ► braces { }
       ► brackets [ ]
       ► arrows


Question No: 7      ( M a r k s: 1 ) 
The return type of a function that do not return any value must be  ________
       ► float
       ► int
       ► void
       ► double


Question No: 8      ( M a r k s: 1 ) 
UNIX has been developed in ________ language.
       ► JAVA
       ► B
       ► C
       ► FORTRAN


Question No: 9      ( M a r k s: 1 )
Like member functions, ______ can also access the private data members of a class.
       ► Non-member functions
       ► Friend functions
       ► Any function outside class
       ► None of the given options


Question No: 10      ( M a r k s: 1 )
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.


Question No: 11      ( M a r k s: 1 )
The operator function overloaded for an Assignment operator (=) must be
       ► Non-member function of class
       ► Member function of class
       ► Friend function of class
       ► None of the given options


Question No: 12      ( M a r k s: 1 )
The endl and flush are _______
       ► Functions
       ► Operators
       ► Manipulators
       ► Objects


Question No: 13      ( M a r k s: 1 ) 
If a symbolic constant has been defined, it will be an error to define it again.
       ► True
       ► False


Question No: 14      ( M a r k s: 1 )
The operator used for casting, in C, is standard ________ operator.
       ► none of the given options.
       ► cast
       ► cost
       ► const


Question No: 15      ( M a r k s: 1 ) 
Constructors can not be overloaded like ordinary functions.
       ► True
       ► False


Question No: 16      ( M a r k s: 1 ) 
Which of the following function call is correct for the function prototype?
defaultParameters ( int a, int b = 7, char z = ‘*’ );
       ► defaultParameters (5);
       ► defaultParameters (5, ‘8’);
       ► defaultParameters (6, ‘#’);
       ► defaultParameters (0, 0, ‘*’, 0);


Question No: 17      ( M a r k s: 1 ) 
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
       ► N arguments


Question No: 18      ( M a r k s: 1 )
We can not define a variable of user-defined data type in the class.
       ► True
       ► False


Question No: 19      ( M a r k s: 1 )
When an object of a class is defined inside an other class then,
       ► Constructor of enclosing class will be called first
       ► Constructor of inner object will be called first
       ► Constructor and Destructor will be called simultaneously
       ► None of the given options


Question No: 20      ( M a r k s: 1 )
The appropriate data type to store the number of rows and colums of the matrix is____________.
       ► float
       ► int
       ► char
       ► none of the given options.


Question No: 21      ( M a r k s: 1 )
Class is a user defined___________.
       ► data type
       ► memory referee
       ► value
       ► none of the given options.


Question No: 22      ( M a r k s: 1 )
 A pointer variable can be,
       ► Decremented
       ► Incremented
       ► Multiplied
       ► Both Decremented and Decremented


Question No: 23      ( M a r k s: 1 ) 
NULL value has been defined in ______ and _________ header files.
       ► strings.h and iostream.h
       ► ctype.h and conio.c
       ► conio.c and conio.h
       ► stdlib.h and stddef.h


Question No: 24      ( M a r k s: 1 ) 
A Matrix can be composed of ints, floats or doubles as their elements. Best way is to handle this , _______________
       ► Write a separate class to handle each
       ► Use templates
       ► Use strings to store all types
       ► None of the given options


Question No: 25      ( M a r k s: 1 )
"setprecision" manipulator will set
       ► The number of digits after the decimal point
       ► The number of digits before the decimal point
       ► The number of digits in a number
       ► None of the given options


Question No: 26      ( M a r k s: 1 ) 
Which of the following option will be true, if we overload "-=" operator?
       ► only - operator needs to be overloaded
       ► Minus (-) and = operators need to be overloaded
       ► the -= operator need to be overloaded explicitly
       ► the - and = operators need to be overloaded implicitly


Question No: 27      ( M a r k s: 2 )
Suppose there is a template function ‘func’ having argument of type U and return type T. What will be the C++ syntax to call this function, passing a variable ‘x’ of type double and returning an int type?
Question No: 28      ( M a r k s: 2 )
Which variable will be used in inner code block if we have the same names of variable at outer code block and inner code block?
Question No: 29      ( M a r k s: 2 )
What is the benefit of reference and where can we use it?
Question No: 30      ( M a r k s: 2 )
Write the C++ code for the declaration of overloaded stream insertion and stream extraction operator for the object d of type Date.
Question No: 31      ( M a r k s: 3 )
What will be the output of following functions if we call these functions three times?
1)
void func1(){
int x = 0;
x++;
cout << x << endl;
}
2)
void func2(){
static int x = 0 ;
x++;
cout << x << endl ;
Question No: 32      ( M a r k s: 3 )
If the requested memory is not available in the system then what does calloc/malloc and new operator return?
Question No: 33      ( M a r k s: 3 )
Suppose an object of class A is declared as data member of class B.
(i) The constructor of which class will be called first?
(ii) The destructor of which class will be called first?
Question No: 34      ( M a r k s: 5 )
What is difference between Unary and binary operators and how they can be overloaded?
Question No: 35      ( M a r k s: 5 )
Suppose we have the following class.
class Matrix
{
private:
int Elements[3][3];
};
Write the operator function of stream extraction operator (>>) for this class.
Question No: 36      ( M a r k s: 5 )
What is meant by user interface and class interface in C++ ? And what role a class interface can play in user interface [Marks 5]

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...