Computer Science (CBSE Guess Papers – XII)[Set-2]

  CBSE You are here

Download Computer Science CBSE Guess Papers Class XII 2009

Guess Paper – 2009

Class – XII

Subject –Computer Science

(set-2)

 

  1. What do you understand by procedural programming paradigm?

 

Ans: In the procedural Programming, program are divided into different procedures(also known as functions, routines or subroutines) and each procedure is a set of instruction is a set of instruction that performs a specific function.

 

  1. What do you understand by object oriented programming paradigm?

 

Ans: In the Object Oriented Programming, programs are divided to represent real word models in a better way through object. The major concept in OOP includes objects, classes, encapsulation, abstraction, inheritance, and polymorphism.

 

  1. Explain all the features of OOPs with their implementation in C++.

 

Encapsulation:

                        Enapsulation refers to the grouping of data and function within a single entity. The data and function that are encapsulated together correspond to the properties and action of the real word object respectively.

 

Data Hiding:

                        The data defined in the class accessed only through the function defined in the class Thus, the data is hidden and safe from any accidental modification or deletion by the program. This protection of the data from the class is known as data hiding or information hiding.

 

Inheritance:

                        Inheritance refers to the means by which one class acquires or inherits the data and function of another class. It allows the new class to have the same data and function of the existing class and add other the data and function specific to the new class.

 

Polymorphism:

                        Polymorphism refers to the ability of an operation to function in different ways depending on the context. Polymorphism is implemented either at compile time or at runtime. Functions are overloaded when they are defined with the same name but different parameters lists. The parameter list of the function differs from that of another function when the number or the data types of the parameters of the two functions differ.

 

Abstract Class:

                        A class which provides only the interface of one or more functions and not their implementations is known as an abstract class. An abstract class only specifies what the function does, what all its requires, etc. but it does not specify to the new class.

 

Concrete Class:

                        The class that provides an implementation for all its function is known as concrete class. The concrete class can have one or more object.

           

  1. Why main function is so special in C++. Give at least two reasons.

Ans: Whenever a C++ program is executed only the main function is executed. The execution of the program starts and end at main().

 

  1. Write two advantages of using #include complier directive.

Ans: #include directive instruct the compiler to include the contents of the file enclosed within angular brackets into the source file.

 

  1. Differentiate between a run time error and syntax error. Give one example of each.

 

  1. Illustrate the concept of function overloading with the help of an example.

 

Ans: Functions are overloaded when they are defined with the same name but different parameters lists. The parameter list of the function differs from that of another function when the number or the data types of the parameters of the two functions differ.

      void add(int a,int b);

      void add(int a,float b);

      void add(int a,char str[]);

 

  1. Why is a destructor function required in classes? Illustrate with the help of an example.

 

Ans: Destructor function is required because the resources and the memory allocated to data members must be released when the sope of the object terminates.

 

  1. Illustrate the use of this pointer with the help if an example.

Ans: The this pointer is a special pointer that contains the address of an object of a class currently calling the member function of the class.

Ex.             #include<iostream.h>

                  Class x

                  {

                              private:

                                          int a;

                              public:

                                          void setdata(int b)

                                          {

                                                      a = b;

                                          }

                              void print( )

                              {

                                          cout<<”a=”<<a<<endl;

                                          cout<<”

The address of the calling object is :”<<this;

                              }

                  };

                 

                  void main( )

                  {

                              x ob1;

                              int a = 10;

                              obi.setdata(a);

                              ob1.print( );

                  }

 

  1. What is the use of a constructor function in a class? Give a suitable example for a constructor function in a class.

Ans: A constructor is a special member function of a class that has the same name as that of the class and is automatically called when an object of the class is declared. It allows the object a class to be initialized in the same way as variables or built- in data types.

      Example:

                              #include<iostream.h>

                              class abc

                              {

                              private:

                                          int x;

                              public:

                                          abc( )                                                   //constructor function

                                          {

                                                      x=10;

                                          }

                              };

                              void main( )

                              {

                                          abc a1;

                              }

  1. Illustrate the concept of function overloading with the help of an example.

Ans: same as Q 7.

 

  1. Differentiate between a constructor and destructor function.

Ans same as Q9 and Q10.

  1. Illustrate the use of “self referencing structures” with the help of an example.

Ans: A self referential structure is a structure that refers to it self. A self referential structure is different from an ordinary structure in a way that self – referential structure has a structure pointer of its own type as one of its member variable

Exp:

                        structure student

                        {

                                    int roll_no;

                                    char name[20];

                                    char address[40];

                                    student *next;

                        };

  1. What is the purpose of a header file in a program?

Ans: The purpose of a header file in a program is that, with the help of these files we can use built-in function in our program.

 

 

  1. What do you understand about a base class & a derived class ? if a base class and a derived class each include a member function with the same name and arguments , which member function will be called by the object of the derived class if the scope operator is not used ?

Ans:

      The class whose members are inherited by another class is known as base class or super class and the class that inherits the members of base class is class is called derived class.

Error too many types in declaration.

 

  1. What do you understand about a member function? How does a member function differ from an ordinary function?

A member function is a function that can be defined either inside or outside the class definition and is a part of class and can not be accessible out side of the class without class object.

But ordinary function is just like a normal function and can be access anywhere in the program freely.

 

  1. Differentiate between call by value & call by reference with a suitable example.

Ans:


Download Attached Pdf



  « Economics (CBSE Guess Papers – XII) Physical Education (CBSE Guess Papers – XII) »  

  Posted on Tuesday, February 3rd, 2009 at 4:57 PM under   CBSE | RSS 2.0 Feed