0% found this document useful (0 votes)
108 views

Kendriya Vidyalaya Sangathan, Chennai Region: Class Xii - Common Pre-Board Examination

The document is a past exam paper for Computer Science from Kendriya Vidyalaya Sangathan, Chennai Region for Class XII. It contains questions on topics like C++ programming, classes and objects, arrays, stacks and queues. The paper tests understanding of concepts like parameters, header files, structures, inheritance, file handling, expressions and algorithms through multiple choice, code writing and explanation type questions. It aims to comprehensively evaluate students' knowledge of the C++ syllabus for Class XII.

Uploaded by

Naresh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views

Kendriya Vidyalaya Sangathan, Chennai Region: Class Xii - Common Pre-Board Examination

The document is a past exam paper for Computer Science from Kendriya Vidyalaya Sangathan, Chennai Region for Class XII. It contains questions on topics like C++ programming, classes and objects, arrays, stacks and queues. The paper tests understanding of concepts like parameters, header files, structures, inheritance, file handling, expressions and algorithms through multiple choice, code writing and explanation type questions. It aims to comprehensively evaluate students' knowledge of the C++ syllabus for Class XII.

Uploaded by

Naresh Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

www.ncerthelp.

com

KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION


CLASS XII COMMON PRE-BOARD EXAMINATION

Subject: COMPUTER SCIENCE (083) Time Allotted: 3 Hrs. Max. Marks: 70

Note. (i) All questions are compulsory.


(ii) Programming Language: C+ +
Q1 (a) Differentiate between Actual & Formal Parameter with the help of examples. 2
(b) Which header file(s) will be essentially required to be included to execute the following
C++ code? 1
void main( )
{
int Eno = 123;
char EName[ ] = CBSE AISSCE;
cout<<setw(5)<<Eno<<setw(25)<<EName<<endl;
}
(c) Rewrite the following code after removing syntactical error(s), if any. Underline each
correction made. 2
#include<iostream.h>
void main( )
{
one = 10, two = 20;
call(one, two);
call(two);
}
void call(int n1, int n2 = 20)
{
n1 = n1 + n2
cout<<n1>>n2;

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

(d) Go through the C++ Code shown below & find the possible output from the suggested
output options (i) to (iv). 2

#include<iostream.h>

#include<stdlib.h>

const int LOW = 25;

void main( )

randomize( );

int num, point = 5;

for(int i = 1; i<= 4; i++)

num = LOW + random(point);

cout<<num<<: ;

point- - ;

i) 29 : 26 : 25 : 28: ii) 24 : 28 : 25 : 26 iii) 29 : 26 : 24 : 28 iv) 29 : 26 : 25 : 26 :

(e) Find the output of the following program: 2

#include<iostream.h>

void switch(int a[ ], int n, int split)

for(int k = 0; k < n; k++)

if(k < split)

a[k] += k;

else

a[k] *= k;

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

void display(int a[ ], int n)

for(int k = 0; k < n; k++)

(k % 2 = = 0) ? cout<<a[k]<<% : cout<<a[k]<<endl;

void main( )

int h[ ] = {30, 40, 50, 20, 10, 5};

switch(h, 6, 3);

display(h, 6);

(f) Find the output of the following program: 3

#include<iostream.h>

struct Package

int L, b, h;

};

void occupy(Package M)

Cout<<M.L<<x<<M.b<<x<<M.h<<endl;

void main( )

Package B1 = { 100, 150, 50}, B2, B3;

++B1.L;

occupy(B1);

B3 = B1;

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

++B3.b;

B3.b++;

occupy(B3);

B2 = B3;

B2.b += 50;

B2.h- -;

occupy(B2);

Q2(a) What is an object with reference to Encapsulation? State the different ways to assign
values to the data members of an object. 2

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

int img;

int real;

public:

Complex(); //function 1

Complex(int , int ); //function 2

~Complex(); //function 3

};

(i) What is function3 known as? When will it be invoked in a class?

(ii) Name the function 1 and function 2 and expand the function 2.

(c) Define a class Ticket in C++ with following description: 4

Private members

Tno of type integer (Ticket number)


Name of type string(Passenger name)
Distance of type integer (distance to be travelled in kms)
Berth of type string(SL , 2AC , 3AC )
Psngr of type integer(no of passengers)
Fare of type float(Ticket fare)
A member function calcFare() to calculate the fare as per the following

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

Berth Rate per km


SL 10
3AC 25
2AC 35

Service charge of Rs.200/- for 2AC and 3AC

Public members

A member function Book() to enter Tno,Name, Distance, berth , Psngr

A member function Print() to display Tno, Name, Distance, berth, Psngr and call calcFare()
to calculate the journey fare.

(d) Consider the following and answer the following questions: 4

class ADDRESS

char Hno[10];

char City[15];

protected:

long Pincode;

public:

char phone[11];

ADDRESS();

void get();

void show();

};

class OFFICE

char Name[15];

char Manager[20];

char code[10];

public:

int totalEmp;

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

OFFICE();

void Input();

void Output();

};

class EMPLOYEE: private ADDRESS, public OFFICE


{
int Icode;
char Ename[25];
float Salary;
public:
char Dept[15];
EMPLOYEE();
void getEmp();
void showEmp();
};
(i) Name the type of inheritance is shown in above example.
(ii) Write the names of all the member functions which are accessible from objects of class
EMPLOYEE.
(iii) Write the names of all the members which are accessible from member functions of
class EMPLOYEE.
(iv) How many bytes will be allocated to an object belonging to class EMPLOYEE?
Q3 (a) Write a function in C++ which accepts an integer array & its size as arguments and
assigns the elements into a 2D array of integer in the following format. 3

e.g. If A[ ] contains 1, 2, 3, 4 Resultant Array will be : 1 0 0 0

1 2 0 0

1 2 3 0

1 2 3 4

(b) An Array A[5][5] is stored in the memory with each element occupying 4 Bytes of space.
Assume the Base Address of A to be 1000, compute the address of B[2][4], when the array is
stored: (i) Row Wise (ii) Column Wise. 3

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

(c) Write a function in C++ to delete an element from a dynamically allocated Stack of
Student implemented with the help of following structure: 4

struct Student

int Rollno;

char Name[20];

Student * Link;

};

(d) Write a function C++ which accepts 2D integer array & its size as arguments and
displays the elements which lies on the Diagonals 2

e.g. If the array is :

20 40 10
40 50 2
60 10 20
Output should be:

Diagonal 1: 20 50 20

Diagonal 2: 10 50 60

(e) Convert the following INFIX expression to equivalent POSTFIX expression. Show status
of Stack after every step of evaluation 2

A + B * (C D) / E

Q4 (a) Fill in the blanks marked as Statement 1 and statement 2 in the below code according
to the context: 1

#include <fstream.h>

class Customer

int Cno;

char Cname[20];

public:

//Function to count the total number of records

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

int Countrec();

};

int Customer::Countrec()

fstream f;

f.open(Cust.dat,ios::binary|ios::in);

______________________ //Statement 1

int Bytes =_____________________ //Statement 2

int count = Bytes / sizeof(Customer);

f.close();

return count;

(b) Write a function in C++ to count number of words starting with amend in the text file
named as Amendment.txt 2

Eg:-

A contract to deliver something to a customer once a month can be amended if the customer
wants it delivered once a week. Usually, everyone involved in the contract must agree to the
amendment before it goes into effect. Most contracts are written with rules about
amendments

The Output should be

No of words starting with amend : 3

(c) Following is the class of each record in a data file named "Employee.dat": 3

class EMPLOYEE

int id;

char name[15];

char desg[10];

public:

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

void input();

void output();

};

Write a function in C++ to add a new employees record in the file.

Q5 (a) Explain Cardinality & Degree with the help of Examples. 2

Consider following tables SENDER &RECIPIENT:

Table: SENDER

SenderIDSenderName SenderAddress SenderCity

ND01 R jain 2, ABC Appts New Delhi

MU02 H Sinha 12, Newtown Mumbai

MU15 S Jha 27/A, Park street Mumbai

ND50 T Prasad 12, Newtown New Delhi

Table: RECIPIENT

RecID SenderIDRecName RecAddressRecCity

KO05 ND01 R Bajpayee 5, Central Avenue Kolkata

ND08 MU02 S Mahajan 116, A ViharNew Delhi

MU19 ND01 H Singh 2A, Andheri East Mumbai

MU32 MU15 P K Swamy B5, C S Terminus Mumbai

ND48 ND50 S Tripathi 13, B1 D, MayurVihar New Delhi

(b) Write Queries for the following statements: 4

(i) To display the name of all Senders from Mumbai.

(ii) To display the RecID, SenderName, Senderaddress, RecName, RecAddress for every
Receipient.

(iii) To display Receipient details in ascending order of RecName.

(iv) To display number of Receipients from each city.

(c) Give the output of the following Queries: 2

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

(i) SELECT DISTINCT SenderCity FROM SENDER;

(ii) SELECT A.SenderName, B.RecName FROM SENDER A, RECEIPIENT B WHERE


A.SenderID = B.SenderID AND B.RecCity = Mumbai;

(iii) SELECT RecNameRecAddress FROM RECIPIENT WHERE RecCity NOT


IN(Mumbai, Kolkata);

(iv) SELECT RecID, RecName FROM RECIPIENTWHERE SenderID = MU02 OR


SenderID = ND50;

Q6. (a) Prove following using Truth Table: 2

(i) (A + B) = A.B (ii) (A.B) = A + B

(b) Write the POS Form of Boolean function G, which is represented in a Truth table as
follows: 1

A B C G
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0

(c) Draw the Equivalent Logic Circuit for the following Boolean Expression: 2

(U + V ).[W(U + V)]

(d) Reduce the following Boolean Expression using K-Map: 3

F(P, Q, R, S) = (9, 11, 13, 14, 15)

Q7 (a) Write one example each of Open & Proprietary softwares 1

(b) Explain FTP 1

(c) What do you understand by Cyber Law. 1

(d) A Company is setting up its new campus at Pondicherry at 3 different locations as shown
in diagram & is having its cooperative unit in Mumbai: 4

10

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com

Distances between various blocks(in metre) & Expected no. of computers in each block are
as follows:

Research lab to Back Office 110 m Back Office 79


Research lab to Dev unit 16 KM Research lab 158
Research lab to Corporate unit 1800 KM Dev unit 90
Back office to Dev unit 13 KM Corporate unit 51

(i) Suggest the kind of network required for connecting each of following units:

(a) Research lab & Back office (b) Research lab &Dev unit

(ii) Suggest the most suitable device to connect all the computers within each of their office
units:

Switch/Hub, Modem, Telephone

(iii) Suggest an effective communication media to be used by the company for connecting
their local units in Pondicherry, out of following medias:

Telephone Cable, Optical Fibre, Ethernet Cable

(iv) Suggesta cable layout of connections between the units. Also, suggest an effective
method/technology for connecting the companys office unit located in Mumbai.

(e) Out of following identify Client & server side script(s): 1

(i) ASP (ii) Javascript (iii) JSP (iv) VBScript

(f) Write one advantage of Star topology over Bus Toplogy. 1

(g) State the challenges associated with cloud computing.

11

Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...

You might also like