Sunday, August 14, 2011

CS2203 — OBJECT ORIENTED PROGRAMMING 141303 - OBJECT ORIENTED PROGRAMMING ANNA UNIVERSITY OF TECHNOLOGY,ANNA UNIVERSITY QUESTION PAPER APRIL/MAY 2010


B.E./B.Tech. DEGREE EXAMINATION, APRIL/MAY 2010

Third Semester

Computer Science and Engineering

CS2203 — OBJECT ORIENTED PROGRAMMING
141303 - OBJECT ORIENTED PROGRAMMING
(Common to Information Technology)

(Regulation 2008)
Time: Three hours                                                                       Maximum: 100 Marks
Answer ALL Questions
PART A — (10 × 2 = 20 Marks)
1.  Write  a  C++  program  to  check  whether  an  integer  is  a  prime  or  a  composite  number.
2.  What is the difference between a class and a structure?
3.  Write the difference between realloc() and free().
4.  Give the purpose of gets and puts function.
5.  What happens when a raised exception is not caught by catch block?
6.  Give  the  syntax  of  a  pointer  to  a  function which  returns  an  integer  and takes  arguments one of integer type and 2 of float type.
7.  What  is  visibility  mode?  What  are  the  different  inheritance  visibility  modes supported by C++?
8.  Write the rules for virtual function.
9.  Give the meaning of the flag ios::out.
10.  What is a C++ manipulator?

PART B — (5 × 16 = 80 Marks)

11.  (a)  (i)  Write a C++ program to multiply two matrices and print the  result.                        (ii)  Explain inline functions with an Example program                                                                                                 
Or
           (b)  (i)  Explain the concept of pointers with an example program written in C++.                                                                              
                (ii)  How is function overloading different from operator overloading.


 
12.  (a)  (i)  What are the copy constructors and explain their need?  (8)
         (ii)  Explain  the  syntax  of  operator  overloading.  How  many  arguments are needed in  the  definition of  an overloaded binary  operator? Give an example.                                                                             
Or
  (b)  Explain friend functions with an example.

13.  (a)  Write  a  C++  program  to  create  a  base  class  called  house.  There  are  two  classes  called  door  and  window  available.  The  house  class  has  members  which  provide  information  related  to  the  area  of  construction,  doors and  windows details. It delegates  responsibility of computing the cost of doors  and window  construction  to  door and  window  classes  respectively.  Write  a  C++  program  to  model  the  above  relationship  and  find  the  cost  of
constructing the house.
Or

 (b)  Write a C++  program  to compute the square  root of a number.  The  input value  must  be  tested  for  validity.  If  it  is  negative,  the  user  defined function mysqrt() should raise  an exception.

14.  (a)  What  are  abstract  classes?  Write  a  program  having  student  as  an abstract  class  and  create  many  derived  classes  such  as  engineering, science,  medical  etc.,  from  the  student  class.  Create  their  object  and
process them.
Or
  (b)  Consider  an  example  of  book  shop  which  sells  book  and  video  tapes. These  two  classes  are  inherited  from  the  base  class  called  media.  The media  class  has  command  data  members  such  as  title  and  publication. The  book  class  has  data  members  for  storing  number  of pages  in  a  book and  the  tape  class  has  the  playing  time  in  a  tape.  Each  class  will  have member  function  such  as  read()  and  show()  in  the  base  class,  these  members  have  to be  defined  as  virtual functions, write  a program  which models  the  class  hierarchy  for  book  shop  and  process  objects  of  these classes using pointers to the base class.

15.  (a)  Write  a  program  which  copies  the  contents  of  one  file  to  a  new  file  by removing unnecessary spaces between words.

Or
  (b)  Explain various file stream classes needed for file manipulations.


——————


                                                

No comments:

Post a Comment