Class – XII
Subject COMPUTER SCIENCE
Time Allowed: 3hours Maximum
Marks: 70
Note. (i)
All questions are compulsory.
(ii) Programming
Language: C+ +

Question
1.
a)
What is the similarity and
difference between break and continue statements? 2
b)
Write the names of the header
files to which the following belong: 1
i) puts() ii)
sin()
c)
Rewrite the following program
after removing the syntactical error(s) if any. Underline each correction. 2
#include<iostream.h>
void main()
{
First=10,
Second=20;
Jumpto(First;Second);
Jumpto(second);
}
void Jumpto(int
N1, int N2=20)
{
N1=N1+N2;
cout>>N1>>N2
}
d)
Give the output of the
following program: 2
#include<iostream.h>
int g=20;
void Func(int
&x, int y)
{
x=x-y;
y=x*10;
cout<<x<<’,’<<y<<”\n”;
}
void main()
{
int g=7;
Func(g,::g);
cout<<g<<’,’<<::g<<’\n’;
Func(::g,g);
cout<<g<<’,’<<::g<<’\n’;
}
e)
Find the output of the
following program: 3
#include<iostream.h>
#include<ctype.h>
typedef char
Txt80[80];
void main()
{
char *PText;
Txt80
Txt=”Ur2GReAt”;
int N=6;
PText=Txt;
while(N>=3)
{
Txt[N]=isupper(Txt[N])? tolower(Txt[N]):toupper(Txt[N]);
cout<<PText<<endl;
N--;
PText++;
}
}
f)
The following code is from a
game, which generates a set of 4 random numbers. Anuska is playing this game; help
her to identify the correct option(s) out of the four choices given below as
possible set of such numbers generated from the program code so that she wins
the game. Justify your answer. 2
#include<iostream.h>
#include<stdlib.h>
const int LOW=25;
void main()
{
randomize();
int POINT=5,
Number;
for(int
I=1;I<=4;I++)
{
Number= LOW + random(POINT);
cout<<Number<<”:”;
POINT--;
}
}
(i) 29:
26: 25: 28: (ii) 24: 28: 25: 26:
(iii) 29: 26: 24: 28: (iv) 29: 26: 25: 26:
Question
2.
a)
What is the difference between
abstract class and concrete class? 2
b)
Answer the questions (i) and
(ii) after going through the following class: 2
class Science
{
char Topic[20];
int Weightage;
public:
Science ( ) //Function 1
{
strcpy (Topic,
“Optics” );
Weightage = 30;
cout<<“Topic
Activated”;
}
~Science( ) //Function 2
{
cout<<”Topic
Deactivated”;
}};
(i) Name the
specific features of class shown by Function 1 and Function 2 in the above
example.
example.
(ii) How would
Function 1 and Function 2 get executed?
c)
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. 4
Private Members :
Data : Candidate_Name
, Party , Vote_Received
Public members :
Functions : Enterdetails
( ) – to input data
Display ( ) – to
display the details of the candidates
Winner ( ) – To display
the details of the winner through the object after comparing the votes received
by three candidates.
d)
Answer the question (i) to (iv) based on the following 4
class Book
{
char Title[20];
char Author[20];
int noofpages;
public:
void read();
void
show();
};
class TextBook:
private Book
{ int noofchap,
noofassignments;
protected:
int standard;
public:
void
readtextbook();
void
showtextbook();
};
class Physicsbook: public TextBook
{
char Topic[20];
public :
void
readphysicsbook();
void
showphysicsbook();
};
(i) Names the
members, which are accessible from the member functions of class Physicsbook.
(ii) Write the
names of members, which are accessible by an object of class Textbook.
(iii) Write the
names of all members, which are accessible by an object of class Physicsbook.
(iv) How many
bytes will be required by an object belonging to class Physicsbook.
Question
3.
a)
Write a Get1From2( ) function
in C++ to transfer the content from two arrays FIRST[] and SECOND[] to array
ALL[]. The even places (0,2,4,…) of array ALL[] should get the content from the
array FIRST[] and odd places(1,3,5,…) of the array ALL[] should get the content
from array SECOND[]. 3
Example:
If the FIRST[] array contain
30,60,90
And the SECOND[] array contain
10,50,80
The ALL[] array should contain
30,10,60,50,90,80
b)
An array T[50][20] is stored in
the memory along the column with each of the element occupying 4 bytes, find
out the base address and address of element T[30][15], if an element T[25][10]
is stored at the memory location 9800. 4
c)
Write a function QUEDEL() in
C++ to display and delete an element in a dynamically allocated Queue
containing nodes of the following given structure: 3
struct NODE
{
int Itmemo;
char
Iteamname[20];
NODE *Link;
};
d)
Define a function SWAPARR() in
C++ to swap (interchange) the first row
elements with the last row elements, for a two dimensional integer array passed
as the argument of the function. 2
Example: If the two dimensional array contains
5
|
6
|
3
|
2
|
1
|
2
|
4
|
9
|
2
|
5
|
8
|
1
|
9
|
7
|
5
|
8
|
After swapping of the content of first row and last row, it should
be as follows:
9
|
7
|
5
|
8
|
1
|
2
|
4
|
9
|
2
|
5
|
8
|
1
|
5
|
6
|
3
|
2
|
e)
Convert the following infix
expression to its equivalent postfix expression showing stack contents for the
conversion: 2
A+B*(C – D)/ E
Question
4.
a)
Observe the program segment
given below carefully and fill in the blanks marked as Line 1 and Line 2 using
fstream functions for performing the required task. 1
#include<fstream.h>
class Library
{
long Ano; //Ano-
Accession Number of the Book
char Title[20]; //Title- Title of the Book
int Qty; //Qty- Number of Books
in Library
public:
void Enter(int); //Function to enter the
content
void Display(); // Function to display the content
void Buy (int
Tqty)
{
Qty+=Tqty;
} //Function to increment in Qty
long GetAno()
{return Ano;}
};
void
BuyBook(long BAno, int BQty)
//BaNo-> Ano
of the book purchased
//QBty->
Number of books purchased
{
fstream File;
File.open("STOCK.Dat",
ios :: binary|ios::in|ios::out);
int Position=-1;
Library L;
while
(Position==-1 && File.read((char*)&L,sizeof (L)))
if(L.GetAno()==BAno)
{L.Buy(BQty);
//To update the number of Books
Position =
File.tellg( )-sizeof(L);
//Line1: To
place the file pointer to the required position;
_________;
//Line 2: To
write the object L on to the binary file
_________;
}
if (Position ==
-1)
cout<<
"No updation done as required Ano no found.";
File.close();
}
b)
Write a function COUNT_TO( ) in
C++ to count the presence of a word “to” (independent word only) in a text file
“NOTES.TXT” 2
Example:
If the content
of the file “NOTES.TXT” is a follows:
It is very
important to know that
Smoking is
injurious to health.
Let us take
initiative to stop it.
The function
COUNT_TO( ) will display the following message:
Count of – to-
in file : 3
Note : In the
above example, ‘to’ occurring as a part of word stop is not considered.
c)
Write a function in C++ to search for a Toy having a
particular Toy Code (Tcode) from a binary file “TOY.DAT” and display its
details (Tdetails), assuming the binary file is containing the objects of following
class: 3
class TOYSHOP
{
int Tcode; //Toy Code
char Tdetails[20];
public:
int RTcode()
{
return Tcode;
}
void AddToy()
{cin>>Tcode;gets(Tdetails);}
void DisToy()
{cout<<Tcode<<Tdetails<<endl;}
};
Question
5
a)
What do you understand by the
term Candidate Key and Cardinality of a relation in relational database? 2
b) Consider the following tables TEACHER and TEACHSALARY and answer (b1)
and (b2) parts of this question. 4+2=6
Table: TEACHER
TID
|
FIRSTNAME
|
LASTNAME
|
ADDRESS
|
SUBJECT
|
010
|
Rohit
|
Sharma
|
83 Lok vihar
|
English
|
105
|
Meena
|
Rathi
|
842 Rajouri Garden
|
Physics
|
152
|
Seema
|
Verma
|
33 Safdarjung
|
Maths
|
215
|
Sarad
|
Singh
|
440 Ashok Vihar
|
Physics
|
144
|
Manish
|
Sengupta
|
24 New Street
|
Maths
|
300
|
Ram
|
Gupta
|
9 Fifth Road
|
Chemistry
|
335
|
Heena
|
Jain
|
12 Friends Street
|
Computer
|
400
|
Rachit
|
Sharma
|
12 Pachim Vihar
|
Computer
|
441
|
Puneet
|
Jain
|
11 Roshni
|
Chemistry
|
Table: TEACHSALARY
TID
|
SALARY
|
BONUS
|
DESIGNATION
|
010
|
7500
|
1500
|
PGT
|
105
|
8500
|
1500
|
PGT
|
152
|
600
|
1200
|
TGT
|
215
|
7500
|
1500
|
TGT
|
144
|
5000
|
1000
|
PRT
|
300
|
4500
|
1000
|
PRT
|
335
|
4000
|
1000
|
PRT
|
400
|
6500
|
1200
|
TGT
|
441
|
7800
|
1500
|
PGT
|
(b1) Write SQL commands for the statements (i) to
(iv).
- To display Firstname, Lastname and Subject of all teachers having subject Physics.
- To display the content of Teachers table in ascending order of LASTNAME.
- To display the TID, Firstname and Total Salary of all PGT from table TEACHER and TEACHSALARY, where Total Salary is calculated as Salary + Bonus.
- To display the sum of salary of all the PRT Teachers.
(b2) Give the output of the following SQL queries v to
viii:
- SELECT FIRSTNAME, SALARY FROM TEACHER, TEACHSALARY WHERE DESIGNATION =”PGT” AND TEAHER.TID=TEACHSALARY.TID;
- SELECT DISTINCT DESIGNATION FROM TEACHSALRY;
- SELECT DESIGNATION, MAX(SALRY) FROM TEACSALRY GROUP BY DESIGNATION;
- SELECT SUM(BONUS) FROM TEACHSALRY WHERE DESIGNATION=”PGT”;
Question
6.
a)
Verify the following using
Truth Table: 2
X+Y.Z=(X+Y).(X+Z)
b)
Write the equivalent Boolean expression of the following logic
Circuit : 2

c)
Write the SOP form of a Boolean
Function F, which is represented in a truth table as follows: 1
X
|
Y
|
Z
|
F
|
0
|
0
|
0
|
1
|
0
|
0
|
1
|
0
|
0
|
1
|
0
|
1
|
0
|
1
|
1
|
0
|
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)= S(2,3,4,5,6,7,8,10,11)
Question
7
a)
What out the following, will
you use to have an audio-visual chat with an expert sitting in a far away place
to fix up a technical issue? 1
i) VoIP ii) email iii) FTP
b)
What do you mean by a backbone
network? 1
c)
What is telnet? 1
d)
Abhishek’s friend Surya visited
his office for giving and invitation for his wedding. During the visit, he
requested Abhishek to work on his office computer to send an urgent mail. While
working on the computer, Surya was tempted by seeing some important document on
his desktop and cleverly uploaded them to his online folder without taking consent
(Surya did not even inform Abhishek about this). What name from the following
would you give to the above act committed by Surya? 1
i) Trojan ii) Cyber Crime iii) Virus
e)
Expand the following terms: 1
i) FLOSS ii) XML
f)
Name two Proprietary softwares
along with their application? 1
g)
Freshminds University of India
is starting its Campus in Ana Nagar of South India
with its center admission office in Kolkata. The university has 3 major blocks
comprising of Office Block, Science Block and Commerce Block in the 5 km area
Campus. 4
As a network expert,
you need to suggest the network plan as per (i) to (iv) to the authorities
keeping in mind the distance and other given parameters.
![]() |




Expected
Wire distance between various locations:
Office Block to Science Block
|
90 m
|
Office Block to Commerce Block
|
80 m
|
Science Block to Commerce Block
|
15 m
|
Kolkata Admission office to Ana Nagar
Campus
|
2450 km
|
Expected
numbers of Computers to be installed at various locations in the University are
as follow:
Office Block
|
10
|
Science Block
|
140
|
Commerce Block
|
30
|
Kolkata Admission Office
|
8
|
- Suggest the authorities, the cable layout amongst various blocks inside university campus for connecting the blocks.
- Suggest the most suitable place (i.e., block) to house the server of university with a suitable reason.
- Suggest an efficient device from the following to be installed in each of the blocks to connect all the computers:
Ø MODEM
Ø SWITCH
Ø GATEWAY
- Suggest the most suitable (very high speed) service to provides data connectivity between admission Office located in Kolkata and the campus located in Ana Nagar from the following options:
Ø Telephone Line
Ø Fixed-Line Dial-up
connection
Ø Co-axial cable network
Ø GSM
Ø Leased line
Ø Satellite Connection
Comments
Post a Comment