KVBSF JODHPUR
PRE BOARD I
Class – XII
Subject – Computer Science(083)
Time: 3 Hours Maximum
Marks : 70
Instructions : (i) All questions are
compulsory.
(ii) Programming Language : C++
(iii) Please check that question paper contains 7
questions
(iv) Please write down the serial number of the
question before attempting it
Q1
a) What is escape sequence ? List four
escape sequence characters. 2
b)
Name the header file required for successful compilation of the given snippet 1
void main()
{
ifstream fin(“story.txt”);
char ch;
int alpha=0;
if(isalpha(fin.get(ch))
++alpha;
fin.close();
getch();
}
c) Rewrite the following program after removing
all the syntax errors(s), if any 2
include<iostream.h>
void main()
{
int
p[]={90,10,24,15};Q,Number=4;
Q=9;
For(int
I=Number-1;I>=0;I--)
switch(I)
{
case
0:
case
3: cout>>p[I]*Q<<endl;break;
case
1:
case
2: cout<<p[I]+Q;
}
}
d) Observe the following program RANDNUM.CPP carefully. If the value
of VAL entered by the user is 10, choose the correct possible output(s) from
the options from i) to iv) and justify
your option [2]
//program
RANDNUM.CPP
#include<iostream.h>
#include<stdlib.h>
#include<time.h>
void
main()
{ randomize();
int
VAL, Rnd; int n=1;
cin>>VAL;
Rnd=8
+ random(VAL) * 1;
while(n<=Rnd)
{ cout<<n<< “\t”;
n++;
}
}
output options:
i) 1 2 3
4 5 6 7 8
9 10 11 12 13 ii) 0
1 2 3
iii) 1 2 3
4 5 iv) 1 2
3 4 5 6 7
8
e) Find the output of the
following program: 2
#include<iostream.h>
#include<ctype.h>
void main()
{
char
Mystring[]=”What@OUTPUT!”;
for(int
I=0;Mystring[I]!=’\0’;I++)
{
if(!isalpha(Mystring[I]))
Mystring[I]=’*’;
else if
(isupper(Mystring[I]))
Mystring[I]=Mystring[I]+1;
else
Mystring[I]=Mystring[I+1];
}
cout<<Mystring;
}
f) write a recursive function to find the GCD of two
Numbers 2
2 a)
what are advantages and disadvantages of inline functions
b) Define a class PhoneBill in C++ with the following
descriptions. (4)
Private members:
CustomerName of type character array
PhoneNumber of type long
No_of_units of type int
Rent of type int
Amount of type float.
calculate( ) This member function should calculate the value
of amount as Rent+ cost for the units.Where cost for the units can be
calculated according to the following conditions.
No_of_units Cost
First 50 calls Free
Next 100 calls 0.80 @ unit
Next 200 calls 1.00 @ unit
Remaining calls 1.20 @ unit
Public members:
* A constructor to assign initial values of CustomerName as
“Raju”, PhoneNumber as 259461, No_of_units as 50, Rent
as 100, Amount as 100.
* A function accept( ) which allows user to enter CustomerName,
PhoneNumber,No_of_units and Rent and should
call function calculate( ).
* A function Display( ) to display the values
of all the data members on the screen.
d) Write the output of the following program code 2
#include<iostream.h>
class Cube{
private:
int
height,width,depth;
public:
Cube(int
h, int w,int d)
{
height=h;
width=w;
depth=d;
}
int
Volume()
{
return
height*width*depth;
}
~Cube()
{
cout<<endl<<”I
am going out of scope”;
}
};
void main()
{
Cube
C(10,5,6);
Cout<<endl<<C.Volume();
}
(e)Answer
the questions (i) to (iv) based on the following: 4
class
PUBLISHER
{
char
Pub[12];
double
Turnover;
protected:
void
Register();
public:
PUBLISHER();
void
Enter();
void
Display();
};
class BRANCH
{
char
CITY[20];
protected:
float
Employees;
public:
BRANCH();
void
Haveit();
void
Giveit();
};
class AUTHOR
: private BRANCH , public PUBLISHER
{
int Acode;
char
Aname[20];
float
Amount;
public:
AUTHOR();
void
Start();
void Show();
};
(i) Write
the names of data members, which are accessible from objects belonging to class
AUTHOR.
(ii) Write
the names of all member functions which are accessible from objects belonging
to class BRANCH.
(iii) Write the
names of all the members which are accessible from member functions of class
AUTHOR.
(iv) How
many bytes will be required by an object belonging to class AUTHOR?
3)a) Write a function for insertion sort
to sort an array of strings (3)
b) X [1..6][1….10]
is a two dimensional array. The first element of the array is stored at
location 100. Each element of the array occupies 6 bytes. Find the memory
location of X[2][4] when (i) array is stored row wise. (ii)array is stored
column wise. (3)
c)write a function to add
middle column elements of two matrices and store in a 1d array. Assuming that
both matrices are order of n*n(n rows and n columns) where n is odd
number. for example
matrix1 matrix2 result
1 2 3 4
5 6 2+5
4 4 4 2
3 4 4+4
6 5 4 3
3 3 5+3
d) Struct node{
int
Ano;
char
Cname[30];
struct
node* link;
};
class
stack{
node
*top;
public:
stack()
{top=NULL:}
void
Push(int a,char cn[20]) {}
void
Pop();
};
write the complete definition of Push function 4
e) Evaluate the postfix
expression using a stack. Show the contents of stack after execution of
each operation.
TRUE,FALSE,TRUE,FALSE,NOT,OR,TRUE,OR,OR,AND
4) a) Differentiate
between seekp() and tellp() functions 1
b) write a function to read and display each line from a file
“story.txt” along with length of each
line. 2
c) write
a function which Read the objects of COLLEGE from binary file “college.txt” and
display them on the screen and count
no of colleges having place as “jodhpur”. 3
class COLLEGE
{
char
name[20];
char place[20];
public:
void
getdata()
{
cin>>name;
cin>>place;
}
void
display()
{
cout<<name;
cout<<place;
}
int
check(char p[20])
{
return
strcmp(placep);
}
}
5)a) Explain the following terms; (a) Primary
Key (b) Candidate Key
b) Given Table Schoolbus ,
write the SQL queries for the following
Table : SchoolBus
|
Rtno |
Area_overed |
Capacity |
No_of_ students |
Distance |
Transporter |
Charges |
|
1 |
Vasant kunj |
100 |
120 |
10 |
Shivam travels |
100000 |
|
2 |
Hauz Khas |
80 |
80 |
10 |
Anand travels |
86000 |
|
3 |
Pitampura |
60 |
55 |
30 |
Anand travels |
60000 |
|
4 |
Rohini |
100 |
90 |
35 |
Anand travels |
100000 |
|
5 |
Yamuna Vihar |
50 |
60 |
20 |
Bhalla Co. |
55000 |
|
6 |
Krishna Nagar |
70 |
80 |
30 |
Yadav Co. |
80000 |
|
7 |
Vasundhara |
100 |
110 |
20 |
Yadav Co. |
100000 |
|
8 |
Paschim Vihar |
40 |
40 |
20 |
Speed travels |
55000 |
|
9 |
Saket |
120 |
120 |
10 |
Speed travels |
100000 |
|
10 |
Jank Puri |
100 |
100 |
20 |
Kisan Tours |
95000 |
(i) To show area_covered for buses covering more than 20 km., but
charges less then 80000.
(ii)
To show transporter wise total no. of students traveling.
(iii)
To show rtno, area_covered and average cost per student for all routes where
average cost
per
student is - charges/noofstudents.
(iv)
Add a new record with following data:
(11,
“ Moti bagh”,35,32,10,” kisan tours “, 35000)
(v)
Give the output considering the original relation as given:
(a)
select sum(distance) from schoolbus where transporter= “ Yadav
(b)
select min(noofstudents) from schoolbus;
(c)
select avg(charges) from schoolbus where transporter= “ Anand travels”;
(d)
select distinct transporter from schoolbus;
6(a) State De Morgan’s
Theorems and verify the same using truth table. 2
(b) Write
the equivalent canonical product of sum expression for the following sum of
product
expression: F(X, Y,Z) =å (0, 2,4,5) 1
(c) Write the equivalent Boolean expression for the following
Logic Circuit: 2

(d) Reduce the following
Boolean expression using K – Map : 3
F(P, Q, R, S,) =P (0,3,5,6,7,11,12,15)
7 a) Expand the following terms with respect to
Networking. 2
(i) FDM (ii)
SMS
(iii)IMAP iv)WLL
b)Global Village
Enterprises has following four buildings in Hyderabad city. 4

Computers in each building are networked but
buildings are not networked so
far. The company has now decided to connect building
also.
(a) Suggest a cable layout for these buildings.
(b) In each of the buildings, the management wants
that each LAN segment gets
a dedicated bandwidth i.e bandwidth must not be
shared. How can this be
achieved?
(c) The company also wants to make available shared
Internet access for each of
the buildings. How can this be achieved?
(d) The company wants to link its head office in GV1
building to its
another office in Japan.
(i) Which type of
transmission medium is appropriate for such a link?
(ii) What type of network
would this connection result into?
c) What is baud? 1
d) Differentiate between hacker and cracker 1
e) differentiate between
freeware and shareware 1
f) Name the type of servers 1
KV BSF JODHPUR
COMPUTER SCIENCE (THEORY)
CLASS – XII SUBJECT
CODE – 083
MARKING SCHEME
1.a)
An escapesequence begins with a backslash\ followed by an alphanumeric
character which gives special meaning for that character which gives special
meaning for that character.
1mark for correct
defination.
Ex:-
‘\n’, ‘\a’, ‘\b’, ‘\t’
1/4
marks for each correct character
b)
i) fstream.h
ii) ctype.h
1/2
marks for each correct character
c) #include<iostream.h>
void main()
{
Int p[]=
{9,10,15,16} , Q , number=4;
Q=9;
for(int I=Number-1; I>=0; I--)
{
switch(I)
{
case 0:
case 3:
cout<<p[I]*Q<<endl; break;
case 1:
case 2:
cout<<p[I]+Q;
}
}
}
½
mark for each correction.
d) option (i)
and (iv) 1/2
mark for each correct answer.
Random (10) generates a value between 0 and 9 Rnd can be 8 to 17 loop runs for Rnd times may be 8 to 17 times so options (i) and (iv) are correct .
1 mark for correct
justification .
e) Xat@*PVUQVU*
½ mark for each correct combination of two characters .
f) int
GCD (int x,int y)
-------------------------- ½ mark for declaration
{
If (x%y==0)
-------------------------------------- ½ mark for correct condition .
return y;
---------------------------------- ½ mark
Else
return GCD (y, x%y); ------------ ½ mark for recursive call .
}
2
(a) (i) the main advantage of inline function is that it saves the time
of a function call , as the function is
not invoked , rather it code is
replaced in the program.
-------------------- 1 mark for correct
advantage
(ii)
the main disadvantage Is that
with more function call , memory is
wasted because whenever the function
is invoked the same function code is inserted in
the program.
-------------------- 1 mark for correct
disadvantage
(b)
class phonebill
{
char
customer name [30];
long
ph- number ;
int no. of units ;
int rent ;
float amount ; //------------------------------------ 1 mark for correct declaration
void calculate () --------------------------- 1 mark for calculate function
{
amount =
rent;
if (no. of units <=50)
amount +=0;
else if ( no.
of units <150)
amount +=(
no. of units -50)* 0.80;
else if ( no.
of units <=350)
amount +=80+
( no. of units -150)*1.00;
else
amount += 80
+200+( no. of units-350)*2.00;
}
public
:
phonebill () //--------------------- 1 mark for constructor.
{
strcpy ( customer name,”ram”);
ph- number=259461;
no . of units =50;
rent =100;
amount=100;
}
void accept() //--------------------- 1 mark for accept function.
{
cout<<”enter name”; cin.get line
(customer name,30);
cout<<”enter ph-number”; cin>>
ph- number;
cout<<”enter units”; cin>> no.
of units;
cout<<”enter rent”; cin>>rent;
calculate();
}
}
(C) 300 --------------- 1 mark for correct solution
I am
going out of scope ----------------- 1 mark
d) (i) No
date members ----------------- 1 mark
(ii)
haveit (), Giveit () -----------------
1 mark
(iii)
start(); Acode; Aname; ----------------- 1 mark
Show() ; Amount();
Haveit () ; Giveit(); employees;
Register ();Enter();Display ();
(iv) 70
bytes ----------------------------------
1 mark
3.(a) void
insertion_sort (char n[10] [20]) //---------------- 1/2 mark for correct
declaration
{
char t [20];
for (int i=1;i<n;i++) //----------------
1 mark for loops
{
strcpy (t ,n[i]);
for (int j=i-1;j>=0;j--)
{
If (strcmp (n[j],t)>0)
strcpy (n[j+1],n[j]); //---------------- 1 mark
for logic
else
break;
}
strcpy (n[j+1],t); //----------------
1/2 mark for correct insertion
}
}
(b) given
Lower index
l1 =1 , l2
=2
Base address b=100
No. of rows=6
No of columns=10
Size=6
Find address
of x[2][4] i.e. i=2,j=4 -------------½
marks correct formula
(i)row wise
Address of x[i][j]=b+w*((i-l1)*c+(j-l2))
=100+6*((2-1)*10+(4-1))
=100+6*(10+3)
= 100+78
=178 -------------1
mark for correct claculation.
(ii)column
wise
Address of x[i][j]=b+W*((i-l1)+(j-l2)*r) -------------½ marks for correct
formula
=100+6*(2-1+(4-1)*6)
=100+ 6*19
=214 -------------1
mark for correct claculation
1
mark for correct calculation
(c)
void
add_col(int a[5][5],int b[5][5],int n)
-------------½ marks for
declaration
{
int
s[5],I,j,m=n/2;
-------------½ marks for
finding middle
for
(i=0;i<n;i++) -------------½ marks for loop
{
s[i]=a[i][m]+b[i][m]; -------------½
marks for summation
}
for (i=0;i<=n;i++)
{
cout<<endl<<s[i];
}
}
(d)
void
stack:: push(int a char ch[20])
{
node*t=new node;
-------------½ marks for allocation
if(t==null) -------------½ marks
{
Cout<<”unable to allocate memory”;
return;
}
t->Ano=a; -------------1
mark{assigning values}
strcpy(cname,ch);
t->link=top; ------------- 1 mark for
linking
top =t ; -------------1
mark for updating
}
3(e) true, false,true,false,not,or,true,or,or,and
|
Step1: Push True
|
Step 2: Push false
|
Step 3: Push true
|
|||||||||||||||
|
Step4 Push false
|
Step5:NOT
Op2=false, not op2= true, push true |
Step 5 Push true
|
|||||||||||||||
|
Step 6: OR pop two
operands
Op1=true op2=true Op1 or op2=true Push true |
Step 7: push true
|
Step 8: OR pop two
operands
Op1=true op2=true Op1 or op2=true Push true |
|||||||||||||||
|
Step 9: OR pop two
operands
Op1=true op2=false Op1 or op2=true Push true |
Step 10: AND pop two
operands
Op1=true op2=true Op1 or op2=true Push true |
Step 11: Pop the Result
TRUE |
4.(a)
seekp() is used to move the file pointer for no. of bytes from the specified position.
Syntax: fp.seekp(no,position) -------------½
marks
Tellp() is used to know position of
file pointer in no. of bytes from the beginning of file.
Syntax: fp.tellp() -------------½
marks
(b)
void display()
{
ifstream fin(“story.txt”); ----½ marks for opening file
if(!fin)
{
cout<<”unable to open”;
return;
}
char line[100];
while(!fin.eof()) ----½ mark
correct loop
{
fin.getline(line,100); ----½
mark reading a line from file
cout<<line<<””<<strlen(line); ---½ mark for printing the line &
length of each line
}
fin.close()
}
c)
void count()
{
fstream fin ;
fin.open(“ college.txt
“,ios::in| ios::in| ios::binary); //----(1/2
marks for opening the file)
if (!fin)
{
cout<< “ unable to open “;
return ;
}
college c; char cn[20];
int f = 0;
cout<< “ enter college name to search “:
cin.getline(cn,20);
while(fin.read(char*)&c,sizeof(c)) //(1 marks for loop & reading each
record of the college)
{
if(strcmp(c,cn)==0) //----
(1/2 marks for correct comparision)
{
c.display(); //----
(1/2 marks for counting and displaying the
records)
f++;
}
}
fin.close();
if(f==0); ----
(1/2 marks for displaying not found or count)
cout<<”not found”;
else
cout<<”found,no of colegges of jodhpur”<<f;
}
}
5.(a)primary key:- The
attribute(column) or the set of attributes which is used to identify a
tuple(row) uniquely is known as primary key. --------(1/2
marks)
Candidate key:- The attributes or the sets of attribute which are eligible to be a primary key are called candidate key. --------(1/2 marks)
(b)
i)SELECT area covered //1 mark for correct query ½ mark for partially
correct query
FROM school bus
WHERE distance>20 and
charges<80000;
ii) SELECT count(no_of_students) //1 mark for correct query ½ mark for
partially correct query
FROM school bus
GROUP BY transportee;
iii)SELECT
rtno,area-covered,charges/no_of_students as averagecost
FROM schoolbus; //1 mark for correct query ½ mark for partially
correct query
iv)INSERT INTO //1 mark for correct query ½ mark for
partially correct query
VALUES(11,”moti
bagh”,35,32,10,”kishan tours”,35000);
½ mark for each correct output
v)
a)50, b)40, c)82000
d)shivam travels
anand
travels
bhalla co.
yadav co.
speed
travels
kisan
tours.
6)
a)
Demorgan’s theorem states that
i) (X+Y)’=X’.Y’ //1
mark for correct statement of theorem
ii)
(X.Y)’=X’+Y’
truth
table for verification of (X+Y)’=X’.Y’
|
x |
y |
X+Y |
(X+Y)’ |
X’ |
Y’ |
X’.Y’ |
|
0 |
0 |
0 |
1 |
1 |
1 |
1 |
|
0 |
1 |
1 |
0 |
1 |
0 |
0 |
|
1 |
0 |
1 |
0 |
0 |
1 |
0 |
|
1 |
1 |
1 |
0 |
0 |
0 |
0 |
Both
are eqaul so expression is verified hence dual is also verified.
//1 mark for correct
verification of theorem
b)
f(x,y,z)=∑(0,2,4,5)
=π(1,3,6,7) //
½ mark
Product of
sum = (X+Y+Z’ ). (X+Y’+Z’). (X’+Y’+Z). (X’+Y’+Z’) // ½ mark
c) A’B + AB +AB’+A’B’ //
¼ for each correct term
d)
F(P,Q,R,S)=π(0,1,3,5,6,7,11,12,15)
R+S R+S’ R’+S’ R’+S ---1 mark for K-map

00 01 11 10
|
0 0 |
0 1 |
0 3 |
2 |
|
4 |
0 5 |
0 7 |
0 6 |
|
0 12 |
13 |
0 15 |
14 |
|
8 |
9 |
0 11 |
12 |
00
P+Q
01
P’+Q
11
P’+Q’
01
P+Q’
for QUAD(M3, M7,M11,M15)=R’+S’ --- 1 mark for grouping
for
PAIR(M0,M1)=P+Q+R
for
QUAD(M1,M5,M3,M7)=Q+S’
for
PAIR(M7,M6)=P’+Q+R’
for
M12 =P’+Q’+R+S
(R’+S’).(P+Q+R).(Q+S’).(P’+Q+R’).(P’+Q’+R+S) --- 1 mark for correct expression
7)
a)
i) FDM- FREQUENCY DIVISION MULTIPLEXING
ii)
SMS- SHORT MESSAGE SERVICE
iii) IMAP- INTERNET MESSAGE ACCESS
PROTOCOL
iv) WLL- WIRELESS LOCAL LOOP
b)i)


20m
25m 30m


ii) Switches offer dedicated
bandwidth
iii) by installing router
shared internet access will be possible
iv) a) sattellite
communication
b) WAN
c) hackers- i)someone
intensly interested the workings of any computer operating system and are often
programmer
ii)they probe the system at
both macro and microcosmic level, finding holes in software and snags in logic
crackers-i)someone who breaks into or otherwise violets the
system integrity of remote machine with malicious internet.
ii) crackers can obtain unauthorised acces in which they can
destroy vital data.
d)i) dedicated server
ii) non-dedicated server
e) freeware- which is made
available of free of charge, but can’t be copied, modified or redistributed
ex- internet explorer
shareware-
which is made available for limited period of time, after that user has to pay
the licence fee.
ex- antivirus,