Tuesday, 20 November 2012

APRIL/MAY 2011


C-09-CM-404

3454
BOARD   DIPLOMA   EXAMINATION,   (C-09)
APRIL/MAY 2011
D.C.M.E   -   IV SEMISTER EXAMINATION
OOP THROUGH C++
TIME: 3 Hours]                                                                     [Total Marks :80]
PART   - A
INSTRUCTION :  (1)  ANSWER ALL QUESTION AND EACH QUESTION
                                           CARRIES FOUR MARKS
                    (2)  ANSWER SHOULD BE BRIEF AND   STRAIGHT      TO  THE POINT AND SHALL NOT EXEED FIVE SIMPLE SENTENCES

1.            What is the Principle of OOP?
2.            Define Constructor. Write is syntax.
3.            Compare classes in C++ with structures in C.
4.            Define Pass by reference method
        Ans: Pass by Reference passes in a reference to a variable- this is effectively the address of the variable into the function. This is considereably more efficient than by value and allows the function to change the variable directly, something only possible in C by passing in a pointer to the variable

        5. List the uses of references.
Ans:
        Ans: /*see the notes for advantages of reference variable. This question is most frequently asked question in Interviews > 
1) Fast Execution 2) Saving Memory 3) We can avoid the pointers 4) duplication is avoided
5) No complexity (6) It allows parameter to be changed (7) greater reliability and security
        6. State the relationship between base class and derived class.
        7. State any three Benefits of Inheritance.
        8. State the need for Virtual Functions in C++.
(i) main reason for having a virtual function is to implement a different functionality in the derived class.
(ii) to add (means we can redefine in derived class) more facility to that function
(iii)virtual functions are needed to develop late binding concepts.

        9. Define custom / user defined manipulators.
Ans:  An important feature of c++ streams is that they also work well with user-defined manipulators as they do with predefined(build-in) manipulators. Hence, the users can design their own(customized) manipulators to control the appearance of the output depending upon their taste and need. The syntax for creating a custom manipulators is shown as follows. In the syntax, manipulator is the name of the user defined manipulator. Output is the manipulator caller and stream cascading object and arguments if any is used for arguments for parameterized manipulator.

Syntax:
Ostream& manipulator(ostream &output, argements)
{
       -------
      -------
     -------
   return statement;
}
         /*to see the answer then go to 4th chapter C++ I/O 

       10. What is Generic programming?
Ans: 
        It is an approach where generic types are used as parameters in algorithms so that they work for a variety of suitable data types and data structures.  

PART- B                                    5*10=50
Instructions: (1) Answer any five questions and each question carries ten marks. (2) The answers should be comprehensive and the criteria for valuation is the content but not the length of the answer.


11.         How will you overload Unary and binary operator using Friend functions?
12.         (a)Explain the structure of C++ program with an example program.                                                                              Ans: /* you can write any cpp program with comment line of each statement                                                                    (b) Explain the steps in developing a C++ program.                                                                                                             Ans: (1)Click on Cpp editor(compilor) to write the cpp program (2) write a simple program to check you editor provided by software (3) save the file as filename.cpp (4)compile the program (5) check for errors (6) run the program
13.         Write a C++ program function overloading.
14.         Explain the creating and accessing of array of objects with an example program.
15.         Write a C++ program to illustrate multiple inheritance.
16.         Write a C+ program to illustrate virtual base class in multipath inheritance.
17.          Explain the various file stream classes needed for File Manipulators.                                                                           Ans: i) Ofstream: stream class to write on files
 (ii)Ifstream: stream class to read from files
 (iii)Fstream: stream class to both read and write from/to files.
these  classes are derived directly or indirectly from the classes istream, and ostream. We have already used objects whose types were these classes: cin is an object of class istream and cout is an object of class ostream. Therefore, we have already been using classes that are related to out file streams. Ans in fact, we can use our file streams the same way we are already used to usecin and cout, with the only difference that we have to associate these streams with physical files:

(i) ifstream: this is the class for input operation on files similarly to statndard input. It includes the methods(functions) open(), close(), read(), get() getline(), and the overloaded extraction operator.

(ii) ofstream: this is the class for output operation of files. Similarly, to standard output methods included are open(), close(), put(), write() and the overloaded insertion oerator.,

(iii) fstream: this class derived from both ifstream and ofstream

all the classes are declared in the fstream.h header file. The file also includes iostream.h files
18.         Explain a class template for stack data structures.


C++ PREVIOUS QUESTION PAPER FOR POLYTECHNIC
        C-09                                        C-05
·                     OCT-2005                              OCT/NOV-2011
·                     APRIL/MAY 2012
·                     OCT/NOV-2011                    APRIL/MAY 2011(C-05)
·                     APRIL/MAY 2011
·                     APRIL/MAY-2011(C00)
·                     Oct/Nov2010
·                     OCTOBER   -   2005(C-00)


HOME                                     

No comments:

Post a Comment