Pages

Showing posts with label MCA. Show all posts
Showing posts with label MCA. Show all posts

Monday, November 12, 2012

MCA OOS UNIT 4 & UNIT 5



Inheritance
C++ strongly supports the concepts of reusability.
Once a class has been written and tested, it can be adopted b other programmers to suit their requirements.
This is basically done by creating new classes reusing the properties of the existing once.
The mechanism of deriving a new class from an old one is called inheritance.
The old class is referred as base class and the new one is called the derived or subclass.
Hierarchical Inheritance
Multilevel Inheritance

Multiple Inheritance
Hybrid Inheritance

Single Inheritance



A class can also inherit properties from more than one class or from more than one level .
A derived class with only one base class is called single inheritance and one with several base classes is called multiple inheritances.
The traits of one class may be inherited by more than one class. This process is called as hierarchical inheritance.
The mechanism of deriving a class from another derived class is known as multilevel inheritance.




Syntax 

class  derived_ class-name : visibility-mode  base class_name
{
---------------//
---------------//members of derived class
--------------//
} ;

Single Inheritance Example :Single Inheritance is method in which a derived class has only one base class.

#include <iostream.h>
class Value 
  {
    protected:
      int val;
    public:
      void set_values (int a)
        { val=a;}
  };
class Cube: public Value 
  {
    public:
     int cube()
       { return (val*val*val); }
  };
int main () 
 {
   Cube cub;
   cub.set_values (5); //object of cube class inherit the 
                         function of Value class 
   cout << "The Cube of 5 is::" << cub.cube() << endl;
   return 0;
 }

Multiple Inheritance Example: Multiple Inheritance is a method by which a class is derived from more than one base class.

#include <iostream.h>
using namespace std;
class Square
  {
    protected:
     int l;
    public:
     void set_values (int x)
      { l=x;}
  };
class CShow 
  {
    public:
     void show(int i);
  };

void CShow::show (int i) 
 {
   cout << "The area of the square is::" << i << endl;
 }

class Area: public Square, public CShow
  {
   public:
    int area()
      { return (l *l); }
  };
int main () 
{
  Area r;
  r.set_values (5);
  r.show(r.area());
  return 0;
}


Hierarchical Inheritance Example: Hierarchical Inheritance is a method of inheritance where one or more derived classes is derived from common base class.

#include <iostream.h>
class Side
  {
    protected:
      int l;
    public:
      void set_values (int x)
        { l=x;}
  };
class Square: public Side
  {
    public:
      int sq()
      { return (l *l); }
  };
class Cube:public Side
  {
   public:
     int cub()
      { return (l *l*l); }
  };
int main () 
  {
    Square s;
    s.set_values (10);
    cout << "The square value is::" << s.sq() << endl;
    Cube c;
    c.set_values (20);
    cout << "The cube value is::" << c.cub() << endl;
    return 0;
  }


Multilevel Inheritance Example: Multilevel Inheritance is a method where a derived class is derived from another derived class.

#include <iostream.h>
class mm
  {
    protected:
      int rollno;
    public:
      void get_num(int a)
        { rollno = a; }
      void put_num()
        { cout << "Roll Number Is:\n"<< rollno << "\n"; }
  };
class marks : public mm
  {
    protected:
      int sub1;
      int sub2;
    public:
      void get_marks(int x,int y)
        {
           sub1 = x;
           sub2 = y;
        }
      void put_marks(void)
        {
          cout << "Subject 1:" << sub1 << "\n";
          cout << "Subject 2:" << sub2 << "\n";
        }
   };
class res : public marks
   {
     protected: 
       float tot;
     public:
       void disp(void)
          {
            tot = sub1+sub2;
            put_num();
            put_marks();
            cout << "Total:"<< tot;
          }
   };
int main()
   {
     res std1;
     std1.get_num(5);
     std1.get_marks(10,20);
     std1.disp();
     return 0;
  }

Hybrid Inheritance Example: Hybrid Inheritance is a method where one or more types of inheritance are combined together and used.
#include <iostream.h>
class mm
  {
    protected:
      int rollno;
    public:
      void get_num(int a)
       { rollno = a; }
      void put_num()
       { cout << "Roll Number Is:"<< rollno << "\n"; }
  };
class marks : public mm
  {
   protected:
     int sub1;
     int sub2;
   public:
     void get_marks(int x,int y)
       {
         sub1 = x;
         sub2 = y;
       }
     void put_marks(void)
       {
          cout << "Subject 1:" << sub1 << "\n";
          cout << "Subject 2:" << sub2 << "\n";
      }
  };

class extra 
  {
    protected:
      float e;
    public:
    void get_extra(float s)
      {e=s;}
    void put_extra(void)
      { cout << "Extra Score::" << e << "\n";}
  };

class res : public marks, public extra{
   protected: 
     float tot;
   public:
     void disp(void)
       {
         tot = sub1+sub2+e; 
         put_num();
         put_marks();
         put_extra();
         cout << "Total:"<< tot;
       }
 };

int main()
 {
   res std1;
   std1.get_num(10);
   std1.get_marks(10,20);
   std1.get_extra(33.12);
   std1.disp();
   return 0;
 }
When a base class is privately inherited by a derived class, public members of the
base class become private members of the derived class and therefore the public
member of the base class can only be accessed by the member functions of the derived class. They are inaccessible to the object of the derived class. 
A public member of a class can be accessed by its own objects using dot operator.
The result is that no member of the base class is accessible to the object of the derived class.

Visibility of Inherited members:



Tuesday, November 22, 2011

Best Answers of a interview question, "What is your weakness?"

What is your weakness is a simple question but has a lot of significance. This question has to be answered well and by this the employer guages your temperament. So, prepare well to make it your strength during the interview.

few example of such type of Questions:-

"My weakness is I get irritated when my group member refuse to bear their responsibility."

"I get fed up when anyone discourage me."

"I Believe people blindly at first sight." 

"Can't tolerate the disturbance during work time."

"I do not feel comfortable until i finish my work."

"very friendly in behavior."

"It is very much difficult for me to say 'NO' to someone."

"I am an analyzer. Sometimes in leisure time i start doing analysis on people's sayings."

"My weakness is doing mistake once and my strength is I will never do done mistake again"

i can not trust the person with-in shortly.

Wednesday, June 29, 2011

MASTER OF COMPUTER APPLICATION (MCA)/CAREER AFTER B.Sc./BCA/GRADUATION/CAREER IN IT INDUSTRY

The Master of Computer Applications (MCA) is a postgraduate degree in computer application streams awarded in India since 1982. Full time MCA programmes normally take three academic years. The primary emphasis in MCA curriculum is on the development of diverse types of application software rather than designing computer hardware and systems software, which is generally within the domain of engineering majors. More than one thousand institutions provide MCA courses in India with an annual intake of more than 55000 students.
Entrance into an MCA programme requires a bachelors degree from any field of computer science such as a BCA (Bachelor in Computer Application). The course of study covers a variety of topics in the computer programming and designing fields, and can prepare people for a wide variety of computer science related professions
 Structure of the Curriculum
There are two streams in computer education. One of them is the Engineering stream leading to the B.E./B.Tech degree and the other an application stream leading to the MCA degree.
In the B.E./ B.Tech course the primary emphasis is on designing computer hardware and systems software. Designing embedded systems, designing peripherals and interfacing them to a computer and use of computers in signal processing would be some of the other areas of interest to B.E. students.
The primary emphasis in MCA on the other hand, is on designing information systems for various organizations such as banks, insurance companies, hotels, hospitals etc. Development of application software in diverse areas where computers are used will be the main function of MCA graduates. Thus in the MCA curriculum hardware, system software and embedded system design are not emphasised. The major thrust is on giving the students a sound background in computing, business functioning and mathematics relevant to information technology. Thus the curriculum has these three streams of courses each semester running concurrently. In computing, students learn best by doing. A strong laboratory component is a part of the curriculum. The laboratories, besides supplementing the theory course should also expose the student to the use of the latest software tools.
Every MCA student is required to spend one semester in an industry developing a software system.It is suggested that the student periodically report back to the college and present a seminar on the work being done by him.

MCA Course Pre-requisites and Period
MCA is a three year (6 semester) course. The students entering MCA must have a B.C.A./B.Sc./ B.Com/B.A. degree with Mathematics as one of the subjects at 10+2 level or at graduation. Of the 6 semesters one semester is to be spent in an industry developing a software system.
The MCA programme is planned to have 5 theory subject plus two laboratories each semester. The curriculum has a strong core covering information technology, business management and mathematics.

Tuesday, May 3, 2011

Solved Theoretical Questions on CBNST paper (MCA-212) in MTU.



  1. Explain how floating point numbers are stored in computers. What factors affect their accuracy and range?
  2. What do you understand by machine epsilon of a computer? Explain.(ANS:
    We know that a computer has a finite word length, so only a fixed number of digits is stored and used during computation. Hence, even in storing an exact decimal number in its converted form in the computer memory, an error is introduced. This error is machine dependent and is called machine epcilon.
                         Error = True Value – Approximate Value
    In any numerical computation we come across the following types of errors: inherent errors, rounding errors.
    )
  3. With the help of suitable example ,show that associative law of addition may not valid in numerical computation.(ANS: 
    When we perform the arithmetic operations with numbers in normalized floating point mode, the numbers have to be truncated to fit the 4 digit mantissa of our hypothetical computer.
    This leads the results with wide disparity. In fact associative law do not yield valid results in floating point.
    EX:      (L + M) – N =/= (l- N) + M            (=/=  not equal to)

    Let       L          =          .6776E1,         M         =          .6667E1
    and      N         =          .6755E1)
  4. Write a computer program in a language of your choice which implements bisection method to compute real root of the equation 3x + sinx -ex = 0 in an interval.
  5. Under what conditions, newton raphson method become linearly convergent? explain .(ANS: When there are two or more roots that are close together then it may take many iterations before the iterates get close enough to one of them for the quadratic convergence to be apparent. it become linerarly convergent.)
  6. What do you mean by truncation error? explain with examples. (ANS: 
    Example. Find the truncation error for ex at x =1/5if
    (i) The first three terms are retained in expansion.
    (ii) The first four terms are retained in expansion.
    Sol. (i) Error = True value – Approximate value

     =   (1+ x+ x2/ !2 + x3 / !3 + - - - -) –(1+ x+ x2/ !2)
     =  x3 / !3  +  x4 / !4  +  x5 / !5 + - - -
    Put x= 1/5

    Error       =  .008/6 + .0016/24 + .00032/120 + - -
        =  .0013333 + .0000666 + .0000026 + ...
        =  .0014025
    (ii) Similarly the error for case II may be found.)
  7. Explain the diffrence between a single step and a multistep method used  for solving  diffrential equations.(ANS:
     Single-step methods (such as Euler's method) refer to only one previous point and its derivative to determine the current value. Methods such as Runge-Kutta take some intermediate steps (for example, a half-step) to obtain a higher order method, but then discard all previous information before taking a second step. Multistep methods attempt to gain efficiency by keeping and using the information from previous steps rather than discarding it. Consequently, multistep methods refer to several previous points and derivative values.)
  8. Obtain the globle truncation error term of trapazoidal method of integration.(ANS: Accuracy is affected by two sources of error, namely rounded off error and truncation error. The major cause for loss of accuracy is truncation error. this arises because of the use of a truncated Taylor Series. The total truncation error is any iteration step will consist of two components the propagated truncation error and the truncation error introduced by the step itself. The truncation introduced by the step itself is known as local truncation error and the sum of the propagated error and local error is called the global truncation error. )
  9. What do you understand by stability of a method in context of solutions to diffrential equations.(ANS: The uncertainty exist in all stages of numerical processing. There are many situation where even a single operation may  magnify the round off errors of a level that completely runs the result. A computation process in which the cumulative effect of all input errors in grossly magnified is said to be numerically unstable. As we know a mathematical model can be solved either by analytical methods or by numerical methods when a problem itself is sensitive to small changes in its parameters. It is almost impossible to make a numerically stable method for its solution.when several parameters are involved , we may have instability with respect to some parameter and stability with others. in this case we should use the partial derivatives to estimate to total changes .  )
  10. Describe the various type of frequency charts.
  11. Differentiate between interpolating polynomial obtained for a set of data.
  12. Described the following terms 
  • Standard deviation
  • level of significance
  • type II errors
  • moving avrages
  • variaance 
  • ANOVA
   13. What is chi squar test?
   14. Short notes on (I) use of statistical methods in quality control(ANS: 
STATISTICAL QUALITY CONTROL
A quality control system performs inspection, testing and analysis to ensure that the quality of the products produced is as per the laid down quality standards. It is called “Statistical Quality Control” when statistical techniques are employed to control, improve and maintain quality or to solve quality problems. Building an information system to satisfy the concept of prevention and control and improving upon product quality requires statistical thinking.
Statistical quality control (S.Q.C.) is systematic as compared to guess-work of haphazard process inspection and the mathematical statistical approach neutralizes personal bias and uncovers poor judgement. S.Q.C. consists of three general activities:
(1) Systematic collection and graphic recording of accurate data
(2) Analyzing the data
(3) Practical engineering or management action if the information obtained indicates significant
      deviations from the specified limits.
Modern techniques of statistical quality control and acceptance sampling have an important part to play in the improvement of quality, enhancement of productivity, creation of consumer confidence, and development of industrial economy of the country.
The following statistical tools are generally used for the above purposes:
(i) Frequency distribution. Frequency distribution is a tabulation of the number of times a given quality characteristic occurs within the samples. Graphic representation of frequency distribution will show:
(a) Average quality
(b) Spread of quality
(c) Comparison with specific requirements
(d) Process capability.
(ii) Control chart. Control chart is a graphical representation of quality characteristics, which indicates whether the process is under control or not.
(iii) Acceptance sampling. Acceptance sampling is the process of evaluating a portion of the product/material in a lot for the purpose of accepting or rejecting the lot on the basis of conforming to a quality specification.
It reduces the time and cost of inspection and exerts more effective pressure on quality improvement than it is possible by 100% inspection. It is used when assurance is desired for the quality of materials/products either produced or received.
(iv) Analysis of data. Analysis of data includes analysis of tolerances, correlation, analysis of variance, analysis for engineering design, problem solving technique to eliminate cause to troubles. Statistical
methods can be used in arriving at proper specification limits of product, in designing the product, in purchase of raw-material, semi-finished and finished products, manufacturing processes, inspection, packaging, sales, and also after sales service.

ADVANTAGES OF STATISTICAL QUALITY CONTROL
1. Efficiency. The use of statistical quality control ensures rapid and efficient inspection at a minimum cost. It eliminates the need of 100% inspection of finished products because the acceptance sampling in statistial quality control exerts more effective pressure for quality improvement.
2. Reduction of scrap. Statistial quality control uncovers the cause of excessive variability in manufactured products forecasting trouble before rejections occur and reducing the amount of spoiled work.
3. Easy detection of faults. In statistical quality control, after plotting the control charts (X, R, P, C, U) etc., when the points fall above the upper control limits or below the lower control limit, an indication of deterioration in quality is given. Necessary corrective action may then be taken
immediately.
4. Adherence to specifications. So long as a statistical quality control continues, specifications can be
     accurately predicted for the future by which it is possible to assess whether the production processes
     are capable of producing the products with the given set of specifications.
5. Increases output and reduces wasted machine and man hours.
6. Efficient utilization of personnel, machines and materials results in higher productivity.
7. Creates quality awareness in employees. However, it should be noted that statistical quality
    control is not a panacea for assuring product quality.
8. Provides a common language that may be used by designers, production personnel, and inspectors in arriving at a rational solution of mutual problems.
9. Points out when and where 100% inspection, sorting or screening is required.
10. Eliminates bottlenecks in the process of manufacturing.  It simply furnishes ‘perspective facts’ upon which intelligent management and engineering action can be based. Without such action, the method is ineffective. Even the application of standard procedures is very dangerous without
adequate study of the process.)
 (II) Analysis of variance
   15. Write a computer program in C language of your choice for finding out a real root of equation f(x)=0  by newton raphson method .
   16. Explain the order of convergence of a solution and prove that newton raphson method is second degree covergent. 
    17. Define absolute, relative and percentage errors.if x is rounded off to three decimal digits where 
          x=0.005998, calculate the above errors.
(ANS: Absolute error.
Absolute error is the numerical difference between
the true value of a quantity and its approximate value.
Thus, if X is the true value of a quantity and Xis its approximate
value, then | X – X| is called the absolute error ea.
       
                        ea = | X – X| = | Error |

Relative error.
The relative error er is defined by

er = |Error | /True value = (X – X’) / X

where X is true value and |X – X’| is error.

Percentage error.
Percentage error ep is defined as

ep = 100 er = 100 |(X – X’) / X|)

    18. Short notes on : 
                   1. an attribute and a variable (ANS: Such types of data whose magnitude can not be measured are called attributes. Examples of such phenomenon are blindness, insanity, sickness, etc. In such a case an observer cannot measure the magnitude of the data. He can only study the presence or absence of a particular quantity in a group.

On the other hand if the measurement of magnitude of data is possible, such types of data are called as variable. For example height, income or marks of student.)
                   2. a discrete variable and a continuous variable                         (ANS: ·         Quantities which can take any numerical value within a certain range are called continuous variables. For example, the height of a child at various ages is a continuous variable since, as the child grows from 120 cm to 150 cm, his height assumes all possible values within the limit.
·         Quantities which are incapable of taking all possible values are called
discontinuous or discrete variables. For example, the number of rooms in
a house can take only the integral values such as 2, 3, 4, etc.)
                   3. Relative frequency and comulative frequency (ANS: When the frequency of a group is consider with respect to the other group, frequencies are called as relative frequency. when the frequency of a group also includes the frequency of other group is called as cumulative frequency. )
                   4. Histogram and pi- charts
                   5. frequency curve and frequency polygon         (ANS: FREQUENCY POLYGON
If the various points are obtained by plotting the central values of the class intervals as x co-ordinates and the respective frequencies as the y co-ordinates, and these points are joined by straight lines taken in order, they form a polygon called Frequency Polygon.

FREQUENCY CURVE
If through the vertices of a frequency polygon a smooth freehand curve is drawn, we get the Frequency Curve. This is done usually when the class-intervals are of small widths.)
   19. Explain how numerical solution differ from analytical solution.   (ANS: If you want to find a solution to the set of equations. The best is when you can use calculus, trigonometry, and other math techniques to write down the solution. Now you know absolutely how the model will behave under any circumstances. This is called the analytic solution, because you used analysis to figure it out. It is also referred to as a closed form solution. 

But this tends to work only for simple models. For more complex models, the math becomes much too complicated. Then you turn to numerical methods of solving the equations, such as the Runge-Kutta method. For a differential equation that describes behavior over time, the numerical method starts with the initial values of the variables, and then uses the equations to figure out the changes in these variables over a very brief time period. Its only an approximation, but it can be a very good approximation under certain circumstances. 

A computer must be used to perform the thousands of repetitive calculations involved. The result is a long list of numbers, not an equation. This long list of numbers can be used to drive an animated simulation, as we do with the models presented here. )
   20. What are the different type of error that may arise in numerical computations? describe.
  21.  Differentiate between accuracy and precision. (ANS:

  • Accuracy is how close a measured value is to the actual (true) value
  • Precision is how close the measured values are to each other)
  22. What do you understand by numerically unstable procedure.?(ANS: Numerical stability is an important notion in numerical analysis. An algorithm is called numerically stable if an error, whatever its cause, does not grow to be much larger during the calculation. This happens if the problem is well-conditioned, meaning that the solution changes by only a small amount if the problem data are changed by a small amount. To the contrary, if a problem is ill-conditioned, then any small error in the data will grow to be a large error.
A numerical method for solving a mathematical problem is considered stable if the sensitivity of the numerical answer to the data is no greater than in the original mathematical problem. Stable problems are also called well-posed problems. If a problem is not stable, it is called unstable or ill-posed.
A problem f(x, y) = 0 is said to be stable if the solution y depends in a continuous way on the variable x.)
  23. Differentiate between interpolation and curve fitting.                                      (ANS:  
Interpolation is the art of reading between the lines of the table

x:  x0    x1    x2 ...... xn
y:  y0    y1    y2 ...... yn

It also means insertion or filling up intermediate terms of the series. Thus the process of finding the value of y corresponding to any value of x = xi between x0 and xn is called interpolation.
Hence interpolation is the technique of estimating the value of a function for any intermediate value of the independent variable, while the process of computing the value of the function outside the given range is called extrapolation.

Curve fitting
Let there be two variables x and y which give us a set of n pairs of numerical values (x1, y1), (x2, y2).......(xn, yn). In order to have an approximate idea about the relationship of these two variables, we plot these n paired points on a graph, thus we get a diagram showing the simultaneous variation in values of both the variables called scatter or dot diagram. From scatter diagram, we get only
an approximate non-mathematical relation between two variables.
Curve fitting means an exact relationship between two variables by algebraic equations. In fact, this relationship is the equation of the curve. Therefore, curve fitting means to form an equation of the curve from the given data. Curve fitting is considered of immense importance both from the point of view of theoretical and practical statistics.
Theoretically, curve fitting is useful in the study of correlation and regression. Practically, it enables us to represent the relationship between two variables by simple algebraic expressions, for example, polynomials, exponential, or logarithmic functions.

Followers