CBSE Guess paper class XII Computer Science 2008 3



Guess Paper – 2008

Class – XII

Subject – Computer Science (c++)


MM : 70 TIME : 3 HRS

General Instructions :

1. This paper is not based on CBSE marking scheme ,and contains only important questions .

2. In this question paper the number of questions are more than the question in actual board paper.

Q. 1. a) Define the following :

a. Data abstraction. b. Data Encapsulation c. Data Hiding

b) What is copy constructor? What do you understand by constructor overloading?

c) Name the header file to which following belog:

(i) atoi() (ii) isalnum() (iii) setw() (iv) puts()

d) What will be the output of the following program: [3]

#include

#include

#include

#include

void PointersFun(char Text[], int &count)

{

char *ptr=Text;

int length=strlen(Text);

for(; count

{

*(ptr + count) = toupper( * (ptr + count) );

}

}

void main()

{

clrscr();

int position=0;

char Data[]= “ChangeString”;

PointersFun(Data, position);

cout<<< “@”<<>

cout.write(Data + 3, 4);

}

e) Find the output of the following program: [2]

#include

#include

#include

struct KEY

{

char word[10];

int count;

};

void changekeyword(KEY somekey);

void main()

{

KEY aKEY;

strcpy(aKEY.word, “#define”);

aKEY.count=0;

changekeyword(aKEY);

cout<<< “\t”<<< “\n”;

getch();

}

void changekeyword(KEY somekey)

{

strcpy(somekey.word, “const”);

somekey.count=1;

cout<<< “\t” <<< “\n”; }

Q 2. a) Define a class ELECTION with the following specifications . Write a suitable main ( ) function also to declare 3 objects of ELECTION type and find the winner and display the details . ( 3 )

Private members :

Data : candidate_name , party , vote_received

Public members :

Functions : enterdetails ( ) – to input data

Display ( ) – to display the details of the winner

Winner ( ) – To return the details of the winner trough the object after comparing the votes received by three candidates .

b. class data ( 2 )

{

int num ;

public :

data ( int n )

{ num = n ; }

void show ( )

{

cout <<>

}

};

class database : public data

{

char name[12];

data d ;

public :

__________________________

};

Fill in the blanks to define a constructor for the derived class assigning values of the data passed from main ( ) and to assign a data 15 o base class constructor data n .

c) Assume that you are writing a text based medieval video game. Your video game will have two types of

characters, the player and the monsesters. A player has to know the values of certain attributes of characters.

Health integer

Strength integer

Agility integer

Type of weapon String

Type of armor String

A player must be able to perform the following actions:

Move() /*Initialize Health by 16, Strength by 12, Agility by 14, Type of weapon by

Mace and Type of armor by leather */

Attackmonsester() // Display the following message ‘Attack monsester with’ Type of weapon Gettreasure() // Increments the value of the players health by 1

Define player class with the above specifications.

d) Consider the following C++ declarations and answer the questions given below:

class Aaryuved

{

void anyval();

protected:

int x,y;

void procval();

public:

void getvalA();

void putvalA() const;

};

class yoga : protected Aaryuved

{

int a, b;

protected:

int c, d;

void getvalB();

public:

void putvalB()

const ;

};

class Wisdom: private yoga

{

int p;

protected:

int q;

void getval();

public:

void showval();

};

i) Name all the member functions, which are accessible by the objects of class wisdom.

ii) Name all the protected members of class yoga.

iii) Name the base class and derived class of yoga

iv) Name the data members, which are accessible from member functions of class wisdom

v) Give the size of object of wisdom.

vi) Name the OOPS concept implemented above and its type

vii) Name the members accessible by function get putvalB().

e)

Array

Q.1 write a user define function xyz() which takes a two dimensional array with size N rows and N columnsas argument and store all 1)even in one dimensional array2) All odd in one dimensional array 3) display product of all the number except those which are not divisible by either 5 or 3.

Q. 2 write a user define function unitdigit() which takes a two dimensional array with size N rows and M columns as argument and store all i) unit digit ii) except unit digit

In two dimensional array. i.e

A[2][3] = 200 213

56 657

Resultant array should be

i) A[2][3] = 0 3

6 7

ii) A[2][3] = 20 21

5 65

Q. 3 write a user define function repeat() which takes a two dimensional array with size N rows and M columns as argument and convert all repeated element into zero.

Q. 4 write a user define function convert() which takes a one dimensional array with size N as argument and convert it into two dimensional array.

Suppose arr[6]= { 1,2,3,4,5,6}

Resultant array should be

Arr[6][6] = 2 1 4 3 6 5

2 1 4 3 6 0

2 1 4 3 0 0

2 1 4 0 0 0

2 1 0 0 0 0

2 0 0 0 0 0

· Write a function in C++ to replace the repeating elements in an array by 0 . The zeros should be shifted to the end. Do not use parallel array . The order of the array should not change. ( 2 )

Eg : Array : 10 , 20 , 30 , 10 , 40 , 20 , 30

Result : 10 , 20 , 30 , 40 , 0 , 0 , 0

f) Write a function in C++ called shift( ) to rearrange the matrix as shown . Do not use parallel matrix . ( 2 )

Original Matrix Rearranged Matrix

1 2 -3 -2 -3 -2 1 2

0 -1 2 1 -1 0 2 1

-3 9 -4 4 -3 -4 9 4

g) Convert to postfix form : ( 2 )

A + ( B * C ) ^ D / ( E * ( F – G ) – B ) * C ^ D

f) Evaluate the following postfix expression using a stack and show the contents of the

stack after the execution of each operation.

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

3 , 5, + , 6 , 4 , - , * , 4 , 1 , - , 2 , ^ , +

3. a) . Write C++ function insert and delete in double link list. ( 2 )

b) Write a function in C++ to find the sum of alternate diagonal elements from a two dimensional array of type float. Use the array and its size as parameters with float as its return type.

c) An array A[25][10] is stored in memory in column wise with each of its element occupying 4 bytes . Find out the base address and the address of the element A[12][7] , if the location of A[15][9] is stored at address 7500 . ( 2 )

4. a) Observe the program segment given below carefully and fill the blanks marked as statement 1 and statement 2 using seekg() and tellg() functions for performing the required task:

#include

class employee

{

int Eno; char Ename[20];

public:

//Function to count the total number of record

int countrec();

};

int employee :: countrec()

{

employee item;

fstream file;

file.open(“EMP.DAT”,ios::binary|ios::in);

------------------------//statement 1

int Bytes = -------------------- //statement 2

int count = Bytes / sizeof(item);

file.close();

return count;

}

(b) Assuming that a text file UN.TXT contains some text written into it, write a function named countalpha() , countdigit() .

“between 1980 and 1995 a joint UNICEF-WHO effort raised global immunization coverage against 6 killer diseases- polio , tetanus, measles,whooping cough,diphtheriaand tuberculosis- from 5 to 80 percent.

Q.5

a. What do you understand by Foreign key and cardinality in a data base ( 2 )

b. Consider the following tables SCHOOL and ADMIN. Write SQL commands for the statements (i) to (iv) and give outputs for SQL queries (v) to (viii).

SCHOOL

CODE

TEACHERNAME

SUBJECT

DOJ

PERIODS

EXPERIENCE

1001

RAVI SHANKAR

ENGLISH

12/03/2000

24

10

1009

PRIYA RAI

PHYSICS

03/09/1998

26

12

1203

LISA ANAND

ENGLISH

09/04/2000

27

5

1045

YASHRAJ

MATHS

24/08/2000

24

15

1123

GANAN

PHYSICS

16/07/1999

28

3

1167

HARISH B

CHEMISTRY

19/10/1999

27

5

1215

UMESH

PHYSICS

11/05/1998

22

16

ADMIN

CODE

GENDER

DESIGNATION

1001

MALE

VICE PRINCIPAL

1009

FEMALE

COORDINATOR

1203

FEMALE

COORDINATOR

1045

MALE

HOD

1123

MALE

SENIOR TEACHER

1167

MALE

SENIOR TEACHER

1215

MALE

HOD

i) To display TEACHERNAME, PERIODS of all teachers whose periods less than 25 and name start with either R or U..

ii) Display the contents of school table in descending order of teacher name.

iii) Display all from table school from where period is between 10 and 20.

iv) To display TEACHERNAME, CODE and DESIGNATION from tables SCHOOL and ADMIN for female teacher..

v) To display the TEACHERNAME who have minimum PERIODS.

vi) Increase 2 years experience in all the female records.

vii) Delete all the records of subject physics.

viii) Insert a row in ADMIN TABLE.

ix) CREATE a view of table school. .

x) Display the highest experience among all male teachers.

xi) Display code ,teachername, salary to be paid for the teacher using the table school ,where the salary to be paid = period * 507.50.

xii) To display CODE, TEACHERNAME and SUBJECT of all teachers who have joined the school after 01/01/1999.

xiii) SELECT MAX(EXPERIENCE), SUBJECT FROM SCHOOL GROUP BY SUBJECT;

xiv) SELECT TEACHERNAME, GENDER

FROM SCHOOL, ADMIN

WHERE DESIGNATION = ‘COORDINATOR’ AND

SCHOOL.CODE=ADMIN.CODE ;

vii) SELECT DESIGNATION, COUNT(*) FROM ADMIN

GROUP BY DESIGNATION HAVING COUNT(*) <3;

viii) SELECT COUNT(DISTINCT SUBJECT) FROM SCHOOL;

6. (a) State and verify De-Morgan’s, absorption Law in Boolean Algebra.

(b) Draw the circuit diagram for F = AB’C + C’B using NAND to NAND logic only.

(c) Write the Products of summand SOP form of the function G(U,V,W). Truth table representation of G is as follows:

U

V

W

G

0

0

0

0

0

0

1

0

0

1

0

1

0

1

1

1

1

0

0

1

1

0

1

0

1

1

0

0

1

1

1

1

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

F (A, B, C, D) = (0, 1, 2, 3, 4, 5, 10, 11, 15) and

F (A, B, C, D) = (0, 6, 8, 9, 10, 11, 13, 15)

e) Write short note on principles of Duality.

f) Prove algebraically (X + YZ) =(X+Y) (X+Z)

g) A Boolean function F defined on three input variables A, B, C and is 1(one) if and if only if number of 0(zero) inputs is odd (e.g. F is 1(one) if A=0, B=1, C=1). Draw the truth table for the above function and express it in canonical sum of product form.

h) Simplify the following Boolean expression using K-map :

F(A, B, C, D)=m0 + m1 + m4 + m5 + m7 + m8

i) Draw the diagram of digital circuit for the function

F(X,Y,Z)=(X+Y) . (X+Y) .(Y+Z)

7 (a) Write the difference between coaxial and optical fiber cable.

(b) Explain the following terms in short :

(i) GSM ii) CDMA

© What us the difference between Message switching technique and Packet switching technique ?

(d) Expand the following :

a. TCP/IP,XML,CDMA,WLL

(e) Write two applications of Cyber Law.

(f) East and West Public Ltd. has decided to network all its offices spread

in five buildings of C.P. (Shown below).





The distance between buildings are given below:

Between 1 & 2

20 Mts

Between 3 & 5

70 Mts

Between 2 & 3

50 Mts

Between 1 & 5

65 Mts

Between 3 & 4

120 Mts

Between 2 & 5

50 Mts

Between 4 & 5

30 Mts

(i) Suggest cable layout(s) for connecting the buildings. 1

(ii) Suggest the most suitable building to install the server of this organization with a suitable reason, with justification. 1

(iii) Building3 is used for many critical operations. It is tried that PC gets maximum possible bandwidth. Which network device is/should be used for this? 1

(iv) The company also has another office in the same city but at a distant location about 25-30 kms away. How can link be established with this building. 1

(i.e. suggest the transmission medium).

 

iCBSE India