Monday, July 4, 2011

CS201 Final Term Past Solved Paper 6


FINALTERM EXAMINATION
Spring 2010 CS201- Introduction to Programming
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

Dealing with structures and functions passing by reference is the most economical method
  True  False


eof( ), bad( ), good( ), clear( ) all are manipulators.
  True       False

 Overloaded new operator function takes parameter of type size_t and returns
  void (nothing)   void pointer
  object pointer     int pointer
   
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

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 < >

The return type of a function that do not return any value must be ________
  float   int   void   double
 
UNIX has been developed in ________ language.
  JAVA   B  C   FORTRAN

Like member functions, ______ can also access the private data members of a class.

Non-member function Friend functions Any function outside class None of the given options

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.

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

The endl and flush are _______
  Functions Operators Manipulators  Objects

If a symbolic constant has been defined, it will be an error to define it again.
  True    False 

The operator used for casting, in C, is standard ________ operator.
  none of the given options. cast   cost   const

Constructors can not be overloaded like ordinary functions.
  True    False 

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);

 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

Wecan not define a variable of user-defined data type in the class.
True     False

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

The appropriate data type to store the number of rows and colums of the matrix is____________.
float  int   char  none of the given options.

Class is a user defined___________.
  data type  memory referee  value  none of the given options.

A class is a user defined data type

Question No: 22      ( Marks: 1 ) - Please choose one


 A pointer variable can be,

       Decremented

       Incremented

       Multiplied

       Both Decremented and Decremented


Question No: 23      ( Marks: 1 ) - Please choose one


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


NULL has been defined in the header files stdlib.h and stddef.h.

Question No: 24      ( Marks: 1 ) - Please choose one


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      ( Marks: 1 ) - Please choose one


"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

setprecision. This is the parameterized, inline- manipulator that sets the places after the decimal point.

Question No: 26      ( Marks: 1 ) - Please choose one


Which of the following option will be true, if we overload "-=" operator?


       only - operator needs to be overloaded (not sure)

        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      ( Marks: 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      ( Marks: 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      ( Marks: 2 )


What is the benefit of reference and where can we use it?



Question No: 30      ( Marks: 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      ( Marks: 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      ( Marks: 3 )


If the requested memory is not available in the system then what does calloc/malloc and new operator return?



Question No: 33      ( Marks: 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      ( Marks: 5 )


What is difference between Unary and binary operators and how they can be overloaded?



Question No: 35      ( Marks: 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      ( Marks: 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]

No comments:

Post a Comment

Contact Form

Name

Email *

Message *