Home » Science » Computer Science » Sample Paper of Computer Science 2014 for class 12, CBSE. Paper No.1

Sample Paper of Computer Science 2014 for class 12, CBSE. Paper No.1



Sample Paper – 2010

Class – XII

Subject – Computer Science



Time Allowed: 3hours                                                                          Maximum Marks: 70


Note.    (i)  All questions are compulsory.

(ii) Programming Language: C+ +



Ques 1.

(a) Differentiate between a global variable and a local variable. Also give suitable example in C++.              2


(b) Name the Header file(s), to which the following built-in functions belongs to:                                          1

(i)isdigit ( ) ( ii) gotoxy ( )


(c) Rewrite the following program after removing syntactical error(s) if any. Underline each correction.       2


void main( )


struct movie

{ char movie_name[20];

char movie_type;

int tickets=100;






(d) Find the output of the following program (Assuming that all required header files are included)               3

void main( )


char * NAME = “admiNStrAtiOn”;

for( int x=0;x<strlen(NAME);x++)


NAME[x] = toupper(NAME[x]);


if(isupper (NAME[x]))


NAME[x] = NAME[x -1];



cout<<NAME <<endl;


(e) Find the output of the following program                                                                                                   2


void Modify(int &a, int b=10)

{ if(b%10==0)


for(int i=5;i<=a;i++)




void Disp(int x)







void main()

{ Disp(3);





(f) Observe the following program Game.cpp carefully, if the value of Num entered by user is 14, choose the correct possible output(s) from the option i) to iv) and justify your option.                                      2


Output options:

  1. 1 2 3 4
  2. 1 2 3 4 5 6 7 8 9 10 11
  • 1 2 3 4 5
  1. None of the above



Ques 2.

(a) Differentiate between a default and a parameterized constructor in context of class and object. Give suitable example in C++.                                                                                                                                 2


(b) Answer the questions (i) and (ii) after going through the following class                                       2

class Computer


char C_name[20];

char Config[100];


Computer(Computer &obj);     // function1

~Computer();                           //function 2


(i) Write the statement(s) which will invoke the function 1.

(ii) Name the specific feature of the class shown by function 2. Also write the time of its invoke.


(c) Define a class Travel in C++ with the description given below:                                                     4


Private members:

plancode of type long

place of type  characters array

number_of_travellers of type integer

number_of_buses of type integer

Public members:

A constructor to assign initial values of plancode as 1001, place as “Kolkata”, number_of_travellers as 5 and number_of_buses as 1

A function newplan( ) which allows user to enter plancode , place and number_of_travellers and also assign the number_of_buses as per the following conditions:

number_of_travellers                         number_of_buses

less than 20                                                      2

equal to and more than 20 and less than 40     3

equal to and more than 40                               4

A function show( ) to display the contents of all the data members on the screen.


(d) Answer the questions (i) to (iv) based on the following code :                                                       4

class Goods

{ int id;

protected :

char name[20];

long qty;

void Incr(int n);

public :



void get(); };

class Food_products : public Goods

{ char exp_dt[10];

protected :

int id;

int qty;

public :

void getd();

void showd(); };

class Cosmetics : private Goods

{ int qty;

char exp_date[10];

protected :

int id;

public :



void show();


(i) How many bytes will be required by an object of class  Food_products.

(ii) Name the member functions accessible through the object of class Food_products.

(iii) From the following, Identify the member function(s) that cannot be called directly from the object of class Cosmetics

show(), getd(), get()

(iv) If the class cosmetics inherits the properties of food_products class also, then name the type of inheritance.


Ques 3.

(a) Write a function in C++ which accepts an integer array and its size as arguments and change all the even number with twice and odd with thrice.                                                                                                3

Example: if an array of five elements initially contains the element as


then the function should rearrange the array as


(b) An array A[40][10] is stored in the memory along the column with each element occupying 4 bytes. Find out the Base address and address of the element A[3][6] if the element A[30][10] is stored at the address 9000.       3


(c) Write a function in C++ to delete a node containing names of student, from a dynamically allocated stack of names implemented with the help of following structure :                                                                              3

struct student


char name[20];

student *next;



(d)W rite a function in C++ which accepts an integer array and its size as arguments/parameters and assign the elements into a two dimensional array of integer in the following format:                                                         3

if the array is 1,2,3,4,5,6                                                         if the array is 1,2,3

the resultant 2D array is given below                                       the resultant 2D array is given below

1 2 3 4 5 6                                                                               1 2 3

1 2 3 4 5 0                                                                               1 2 0

1 2 3 4 0 0                                                                               1 0 0

1 2 3 0 0 0

1 2 0 0 0 0

1 0 0 0 0 0


(e) Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation:                                                                                                                                                        2

25 8 3 – / 6 * 10 +


Ques 4.

  • Observe the program segment given below carefully and fill the blanks marked statement 1 and statement 2 using seekg( ) and tellg( ) function for performing the required task. 1


class Employee

{int Eno;

char Ename[30];


int Countrec( );        //Function to count the total number of records


int Employee:: Countrec( )


fstream File;


___________                          // Statement 1

int Bytes = ________________ // Statement 2

int count = Bytes/sizeof(Employee);

File.close( );

return count;



  • Write a function in C++ to count and display the number of line starting with alphabet ‘A’ present in a text file “LINES.TXT”. 3

Example: if the file LINES.TXT contains the following lines:

A boy is playing there.

There is a playground.

An aeroplane is in the sky.

Alphabets and numbers are allowed in the password.

Then the function should display the output as 3.


  • Assuming the class Computer as follows: 2

Class computer


char chiptype[10];

int speed;


void getdetails( )





void showdetails( )





Write a function readfile() to read all the records present in an already existing binary file “SHIP. DAT” and display them on the screen, also count the number of records present in the file.



  • What is relation? What is the difference between a tuple and an attribute?                         2
  • Write the SQL commands for the i) to iv) and write the output of the (v) on the basis of table TEACHER.                                                                                                                  6


No. Name Age Department Dateofadm Salary Sex
1 Jugal 34 Computer 10/01/97 12000 M
2 Sharmila 31 History 24/03/98 20000 F
3 Sandeep 32 Maths 12/12/96 30000 M
4 Sangeeta 35 History 01/07/99 40000 F
5 Rakesh 42 Maths 05/09/97 25000 M
6 Shyam 50 History 37/06/98 30000 M
7 Shivam 44 Computer 25/02/97 21000 M
8 Shalakha 33 Maths 31/07/97 20000 F



  1. To show all information about the teacher of History department.
  2. To list the names of female teachers who are in Maths department.
  • To list names of all teachers with their date of admission in ascending order.
  1. To insert a new row in the TEACHER table with the following data:

9,’Raja’, 26,’Computer’, {13/05/95}, 23000,’M’


  1. Give the output of the following SQL statements.
    1. Select COUNT(distinct department) from TEACHER;
    2. Select MAX(Age) from TEACHER where SEX=’F’;
    3. Select AVG(Salary) from TEACHER where SEX=’M’;
    4. Select SUM(Salary) from TEACHER where DATOFJOIN<{12/07/96};


Ques 6

  • State and verify Dsitributive law in Boolean Algebra. 2
  • Draw a logical circuit diagram for the following Boolean expression: 2


  • Convert the following Boolean expression into its equivalent Canonical Sum of Products Form

(U’+V’+W’). (U+V’+W’). (U+V+W)                                                                                       1

  • Reduce the following Boolean expression using K-map 3

F(A,B,C,D)=  S(1,3,4,5,7,9,11,12,13,14)



  • Differentiate between Internet and Intranet. 2
  • Expand the following 1

(i) CDMA                    (ii) URL

  • Knowledge Supplement Organization has set up its new centre at Manglore for its office and web based activities. It has four buildings as shown in the diagram below: 4

cs 1










Center to center distance between various buildings                                  Number of Computers

Alpha to Beta 50m Alpha 25
Beta to Gamma 150m Beta 50
Gamma to Lambda 25m Gamma 125
Alpha to Lambda 170m Lambda 10
Beta to Lambda 125m
Alpha to Gamma 90m
  1. Suggest a cable layout of connections between the buildings
  2. Suggest the most suitable place(i.e building) to house the server of this organization with a suitable reason.
  • Suggest the placement of the following devices with justification:
    1. Repeater
    2. Hub/Switch
  1. The organization is planning to link its front office situated in the city in a hilly region where cable connection is not feasible, suggest an economic way to connect it with reasonably high speed?
  • What do you mean by Free Software and OSI? 2
  • Name any two cyber crimes. 1




The main objective of this website is to provide quality study material to all students (from 1st to 12th class of any board) irrespective of their background as our motto is “Education for Everyone”. It is also a very good platform for teachers who want to share their valuable knowledge.

Leave a Reply

Your email address will not be published. Required fields are marked *