1. /
2. CBSE
3. /
4. Class 12
5. /
6. Computer Science
7. /
8. CBSE Question Paper 2015...

# CBSE Question Paper 2015 class 12 Computer Science

### myCBSEguide App

Download the app to get CBSE Sample Papers 2023-24, NCERT Solutions (Revised), Most Important Questions, Previous Year Question Bank, Mock Tests, and Detailed Notes.

CBSE Question Paper 2015 class 12 Computer Science conducted by Central Board of Secondary Education, New Delhi in the month of March 2015. CBSE previous year question papers with solution are available in myCBSEguide mobile app and cbse guide website. The Best CBSE App for students and teachers is myCBSEguide which provides complete study material and practice papers to cbse schools in India and abroad.

CBSE Question Paper 2015 class 12 Computer Science

## Class 12 Computer Science list of chapters

1. Review of Python
2. Concept of Object Oriented Programming
3. Classes in Python
4. Inheritance
5. Linear List Manipulation
6. Stacks & Queues in list
7. Data File Handling
8. Exception Handling & Green Functions
9. Databases Concepts and SQL
10. Structure  Query Language
11. Boolean Algebra
12. Boolean Functions & Reduce Forms
13. Application of Boolean Logic
14. Networking Concepts  (Part 1)
15. Networking Concepts  (Part 2)
16. Networking Protocols
17. Mobile Telecommunication Technologies, Network Security and Internet Services

## CBSE Question Paper 2015 class 12 Computer Science

### General Instructions:

• All questions are compulsory.
• Programming Language : Section A refers to C++
• Programming Language : Section B refers to Python.
• Attempt either Section A or Section B.
• Section C is compulsory for all.
• It is compulsory to mention ‘Section A’ or ‘Section B’ before attempting the question paper.

### Section ‐ A

(Only for C++ candidates)

1 (a) Find the correct identifiers out of the following, which can be used for naming variable, constants or functions in a C++ program: (2)

While, for, Float, new, 2ndName, A%B, Amount2, _Counter

Ans. While, Float, Amount2, _Counter

(½ Mark for each correct identifier)

Note:0

• Deduct ½ Mark for writing additional incorrect identifier(s)
• No marks to be awarded if all the identifiers are mentioned

(b) Observe the following program very carefully and write the names of those header file(s), which are essentially needed to compile and execute the following program successfully: (1)

typedef char TEXT[80];

void main()

{

TEXT Str[] = “Peace is supreme”;

int Index=0;

while (Str[Index]!=’\0’)

if (isupper(Str[Index]))

Str[Index++]=’#’;

else

Str[Index++]=’*’;

puts(str);

}

Ans. ctype, stdio

(½ Mark for each correct header file)

Note:

(c) Observe the following C++ code very carefully and rewrite it after removing any/all syntactical errors with each correction underlined. (2)

Note: Assume all required header files are already being included in the program.

#Define float Max=70.0;

Void main()

{

int Speed

char Stop=’N’;

cin>>Speed;

if Speed>Max

Stop=’Y’;

cout<<Stop<<end;

}

Ans. #define Max 70.0 //Error 1,2,3

v oid main() //Error 4

{

int Speed ; //Error 5

char Stop=’N’;

cin>>Speed;

if (Speed>Max) //Error 6

Stop=’Y’;

cout<<Stop<< endl ; //Error 7

}

(½ Mark for each correction upto a maximum of 4 corrections)

OR

(1 Mark for only identifying any 4 errors, without suggesting corrections)

(d) Write the output of the following C++ program code: (2)

Note: Assume all required header files are already being included in the program .

void Position (int &C1, int C2=3)

{

C1+=2;

C2+=Y;

}

void main()

{

int P1=20, P2=4;

Position(P1);

cout<<P1<<”,”<<P2<<endl;

Position(P2,P1);

cout<<P1<<”,”<<P2<<endl;

}

Ans. 22,4

22,6

(½ Mark for each correct value of output)

Note:

• Deduct ½ Mark for not considering any or all endl(s) at proper place(s)
• Deduct ½ Mark for not considering any or all ‘,’ at proper place(s)

OR

(Full 2 marks to be awarded for mentioning Syntax Error OR undeclared variable Y)

(e) Write the output of the following C++ program code: (3)

Note: Assume all the required header files are already being included in the program.

class Calc

{

int Bonus;

public:

void Down(int G)

{

}
Void Up(int G)

{

Bonus++;

}

void Show()

{

}

void main()

{

Calc c;

C.Down(2);

C.Show();

C.Up(7);

C.Show();

C.Down(2)

C.Show();

}

Ans. C#0

J#1

H#1

(1 Mark for each correct line of output)

Note:

• Deduct ½ Mark for not considering any or all endl(s) at proper place(s)
• Deduct ½ Mark for not writing any or all # symbol(s)

OR

(Full 3 marks to be awarded if undeclared object C OR ERROR is identified)

(f) Study the following program and select the possible output(s)from the option (i) to (iv) following it. Also write the maximum and the minimum values that can be assigned to the variable NUM. (2)

Note:

• Assume all required header files are already being included in the program.
• random(n) function generates an integer between 0 and n‐1.

void main()

{

randomize();

int NUM;

NUM=random(3)+2;

char TEXT[]=”ABCDEFGHIJK”;

for (int I=1;I<=NUM; I++)

{

for (int J=NUM;J<=7;J++)

cout<<TEXT[J];

cout<<end1;

}

}

(i) FGHI  (ii) BCDEFGH   (iii) EFGH (iv) CDEFGH

FGHI  BCDEFGH EFGH   CDEFGH

FGHI EFGH

FGHI EFGH

Ans

 (iii) and (iv) Minimum value of NUM = 2 Maximum value of NUM = 4

Minimum value of NUM = 2 Maximum value of NUM = 4

(½ Mark for writing option (iii) )

(½ Mark for writing option (iv) )

Note: Deduct ½ mark for writing each additional option alongwith both correct options

(½ Mark for writing correct Minimum value of NUM)

(½ Mark for writing correct Maximum value of NUM)

2. (a) What is a copy constructor? Give a suitable example in C++ to illustrate with its definition within a class and a declaration of an object with the help of it . (2)

Ans. A copy constructor is an overloaded constructor in which an object of the same class is passed as reference parameter.

class Point

{

int x;

public:

Point(){x=0;}

Point(Point &p) // Copy constructor

{x = p.x;}

:

void main()

{

Point p1;

Point p2(p1);//Copy constructor is called here

//OR

Point p3=p1;//Copy constructor is called here

}
(1½ Mark to be awarded if the copy constructor is explained with an appropriate example)

OR

( 1 Mark for correct explanation of copy constructor only without an example)

(½ Mark for correct declaration of an object)

(b) Observe the following C++ code and answer the questions (i) and (ii) :

class Traveller

{

long PNR;

char TName[20];

public:

Traveller()  //Function 1

void Book(long P,char N[]) //Function 2

{PNR = P; strcpy(TName, N);}

void Print()    //Function 3

{cout<<PNR << TName <<endl;}

~Traveller() //Function 4

{cout<<“Booking cancelled!”<<endl;}

(i) Fill in the blank statements in Line 1 and Line 2 to execute Function 2 and Function 3 respectively in the following code:

v oid main{)

{

Traveller T;

_____________   //Line 1

_____________  //Line 2

}//Stops here

Ans. T.Book(1234567,”Ravi”); //Line 1

T.Print();  //Line 2

(½ Mark for writing each correct Function)

(ii) Which function will be executed at}//Stops here? What is this function referred as? (1)

Ans. Function 4

OR

~Traveller()

It is a Destructor function.

(½ Mark for writing Function 4 or ~Traveller())

(½ Mark for referring Destructor)

(c) Write the definition of a class PlC in C++ with following description:

Private Members

­Pno //Data member for Picture Number (an integer)

­Category //Data member for Picture Category (a string)

­Location //Data member for Exhibition Location (a string)

­ FixLocation //A member function to assign

//Exhibition Location as per category

//as shown in the following table

 Category Location Classic Amina Modern Jim Plaq Antique Ustad Khan

Public Members

­Enter()//A function to allow user to enter values

//Pno,category and call FixLocation() function

­SeeAll()//A function to display all the data members

Ans. class PIC

{

int Pno;

char Category[20];

char Location[20];

void FixLocation();

public:

void Enter();

void SeeAll();

void PIC::FixLocation()

{

if(strcmpi(Category,”Classic”)==0)

strcpy(Location,”Amina”);

else if(strcmpi(Category,”Modern”)==0)

strcpy(Location,” Jim Plaq” );

else if strcmpi(Category,”Antique”)==0)

}

void PIC::Enter()

{

cin>>Pno;gets(Category);

FixLocation();

}

void PIC:: SeeAll()

{

cout<<Pno<<Category<<Location<<endl;

}

(½ Mark for correct syntax for class header)

(½ Mark for correct declaration of data members)

(1 Mark for correct definition of FixLocation())

(1 Mark for correct definition of Enter() with proper invocation of FixLocation() function)

(1 Mark for correct definition of SeeAll())

NOTE:

• Deduct ½ Mark if FixLocation() is not invoked properly inside Enter() function
• No marks to be deducted for defining Member Functions inside the class
• strcmp()/strcmpi() acceptable

(d) Answer the question (i) to (iv) based on the following:

class Exterior

{

int OrderId;

protected:

public:

Exterior();

void Book(); void View();

class Paint:public Exterior

{2g

int WallArea,ColorCode;

protected:

char Type;

public:

Paint() ;

void PBook();

void PView();

class Bill:public Paint

{

float Charges;

void Calculate();

public:

Bill() ;

void Billing() ;

void Print() ;

(i) Which type of Inheritance out of the following is illustrated in the above example?

• Single Level Inheritance
• Multi Level Inheritance
• Multiple Inheritance

Ans. Multi Level Inheritance

(1 Mark for mentioning correct option)

(ii) Write the names of all the data members, which are directly accessible from the member functions of class Paint.

(iii) Write the names of all the member functions, which are directly accessible from an object of class Bill.

Ans. Billing(), Print(), PBook(), PView(), Book(), View()

Note:

• Constructors can be ignored

(iv) What will be the order of execution of the constructors, when an object of class Bill is declared?

Ans. Exterior(), Paint(), Bill()

Note: No marks to be awarded for any other order

3 (a) Write the definition of a function Alter(int A[], int N) in C++, which should change all the multiples of 5 in the array to 5 and rest of the elements as 0. For example, if an array of 10 integers is as follows: (2)

 A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9] 55 43 20 16 39 90 83 40 48 25

After executing the function, the array content should be changed as follow:

 A[0] A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9] 5 0 5 0 0 5 0 5 0 5

Ans. void Alter(int A[ ],int N)

{

for (int i=0;i<N;i++)

if(A[i]%5==0)

A[i]=5;

else

A[i]=0;

}

OR

Any other correct equivalent function definition

(½ Mark for correct loop)

(½ Mark for correct checking of divisibility of array elements by 5)

(½ Mark for correct use of else OR correct checking of non divisibility of array elements by 5 )

(½ Mark for correct assignment of 5 and 0 for multiples and non multiples of 5 respectively)

(b) A two dimensional array P[20] [50] is stored in the memory along the row with each of its element occupying 4 bytes, find the address of the element P[10] [30],if the element P[5] [5] is stored at the memory location 15000. (3)

Ans. Loc(P[I][J]) along the row

(where C is the number of columns, LBL;R=LBC=0)

LOC(P[5][5])

= BaseAddress + W*[I*C + J]

15000 = BaseAddress + 4*[5*50 + 5]

= BaseAddress + 4*[250 + 5]

LOC(P[10][30])= 13980 + 4*[10*50+30]

= 13980 + 4*530

= 13980 + 2120

= 16100

OR

LOC(P[10][30])

= Loc(P[5][5])+ W[(I­LBR)*C+(J­LBC)]

= 15000 + 4[(10­5)*50 + (30­5)]

= 15000 + 4[ 5*50 + 25]

= 15000 + 4 *275

= 15000 + 1100

= 16100

OR

(Where C is the number of columns and LBR=LBC=1)
LOC(P[5][5])

15000 = BaseAddress + W [( I­1)*C + (J­1)]

= BaseAddress + 4[4*50 + 4]

= BaseAddress + 4[200 + 4]

= BaseAddress + 4 * 204

BaseAddress = 15000 ­ 816 = 14184

LOC(P[10][30])

= 14184 + 4[(10­1)*50 + (30­1)]

= 14184 + 4[9*50 + 29]

= 14184 + 4[450 + 29]

= 14184 + 4*479

= 14184 + 1916

= 16100

(1 Mark for writing correct formula (for row major) OR substituting formula with correct values)

(1 Mark for at least one step of intermediate calculation)

(1 Mark for final correct address)

(c) Write the definition of a member function Pop() in C++, to delete a book from a dynamic stack of TEXTBOOKS considering the following code is already included in the program. (4)

struct TEXTBOOKS

{

char ISBN[20]; char TITLE[80];

class STACK

{

TEXTBOOKS *Top;

public:

STACK() {Top=NULL;}

void Push();

void Pop();

~STACK();

Ans. void STACK::POP()

{

if (Top!=NULL)

{

TEXTBOOKS *Temp;

Temp=Top;

cout<<Top­>ISBN<<Top­>TITLE<<”deleted”<<endl;

delete Temp;

}

else

cout<<”Stack Empty”<<endl;

}

OR

Any other correct equivalent function definition

(1 Mark for checking Empty/Non‐empty STACK)

(1 Mark for assigning Top to Temp)

(1 Mark for linking the Top to next node)

(1 Mark for deleting Temp node)

(d) Write a function REVCOL (int P[][5], int N, int M) in C++to display the content of a two dimensional array, with each column content in reverse order. (3)

Note: Array may contain any number of rows.

For example, if the content of array is as follows

 15 12 56 45 51 13 91 92 87 63 11 23 61 46 81

The function should display output as:

11 23 61 46 81

13 91 92 87 63

15 12 56 45 51

Ans. void REVCOL(int P[][5],int N,int M)

{

for(int I=N­1;I>=0;I­­)

{

for(int J=0;J<M;J++)

cout<<P[I][J];

cout<<endl;

}

}

OR

void REVCOL(int P[][5],int N,int M)

{

for(int I=0;I<N/2;I++)

{

for(int J=0;J<M;J++)

{

int T = P[I][J];

P[I][J] = P[N­I­1][J];

P[N­I­1][J] = T;

}

}

for(I=0;I<N;I++)

{

for(int J=0;J<M;J++)

cout<<P[I][J];

cout<<endl;

}

}

(1 Mark for correct nesting of loop(s))

(1½ Mark for correct logic for reversing the content of each column)

(½ Mark for correctly displaying the content)

Note:

• N and M can be written interchangeably for number of rows and columns

(e) Convert the following infix expression to its equivalent postfix expression, showing the stack contents for each step of conversion. (2)

X / Y + U* (V­W)

Ans. X / Y + U* (V­W)=((X / Y)+(U*(V­W)))

 Element Stack Postfix ( ( X X / / X Y / XY ) XY/ + + XY/ ( + XY/ U + XY/U * +* XY/U ( +* XY/U V +* XY/UV – +*- XY/UV W +*- XY/UVW ) +* XY/UVW- ) + XY/UVW-* ) XY/UVW-*+

OR

 Element Stack Postfix X X / / X Y / XY + + XY/ U + XY/U * +* XY/U ( +*( XY/U V +*( XY/UV – +*(- XY/UV W +*(- XY/UVW ) +* Y/UVW- + Y/UVW-* Y/UVW-*+

Any other method for converting the given Infix expression to its equivalent Postfix expression showing stack contents

(½ Mark for converting expression up to each operator)

OR

(1 Mark to be given for writing correct answer without showing the Stack Content on each step)

4. (a) Write function definition for SUCCESS () in C++ to read the content of a text file STORY.TXT count the presence of world STORY and display the number of occurrence of this word. (2)

Note:

• The word STORY should be an independent word
• Ignore type cases (i.e. lower/upper case)

Example:

If the content of the file Story.TXT is as follows:
Success shows others that we can do it. It is possible to achieve success with hard work. Lot of money does not mean SUCCESS.

The function SUCCESS () should display the following:

Ans void SUCCESS()

{

int count=0;

ifstream f(“STORY.TXT”);

char s[20];

while (!f.eof())

{

f>>s;

if(strcmpi(s,”STORY”)==0)

//OR if(strcmpi(s,”SUCCESS”)==0)

count++;

}
cout<<count;

f.close();

}

OR

Any other correct function definition

(½ Mark for opening STORY.TXT correctly)

(½ Mark for reading each word (using any method) from the file)

(½ Mark for comparing the word with STORY OR SUCCESS)

(½ Mark for displaying correct count of STORY OR SUCCESS)

NOTE:

(½ Mark to be deducted if STORY or SUCCESS is compared

without ignoring the case)

(b) Write a definition for function Economic() in C++ to read each record of a binary file ITEMS.DAT, find and display those items, which costs less than 2500. Assume that the file ITEMS.DAT is created with the help of objects of class ITEMS, which is defined below: (3)

class ITEMS

{

public :

void Get()

{

}

void See()

{

}

float GetCost() {return Cost;}.

Ans. void Economic()

{

ITEMS I;

ifstream fin(“ITEMS.DAT”,ios::binary);

{

if(I.GetCost()<2500)

I.See();

}

fin.close();

}

OR

Any other correct equivalent function definition

(½ Mark for opening ITEMS.DAT correctly)

(1 Mark for reading all records from the file)

(1 Mark for checking value of Cost < 2500 )

(½ Mark for displaying the desired items)

(c) Find the output of the following C++ code considering that the binary file CLIENTS.DAT exists on the hard disk with records of 100 members. (1)

class CLIENTS

{

int Cno;char Name[20];

public:

void In(); void Out();

void main{)

{

fstream CF;

CF.open(“CLIENTS.DAT”,ios:: binary| ios::in) ;

CLIENTS C;

int POS=CF.tellg()/sizeof(C);

cout<<“PRESENT RECORD:”<<POS<<endl;

CF.close() ;

}

Ans. PRESENT RECORD: 3

(1 Mark for writing PRESENT RECORD: 3 )

OR

(1 Mark for writing only 3 )

OR

(½ Mark for writing only PRESENT RECORD:

These are First 4 questions only. To view and download complete question paper with solution install myCBSEguide App from google play store or login to our student dashboard.

## Last Year Question Paper Class 12 Computer Science 2015

Download class 12 Computer Science question paper with solution from best CBSE App the myCBSEguide. CBSE class 12 Computer Science question paper 2015 in PDF format with solution will help you to understand the latest question paper pattern and marking scheme of the CBSE board examination. You will get to know the difficulty level of the question paper.

## Previous Year Question Paper for class 12 in PDF

CBSE question papers 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005 and so on for all the subjects are available under this download link. Practicing real question paper certainly helps students to get confidence and improve performance in weak areas.

To download CBSE Question Paper class 12 Accountancy, Chemistry, Physics, History, Political Science, Economics, Geography, Computer Science, Home Science, Accountancy, Business Studies and Home Science; do check myCBSEguide app or website. myCBSEguide provides sample papers with solution, test papers for chapter-wise practice, NCERT solutions, NCERT Exemplar solutions, quick revision notes for ready reference, CBSE guess papers and CBSE important question papers. Sample Paper all are made available through the best app for CBSE students and myCBSEguide website.

### Test Generator

Create question paper PDF and online tests with your own name & logo in minutes.

### myCBSEguide

Question Bank, Mock Tests, Exam Papers, NCERT Solutions, Sample Papers, Notes