Sample paper for class 12 Computer Science

myCBSEguide App

myCBSEguide App

CBSE, NCERT, JEE Main, NEET-UG, NDA, Exam Papers, Question Bank, NCERT Solutions, Exemplars, Revision Notes, Free Videos, MCQ Tests & more.

Install Now

 

Download CBSE sample paper for class 12 Computer Science from myCBSEguide. Class 12 Computer Science sample papers for board exams are available for download in myCBSEguide app, the best app for CBSE students. Sample Paper for class 12 Computer Science includes questions from Python and C++ . CBSE conducts board exam for CBSE students which will cover the whole book.

Download Complete set of sample paper for class 12 Computer Science

For study on the go download myCBSEguide app for android phones. Sample paper for class 12 Computer Science and other subjects are available for download as PDF in app too.

Computer Science Sample papers

Here is CBSE class 12 Sample paper for Computer Science. To get the answers and more sample papers, visit myCBSEguide App or website stated above. Sample paper for class 12 Computer Science is given below:

Sample paper for class 12 Computer Science

Sample Paper for class 12 Computer Science
Session 2017-2018


General Instructions:

  • All questions are compulsory,
  • Answer either Section A or Section B:
  • Section A – Programming Language with C++
  • Section B – Programming Language with Python
  • Section C is compulsory.

SECTION – A (C++)

Q. No. Part Question Description Marks

Q1. (a) What is the role of a parameter/argument passed in a function? Can a default value be assigned to a parameter(Yes/No)? If yes, justify your answer with the help of a suitable example otherwise give reason. (2)

(b) Raman suggests Kishan the following header files which are required to be included in the given C++ program. Identify the header files which are wrongly suggested by Raman. (1)

Program:

Void main ( )

{

Char Grade;

if(isalpha (Grade);

court.put (Grade));

}

Suggested header files:-

1. iostream.h

2. stdio.h

3. conio.h

4. ctype.h

(c) Rewrite the following program after removing the syntactical errors (is any). Underline each correction. (2)

Typdef int Num;

Num full-100;

Num Calc(int X)

{

Full-(X>2)? 1:2;

Return  (full%2)

}

Void main

{

Int full=1000;

Full-calc(:: full);

Count<<:: full<<”::>>full>>end1;

}

(d) Write the output of the following C++ program code(assume all necessary header files are included in program): (2)

Void Encrypt (char*S, int key)

{

Char *Temp=S;

If (key%2—θ)

{ key–; }

While (*Temp!=/ θ’)

{

*Temp+-key;

Temp+-key;

}

}

(e) Write the output of the following C++ program code(assume all necessary header files are included in program): (3)

Struct Ticket

{

Char Level:

Int Price;

};

Void computer (Ticket &T)

{

If (T. Level==’A’)

T.Price +50;

Else if (T.Level==’A’)

T.Price+=50;

Else if (T. Level==’B’)

T. Price+30;

Else if (T.Level==’C’)

T.Price+=25;

Count<<T. Level<<”::”<<T.Price<<endl;

}

Void main( )

{

Ticket Mon_show[ ]={ {‘C’, 250}, {‘A’,300}, {‘B’,300},

For (int count=2; count>=0;)

{

Computer (Mon_show [count–});

}

}

(f) Consider the following C++ program code and choose the option(s) which are not possible as output. Also, print the minimum & maximum value of variable Pick during complete execution of the program. (assume all necessary header files are included in program): (2)

Const int NUM=5:

Void main ()

{

Randomize ( ) ;

Int V1=1, V2-5, Pick;

While(V1<V2)

{

Pick=random(NUM)+ (V2-V1);

Count<<Pick<<”:”;

V1++;

}

}

(a) 5:6:6:6:

(b) 4:7:5:3:

(c) 8:6:1:2:

(d) 7:5:3:1

Q2. (a) What do you mean by Data Abstraction in OOPs? Explain its significance in programming with a suitable example. (2)

(b) Answer the question (i) & (ii) after going through the following code. (assume all necessary header files are included in program):- (2)

Class Game

{

Char Name [21];

Int No_ of_ Players;

Public:

Game ( ) //Function 1

{

Strcpy(Name,”Cricket”);

No_of_Players-11;

Count<<”New Game Starts/n”;

}

Game (char N {}, int No) //Function 2

{

Strcpy (Name, N);

No_of_players=No;

Count <<Name <<”comprises”<<No_of_players<<”number of players/n”;

}

Game( ) //Function 3

{

Count<<”Game Ends/n”;

}

};

(i) Give the name of the feature of OOP which is implemented by Function 1 & 2 together in the above class Game.

(ii) Anuj made make changes to the above class Game and made Function 3 private. Will he be able to execute the Line 1 successfully given below?

Justify.

void main()

{

Game ABC; //Line 1

}

(c) Define a class Bill in OOP with the following specification:- (4)

 

Private members:

1. Bill_no – type long(bill number)

2. Bill_period – type integer(number of months)

3. No_of_calls – type integer(number of mobile calls)

4. Payment_mode – type string(“online” or “offline”)

5. Amount – type float(amount of bill)

6. Calculate_Bill() function to calculate the amount of bill given as per the following conditions:

   No_of_callsCalculation Rate/call

(in rupees)

<=5001.0
501-12002.0
>12004.0

Also, the value of Amount should be reduced by 5% if Payment_mode is “online”.

Public members:

1. A member function New_Bill() that will accept the values for Bill_no, Bill_period, No_of_calls, Payment_mode from the user and invoke Caluclate_Bill() to assign the value of Amount.

2. A member function Print_Bill() that will display all details of a Bill.

(d) Answer the question from (i) to (iv) based on the given below code(assume all necessary header files are included in program):- (4)

Class City

{

Int City_Id;

Char City_Name [30];

protected:

int City Population;

void Get_Population ( )

void New_City( );

void New_City ( );

void show_City ( );

};

Class State:Public City

{

Int State_Id;

Char State_Name[25];

Protected;

Int State_Population;

Public;

State ();

void New_State ( ):

void Print_State ( );

};

Class Country: private State

{

Int Country_Id;

Char country_Name[25];

Public:

Country ( );

void new_Country( );

void Display_Country ( );

};

(i) Write name of the class whose constructor is invoked first on the creation of a new object of class Country.

(ii) Write name of the data members which are accessible through the object of class Country.

(iii) List name of the members which are accessible through the member function “void New_Country()”.

(iv) What will be the size(in bytes) of an object of class Country & State respectively.

Q3 (a) Write the definition of function named Array_Swap() that will accept an integer array & its size as arguments and the function will interchange/swap elements in such a way that the first element is swapped with the last element, second element is swapped with the second last element and son on, only if anyone or both the elements are odd. (3)

E.g. if initially array of seven elements is:

5, 16, 4, 7, 19, 8, 2

After execution of the above function, the contents of the array will be:

2,16, 19, 7, 4, 8, 5

(b) An array A[50][30] is stored along the row in the memory with each element requiring 4 bytes of storage. If the element A[10][15] is stored at 21500, then find out the base address of the array and the memory address of element stored at location A[30][25]? (3)

(c) Write the definition of a member function Q_Insert() for a class Exam_Queue in C++ to inserta new Application information in a dynamically allocated queue whose code is already given below as a part of the program(assume all necessary header files are included in program): (4)

Struct Application

{

Int  App_Id;

Char App_Name [21];

Application * Link;

};

Class Exam_Queue

{

Applicacation *Front,*Rear;

Public:

Exam_Queue( )//Constructor

{

Front-Rear=NULL;

}

Void Q_Insert ( );

Void Q_Delete ( ) ;

};

(d) Write the definition of a user-defined function REPEAT_ROW(int A[][3],int R, int C) in C++ that will store the elements in the following manner  (2)

1. All row elements except the 1st element replaced by the 1st element,

2. All row elements except the 1st & 2nd element replaced by the 2nd element,

3. All row elements except the 1st, 2nd & 3rd element replaced by the 3rd element and so on.

For example: if initially the array was:-

56102
26912
181456

Then, the contents of the array after execution of the above function will be:-

5555
2666
18141414

(e) Evaluate the following POSTFIX expression. Show the status of Stack after execution of each operation separately: (2)

TRUE, FALSE, OR, NOT, TRUE, FALSE, AND, OR

 

SECTION – B (Python)

Q1 (a) Differentiate between break and continue statement with the help of an example. (2)

(b) Identify and write the name of the module to which the following functions belong:

i. ceil( ) ii. findall() (1)

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

DEF execmain ( ) :

X=input (
Enter a number:”)

If (abs(x)=x):

Print “ You entered a positive number”

Else:

X=*-1

Print”number made positive:”*

Execmain ( )

(d) Write the output of the following Python code: (2)

1=5

J=7

X=0

I=i+(j-i)

X=j+i

Print x,”;”,i

J=j**2

X=j+i

i=i+1

print I,”:”,j

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

Data = [‘D’,’o ‘ , ‘’ ,‘ ‘I’, ‘t’, ‘ ‘,’ @’.’’.’1’.’2’.’3’.’’.’!’ ]

For I in range (len (Data)-1):

If (Data [i]. isipper ()):

Data [i] -Data [i].lower ( )

Elif (Data [i]. isspace ( ) ) :

Data [1]=Data[1+1]

Print Data

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

Import random

X=random.random( )

Y= random.randint (0,4)

Print int (X),”;”, Y+int (X)

i) 0: 0

ii) 1: 0

iii) 2: 4

iv) 0: 3

Q2 (a) Explain operator overloading with the help of an example. (2)

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

Class BOOK:

Count=0

Def_init_(self): # Function 1

Self.Author=”Not assigned”

Self.Publisher=”Not assignes”

Def display (Self):

Print self.Author,self.Publisher, self.ISBN

@staticmethod

Def bookcount ( ) : # Function 2

BOOK. Count=BOOK. Count+1

Return BOOK.count

(i) How is data member ‘count’ different from data member ‘Author’? (1)

(ii) Fill in the blanks: (1)

B= BOOK()

1Page No. 10

______________________________ #Write statement to invoke Function 2

______________________________ #Write statement to invoke Function 3

(c) Define a class COURSE in Python with the following description: (4)

Instance Attributes:

REGNO Integer

CNAME String

Score Float

Fees Float

Methods:

  • A constructor to assign REGNO as 0, Score and Fees as 0.0
  • SetCourse() to assign Course and Fees on the basis of the Score input as per the following criteria:
ScoreCNAMEFees
>=9.0 -<=10.0Clinical Psychology10000.0
>=8.0 – <9.0Corporate Counselling8000.0
>=5.0 – <8.0Guidance and

Counselling

6000.0

 

less than 5.0Not Eligible0.0
  • GETDATA() to input REGNO and Score and invoke SetCourse()
  • DISPLAY() to display all the details.

(d) Answer the questions (i) and (ii) based on the following: (4)

Class Vehicle (object):

Def_init_(self,I=0, w=0):

Self. length =1

Self.widh=w

Def define (self):

Print “Vehicle with length”, self.lenght,”in & width”, self.width,”in”

Class Car (Vehicle);

Def _init_(self,clr,seats, l,w):

Vehicle init_(self,l,w)

Self.colour=clr

Self.seatingCapacity=seats

Def change Gears (self,gr):

def turn (self, direction):

print “turned” to”, direction, “direction”

class RacingCar (Car):

def _init_(self,clr,seats,l,w,tr,spd): # Line 1

Car ._init_(self,clr,seats,l,w) # Line 2

Self.turnRadius=tr

Self.speed=spd

Def start (self):

Self.changeGears (2)

Print”Racing car starts=ready to vroom!”

(i) Explain the relationship between Line 1 , Line 2 and Line 3.

(ii) Predict the output that will be produced on the execution of the following statements:

rcar=RacingCar (‘Blue’,2,206,78.5,6,200)

rcar.start ( )

rcar.turn (“left”)

Q3 (a) Write the definition of a function Reverse(X) in Python, to display the elements in reverse order such that each displayed element is the twice of the original element (element * 2) of the List X in the following manner: (2)

Example:

If List X contains 7 integers is as follows:

X[0]X[1]X[2]X[3]X[4]X[5]X[6]
48756210

After executing the function, the array content should be displayed as follows:

204121014168

(b) Consider the following unsorted list:

[22, 54, 12, 90, 55, 78]

Write the passes of selection sort for sorting the list in ascending order till the 3rd iteration.(3)

(c) Consider the following class Order and do as directed: (4)

Class ORDER:

L= [ ]

Def_init_(self):

Self.OID=0

Def insertorder=(self):

Self.OID=input (“Enter Order Id”)

________________ Blank  1

Def delorder (self ):

i. Fill in the blank 1 with a statement to insert OID in the Queue maintained using List

L.

ii. Complete the definition of delorder() to delete OID from the Queue maintained using

List L, the function should return the OID being deleted or -1 in case the Queue is empty.

d) Write a generator function to generate odd numbers between a and b(including (3)

b). -+Note: a and b are received as an argument by the function.

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

10,40,25,-,*,15,4,*,+2

Q4. (a) Nancy intends to position the file pointer to the beginning of a text file. Write Python

statement for the same assuming F is the File object. (1)

(b) Write a function countmy( )in Python to read the text file “DATA.TXT” and count the number of times “my” occurs in the file. (2)

For example if the file “DATA.TXT” contains:

“This is my website. I have displayed my preferences in the CHOICE section.”

The countmy( ) function should display the output as:

“my occurs 2 times”.

(c) Write a function in python to search and display details of all those students, whose stream is “HUMANITIES” from pickled file “Student.dat”. Assuming the pickled file is containing the objects of the following class: (3)

 

 

This is only initial part of the whole sample paper. Download Complete set of sample paper for class 12 Computer Science

Sample Paper for class 12

It is sample paper for class 12 Computer Science. However, myCBSEguide provides the best sample papers for all the subjects. There are number of sample papers which you can download from myCBSEguide website. Sample paper for class 12 all subjects

These are also Sample Paper for class 12 Computer Science available for download through myCBSEguide app. These are the latest Sample Paper for class 12 Computer Science as per the new board exam pattern. Download the app today to get the latest and up-to-date study material.

Marking Scheme for Class 12 Board exam

SubjectBoard MarksPractical or internal Marks
English100 MarksZERO Marks
Hindi100 MarksZERO Marks
Mathematics100 MarksZERO Marks
Chemistry70 Marks30 Marks
Physics70 Marks30 Marks
Biology70 Marks30 Marks
Computer Science70 Marks30 Marks
Informatics Practices70 Marks30 Marks
Accountancy80 Marks20 Marks
Business Studies80 Marks30 Marks
Economics80 Marks20 Marks
History80 Marks20 Marks
Political Science100 MarksZERO Marks
Geography70 Marks30 Marks
Sociology80 Marks20 Marks
Physical Education70 Marks30 Marks
Home Science70 Marks30 Marks

Download CBSE Sample Papers

To download complete sample paper for class 12 Computer Science, Physics, Economics, Mathematics, Biology, English Core, Business Studies, Accountancy, Chemistry and Political 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.

 

 


http://mycbseguide.com/examin8/




1 thought on “Sample paper for class 12 Computer Science”

Leave a Comment