Friday 29 April 2011

FINALTERM EXAMINATION CS201- Introduction to Programming Fall 2009

    
Question No: 1( Marks: 1 ) - Please choose one
Operating system fals under the category of ______types of software
   ► System Software
   ► Application Software
   ► Device drivers
   ► None of the above
Question No: 2( Marks: 1 ) - Please choose one
Header file fstream.h include definitions of stream classs_____
   ► ifstream.h, ofstream.h
   ► cout, cin
   iomanip.h
   ► stdlib
Question No: 3( Marks: 1 ) - Please choose one
setprecision is a parameter less manipulator.
    True
    False
Question No: 4( Marks: 1 ) - Please choose one
A friend function of a class has access
     To all data member and functions of the class
     Only to other friend functions of the class
     Only to private data of the class
     ►Only to public data of the class
Question No: 5 ( Marks: 1 ) - Please choose one
The declarator of Plus (+) member operator function is
   Class-Name operator + (Class-Name rhs)
   Operator Class-Name + ( )
   ► Operator Class-Name + ( rhs)
   Class-Name operator + ( )
Question No: 6 ( Marks: 1 ) - Please choose one
 We can change the arity (number of operands) through operator overloading.
   False
   ► True
Question No: 7( Marks: 1 ) - Please choose one
Only operator compiler loads for users is:


► Delete operator
► Assignment Operator
► New Operator
► None of the above
Question No: 8( Marks: 1 ) - Please choose one
cerr and clog are the objects of stream class
    ► True
    False
Question No: 9( Marks: 1 ) - Please choose one
Loader loads the executable code from main memory to hard disk.
   ► True
   False
Question No: 10( Marks: 1 ) - Please choose one
Pre processor Directive functions before_____ Phase.
► Compiler
► Execution
► Linking
► None of the given options
Question No: 11( Marks: 1 ) - Please choose one
A template function can not have static variables.
    True
    False
Question No: 12 ( Marks: 1 ) - Please choose one
 Consider the following code segment. What will be the output of this code
segment?
int arr[6] = {2, 3, 7, 4, 5, 6} ;
int *ptr1 =&arr[1] ;
int *ptr2 = &arr[4] ;
cout << (ptr2-ptr1) ;
►6
►7
►2
►3
Question No: 13( Marks: 1 ) - Please choose one
The UNIX system was developed in
   ► Java Language
   ► C++
   FORTRON Language


► C Language
Question No: 14( Marks: 1 ) - Please choose one
Friend function of a class are _______ of a class.
    ► Non-member functions
    Friend functions
    Any function outside class
    None of the given options
Question No: 15( Marks: 1 ) - Please choose one
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: 16( Marks: 1 ) - Please choose one
 In the S2=S1, ___ is the object that is calling or driving the = operator. ___
object is being passed as an argument to the = operator.
      ► S1, S2
      S2,S1
      =, +
      None of the Above
Question No: 17( Marks: 1 ) - Please choose one
The static data members of a class are initialized _______
   at file scope
   within class definition
   within member function
   within main function
Question No: 18( Marks: 1 ) - Please choose one
We can do condition compilation with pre processor directives.
   True
   False
Question No: 19( Marks: 1 ) - Please choose one
Self-assignment is dangerous especially at a time when we have memory
manipulation in a class
    True
    False
Question No: 20( Marks: 1 ) - Please choose one
A template function must have at least ---------- or more arguments
    Zero
    One


Two
Three
Question No: 21( Marks: 1 ) - Please choose one
 Stream insertion ( << ) and extraction operators ( >> ) are always implemented
as -- _______functions.
    ► Member
    ► Non Member
    ► Objects
    ► Classes
Question No: 22( Marks: 1 ) - Please choose one
Overloaded member operator function is always called by _______
   Class
   ► Object
   Compiler
Primitive data type
Question No: 23( Marks: 1 ) - Please choose one
 The operator function of << and >> operators are always the member function
of a class.
     True
     False
Question No: 24( Marks: 1 ) - Please choose one
Which of the following option is true about new operator to dynamically allocate
memory to an object?
   The new operator determines the size of an object
   Allocates memory to object and returns pointer of valid type
   Creates an object and calls the constructor to initialize the object
   All of the given options
Question No: 25( Marks: 1 ) - Please choose one
The prototype of friend functions must be written ____ the class and its definition
must be written ____
   ► inside, inside the class
   inside, outside the class
   outside, inside the class
   outside, outside the class
Question No: 26( Marks: 5 ) - Please choose one
 Write a simple program using the read() member function of cin object reading a
text of 30 characters from the keyboard, store them in an array and then using
write() member function of cout object to display them on the screen.
Question No: 27
( Marks: 5 ) - Please choose one


 Is it possible to define two functions as given below? Justify your answer.
func(int x, int y)
func(int &x, int &y)
Question No: 28( Marks: 3 ) - Please choose one
What care must be taken while writing macros?
Question No: 29( Marks: 3) - Please choose one
How to avoid compiler generated consructor?
Question No: 30( Marks: 3 ) - Please choose one
What are the types of templates?
Question No: 31( Marks: 3 ) - Please choose one
What is the function of flush command?
Question No: 32( Marks: 2 ) - Please choose one
How to increase the already allocated chunk of memory?
Question No: 33( Marks: 10 ) - Please choose one
Write a C++ program which enable user to enter values in 3x4 matrix followed
by set of values row by row. Then display matrix in original form.