You are on page 1of 9

KENDRIYA VIDYALAYA SANGATHAN: BHUBANESWAR

REGION
THIRD PRE-BOARD EXAMINATION 2015 FOR CLASS XII
Subject: Computer Science
Max Marks: 70
GENERAL INSTRUCTIONS:
1. All questions are compulsory
2. Programming Language : C++

Time: 3Hrs

1. (a) Differentiate between call by value and call by reference with suitable
example.
(2)
(b) Which C++ header files are required for the following program code to
execute?
(Note: do not include any header file which are not required)
(1)
void main()
{
cout<<Square root of 625 is: <<sqrt(625);
}
(c) Rewrite the following program after removing the syntax errors. Underline
each correction. (2)
#include<iostream.h>
#include<conio.h>
class Exam
{
char NameOfExam[20];
int Year;
public
void getexamdetails()
{
cout<<"Enter name of the exam: ";
gets(NameOfExam);
cout<<"Enter year of exam: ";
cin>>Year;
}
void showexamdetails()
{
cout<<NameOfExam<<"\n<<Year;
}
}
void main() {
1

Exam E1;
getexamdetails();
showexamdetails();
}
(d) Observe the following C++ code carefully and write output.
(2)
#include<iostream.h>
#include<string.h>
int main()
{
char *STR="AeroDynamics";
int A=1;
STR+=3;
while(A<9)
{
cout<<*STR<<strlen(STR)<<"\n";
STR++;
A=A+2;
}
return 0;
}
(e) Write output for the following program.
(3)
#include<iostream.h>
#include<conio.h>
struct ITEM
{
int ICode , Qty;
};
void assigndetail( ITEM & I, int Q=5)
{
I.ICode++;
I.Qty*=Q;
}
void main()
{
clrscr();
ITEM T={200,25};
assigndetail(T,10);
cout<<T.ICode<<":"<<T.Qty<<"\n";
assigndetail(T);
cout<<T.ICode<<":"<<T.Qty<<"\n";
assigndetail(T,6);
cout<<T.ICode<<":"<<T.Qty<<"\n";
2

getch();
}

(f) Study the following program carefully and select the option which is NOT a
possible output.(2M)
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
const int VALUE=15;
int main()
{
clrscr();
int INCR=5;
randomize();
for(int i=1;i<5;i++)
{
int bid=VALUE+random(INCR);
cout<<bid<<":";
INCR+=2;
}
getch();
return 0;
}
(i)
16:19:22:25:
(ii)
19:16:15:24:
(iii) 15:18:20:16:
(iv) 18:22:23:19:
2. (a) What is function overloading? Explain with a suitable example.
(2)
(b) Study the following program code and answer the questions given below.
class TIME
{
int Hrs,Min,Sec;
public:
TIME(){Hrs=Min=Sec=0;}
//Function 1
TIME(int H,int M,int S)
//Function 2
{
Hrs=H;
Min=M;
Sec=S;
}
TIME(TIME & T);
//Function 3
~TIME(){ }

//Function 4

};
3

(i)
(ii)

Which feature of OOP is implemented by functions 1,2 and 3.


(1)
In OOP what is function 4 and when it is invoked?
(1)

(c) Define a class LAPTOP with the details given below.


(4)
Company of type char array
ModelNo of type char array
Screensize of type integer
Price of type integer
A function setPrice() to supply value for Price as follows
o If screensize is 14 and Company is HP then Price will be 45000
o If screensize is 15 and Company is HP then Price will be 43000
o If screensize is 14 and Company is DELL then Price will be 44000
o If screensize is 15 and Company is DELL then Price will be 42000
Public members:
A default constructor to supply initial values for Company, ModelNo,
Screensize, Price as Not Assigned , Not Assigned , 0, 0
A function setdetails() that supplies values for Company, ModelNo, size
and invokes setPrice() function.
A function display() to display all details.
(d) Answer the questions (i) to (iv) based on the following code.
(4)
class COMPANY
{
char Location[20];
double Budget, Income;
protected:
void Accounts();
public:
COMPANY();
void Register();
void Show();
};
class FACTORY: public COMPANY
{
char Location[20];
int Workers;
protected:
double salary;
4

void Compute();
public:
FACTORY();
void Enter();
void Show(); };
class SHOP: private COMPANY
{
char Location[20];
float Area;
double Sale;
public:
SHOP();
void Input();
void Output();
};
(i)
(ii)
(iii)
(iv)

Name the type of inheritance illustrated in the above C++ code.


Write the names of the data members, which are accessible from
member functions of class SHOP.
Write the names of all member functions which are accessible from
objects of class FACTORY
Write the names of all the members , which are accessible from the
objects of class SHOP.

3. (a) Write a function voidmodifylist( int A[], int Size) in C++ , which modifies
the elements present
in an array in such a way that the elements, which are multiples of 7 swap with
the value
present in the very next position in the array.
(3)
For example:
If the content of the array A is
42, 12, 57, 63, 25, 78
The content of the array should become
12, 42, 57, 25, 63, 78
(b) An array S[30][20] is stored in the memory along the row with each of the
element occupying 2 bytes .find out the memory location for the element S[15]
[10] , if the base address of the array
is 3200.
(3)
(c) Write a function void showabove(int A[4][4], int R, int C)to display all the
elements above the
Right Diagonal in a 2D array.
(2)
(d) Evaluate the following postfix stack notation of expression:
(2)
6,7,+,4,*,32,-,5,/

(e) Write a function in C++ to perform insertion operation in a circular queue.


(4)
4. (a) Observe the program code given below and fill in the blanks marked as
Statement1 and
Statement2 using seekg() and tellg() functions for performing the required
task:
(1)

#include<fstream.h>
class Movie
{
char moviename[25];
char actorname[25];
public:
int count(); // A function to count no.of records
};
int Movie:: count()
{
fstream file;
file.open(Movie.DAT,ios::binary| ios::in);
.. //Statement1
intTotalbytes= .. //Statement2
int number_of_records=Totalbytes / sizeof(Movie);
file.close();
return number_of_records;
}
(b) Write a function in C++ to count the number of lowercase alphabets present
in a text file BOOK.TXT.
(2)
(c) Assume the class STUDENT as declared below
class STUDENT
{
char name[20];
int std;
char schoolname[20];
int age;
public:
void register();
void show();
int get_std();//returns std;
};
Write a function BACKUP() in C++, that would copy only those records
having std as12 from
STUDENT.DAT to STUDENTBACK.DAT.
(3)

5. (a) What do you understand by degree and cardinality of a table?


(2)
(b) Consider the following tables WORKER and PAYLEVEL and answer questions (1)
and (2)
Table: WORKER
ECODE NAME
11
12
13
14
15

VinayKatiyar
Ritesh
Abhinav
Dharaneedhar
Manoj

DESIGNATION PLEVE
L
Supervisor
P001
Operator
P003
Operator
P003
Mechanic
P002
Clerk
P002

DOJ

DOB

13-Sep-2004
22-Feb-2006
14-May-2009
21-Apr-2008
22-Dec-2009

23-Aug-1981
12-July-1987
14-Oct-1983
21-Nov-1985
24-Jun-1984

Table: PAYLEVEL
PLEVEL
P001
P002
P003

PAY
26000
24000
18000

ALLOWANCE
12000
10000
6000

1)

Write SQL queries for the following statements:


(4)
(i) To display details of all Workers in descending order of DOJ.
(ii) To display NAME and DESIGNATION of those Workers whose PLEVEL is
either P001 or P002.
(iii) To display details of all Workers whose DOB is between 10-Mar-1984 and
31-Dec-1986.
(iv) To add a new row with following values:
16, Ketan, Clerk, P002, 14-Feb-2007, 25-Jan-1984
2)
Write output for the following SQL queries:
(2)
(i) Select PLEVEL, count(*) from WORKER group by PLEVEL;
(ii) Select Max(DOB), Min(DOB) from WORKER;
(iii) Select NAME,PAY from WORKER, PAYLEVEL where
WORKER.PLEVEL=PAYLEVEL.PLEVEL and ECODE>13;
(iv) Select PLEVEL,PAY+ALOWANCE from PAYLEVEL where PLEVEL=P002;
6. (a) State and prove DeMorgans laws in Boolean Algebra.
(2)
(b)
Draw a logical circuit for the following Boolean expression:
(2)
X. (Y + Z )
(c)
Write SOP form of a Boolean function G, which is represented in a truth
as follows: (1)
P
0

Q
0

R
0
7

G
0

0
0
0
1
1
1
1

0
1
1
0
0
1
1

1
0
1
0
1
0
1

0
1
0
1
0
1
0

(d)

Reduce the following Boolean Expression using K-Map:


(3)
F(A,B,C,D) = (2,3,4,5,6,7,8,10,11)

7. (a) Differentiate between Bus and Star topology with a neat diagram.
(2)
(b)
Expand the following:
(2)
(i) GSM
(ii) CDMA
(iii)
WLL
(iv)
SMTP
(c)
Knowledge Supplement Organization has set up its new centre at
Mangalore for its office and
web based activities. It has four buildings Alpha, Beta, Gamma, Lambda.
Answers questions
(i)to (iv) based on data given.
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

i)

Suggest a cable layout of connections between the buildings


(1)
8

(d)
(e)
(1)

ii)

Suggest the most suitable place (i.e. building) to house the server of
this organization with a suitable reason.
(1)

iii)

Suggest the placement of the following devices with justification:


( +)
i. Repeater
ii. Hub/Switch

iv)

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?
(1)
Give any two examples for Open Source Software.
(1)
What is protocol?

**************

You might also like