:OR. I\. B.
HEDGEWAR HIGHER SECONDARY SCHOOL
CUJIRA GOA
TERM EXAMINATION 2024
..
)?ATE·: 23 /11/2024
.... MARK S:70
STD : XII SCIENCE SUBJECT : COMPUTER SCIENCE TIME : 3 HOURS
INSTR UCTIO NS:
(i) All questions are compulsory, however there is an internal choice for
question number 31,32, 34
· and 35.
(ii) Question number I to 7 should be attempted only once.
(iii) Programs should be written in C++ only.
(iv) State your assumptions clearly.
Section A: Consists of 14· questions of 01 marks each.
Section B: Consists of 10 questions of 02 marks each.
.. Section C: Consists of 08 questions of 03 marks each.
Section D: Consists of 03 questions of 04 marks each.
1
SECTION A
When one class inherits the properti~s of more than one
;
1
classes, it is ----------- inheritance.
• Single • Multiple • Mµltilevel • Hierarchical
2 Write the CORR ECT alternative from those given below.
What is the prefix notation of (A+B) * C+ DAE
• AB+C D+E" • • AB+ G* DE"+
• +*+AB C/\~ • +AB*C+D"E
\)~
'"l
.) Write the CORR ECT alternative from those given below.
Which of the following is NOT used to seek a file pointer?
• ios::cur • ios::set
o ios::be g • ios::end
4 Write the CORR ECT alternative from those given below. 1
Which of the following algorithms is not feasible to
implem ent in a linked list?
• Linear Search t.., •Binar y Search
• Selection Sort ). \
• Merge Sort
(jJ Write the CORR ECT alternative from those given below.
The Boolea n function AB+ BC is equivalent to _ _ __
1
\ .I
•AB +BC+A C •ABC +A'BC +B'C'~ G
•A'B'C +ABC '+A'BC • ABC+ ABC'+ AB'C l\~1"'.\'
'{?cth .' I \
Write the CORR ECT alternafive from those given below. ~i
I
Which of the following is used to host Websites
•Web browse r
•Web Server
• Mail server
• Domai n
c) The
Write the CORR ECT alternative from those given below.
networ k device used to connect two dis-similar types of
1
networks.
•Switc h •Hub •Bridg e •Gatew ay
1
I 8
"---9
What is an Abstract Class?
State o~e point of difference between Constructor and
Normal Function?_ . ~t.~~
. .
I
1
1
10 What is Doub ly Linke d List? I
the follow ing funct ions are
11 Name the header file in which
present
a) Seekg()
... b) Tellp() ~ .,/ ~vlw
_f! ~~ 1
12 State Absorption La:" in Bo_olean Algebra.o-,xo-l..'.i..~) 1
What is the use of Firewall in networks?
~~-J',Y->
13 -, ~' 1
14 What is Telnet ?
SECTIONB
Svojas, 2
15 A queue Q initially contains the elements Nitesh,
with Nites h at
Priyanka, Rashmi, Rahul, Adeesh and Sush ma
the front and Sushtna at the end.
on the
The following _sequence of operations were done
queue Q. .
Delete,
Delete, Delete, Insert(Raj), Insert(Sonia), Delete,
Insert(I<artik)
which
Shovv the elements in the resulting queue and state
element is at the front and which eleme nt is at the end.
mem ber 2
16 Write statement 1 and statement .2 to execute the
for the
function 1 and 1nember function 2 respectively
follo,\'ing code:
class Exam
{ int code;
char Ename [20];
float marks;
publi c:
Exam() I!Member function 1
{ code = 100;
strcpy(Ena1ne, "N0Na1ne");
marks =0; }
Exam (Exam &e) //Member function 2
{
code = e.cod e + 1;
strcpy(Ename, e.Ename);
marks= e.marks;
} };
void main()
//statement I
{ - - - - - -//statement 2
}
2
Write the output for the following :
int a= 25; , b-:: 10
void trial (int &x, int z = 1O')
{
x¾= z;
z+ = 5;
·}
void 1nain ()
{ int a= 15, b= 12; $ \1'
trial (a, b); • '
"<<< e~dl·,
cout << :: a1,6< <. 11 ' ' )
trial (b, :: a); r • ' }
cout << :: a+2 <<" "<< b*3 << endl;
2
. ~,~~
~ .Consi_der a 1-D array consisting of the following numbers. 2
'S,i' 9, ~, f.'\The content of the array after the first iteration
res 1ts in 2 ,5 ,9, 6 ,4 . 1
A) Identity the sorting algorithm used. .W,
B) Sort the array using the identified algorithm and show the
contents after each iterations.
0 Write a complete C++ progrrun to count the number of lines
present in the text file "best.txt".
2
Ex:- if the content of "best.txt is
"just because it's hard;
doesn't mean; it's iinpossible.
you can do it."
Then the output of the program will be:
Total number of lines in the file are 3.
20 State purpose of the following file 1node 2
~
ios : : trunc 'ci-J{\ ~ •
ios: :nocreate
c) ios:: app . <A~tN
d) ios::ate ~,bi
21 Given is the truth table of a function (A, B, C). Write the 2
SOP and POS form (canonical) froin the truth table.
A B C F
0 0 0 0
0 0 1 1
0 1 0 1
.0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 l 0
. - -
1 1 1 0 l- .. ,_
22 What is a search engine? Name any two search engines.
23 Differentiate between Bus topology and Star topology.
(2 points).
Write short note on Optical Fibre Cable. 2
SECTIONC
25 Define a class Car with the fallowing specifications : 3
Data members :
private :
reg_no - integer
cartype- character array of size 20
rental - float type
public:
getdataO - function to accept the values for reg_no,
cartype and brand from the user.
calcQ-to calculate rental according to the following criteria.
cartype rental
SUV 3000
Sedan 2000
Hatchback 1000
.,....
I 3
1
26 Consider the following class declarations and answer the
followed questions:
I class Publisher
{
char.pub[20];
•l. !/
int turnover;
protected:
void register();
public: •
void enter();
void display(); _./
};
class Branch
{
char city[20];
protected:
l,
i
float employees; ·!
public: .
void haveit();
void giveit();
Ji
};
class Author : public Branch, p·rivate Publisher
{
int acode;
char aname[20];
j
~'..
float amount;
public: I
void start(); ~
};
void show();
I--~
a) Write the names of data members which are accessible
from the objects belonging to class Author.
I\1-~
b) What is the type of inheritance depicted in the above l
ij
exainple. • ·, ~=
c) Write the order in which the constructors are called, when ~
~
an object of Author is created.. lj
~
27 Evaluate the following postfix expressing using stacks; show 3
the contents of the stack after execution of each operation. j
.,l
5,4,3, * ,+,2,3, * ,2,/,- i
~-~~-
28 Write a procedural C++ program to swap the first column 3 i
elements with the last column element of the matrix of size
m *n without creating second matrix. ~
~
Sample input data for 2-D matrix. ~~ -1',,n I ~
.'
124
356
, -rf\ ~
~ I
~~\
-~~
-~)
~~~)
432 ~%
2 15
Expected Output:
~
r'
t~
;
42 1 i.
653
234
I
~
5 12 ~~
,.,
29 Simplify the following expression .)
A'B +BC'+BC +AB'C' and draw circuit diagram using
NAND gate only. ..
:,=~
4 •
~
1
30 Reduce the following Boolean Expression using K-Map. 3
F(A, B, C, D) == rr(0, 1, 2, 3, 4, 5, 10, 11, 15)
Also draw the logic circuit diagra1n for the simplified
expression using basic gates.
31. A) Write a user defined function named process() which will 3
accepts an one dimensional array of size N and sum as S
as parameters. It displays all the numbers which are
divisible either by 5 or 7.
Eg if the elemei:its in an array are 8,21, 4, 7,9 , 10, 1'5, 14
Expected output is : 21, 7, 10,15,14,
OR
B) Write user defined function process() which accepts an
one-dimensional array of size N as parameters, and
update the array in such a way that the if the element is
odd then 1nultiply it by 2, if it is even add 5 to it. y.
For eg : If the ele1nents in the array are
{2, 4, 1, 6, 7 }
Expected output:
{ 7, 9, 2, 11,.14}
32. A) Write a function void process (int n ), to check and 3
display the following pattern for n number of rows.
,A-v\"'> •
1,B C·
\DEF
vt-Q HI J
~K.LMNO
· OR
@rite a function void process ( int n) to generafe th~
following pattern for n number of rows.
• - V\· \
, .• bi ~
_.
Eg ifn = 5 \'
* * *
l * *
* *
* *
* I
'
I*
* ~
.I
SECTIOND l J
33. Declare an abstract class named "customer "which has the 4
following me1nbers:
,!(l\f,
cno: of type integer under private visibility label.
}~~
{ ::fol display(): a function under protected visibility label to
fj~ display data 1ne1nber "cno".
if Define a constructor to initialise the data 1nember "cno".
~.1':'
:il~
.;,i:,6
1
Derive a class na1ned "account" from class "customer" under
.:j;l';j
~: ···•
)Ii: public mode which has the following 1nembers:
..~~~
:.;,j~~.•~~ deposit: of type integer under private visibility label.
~r
1 ',,... intr: of type float under private visibility label.
,:.,:J
I ~.;
\ display(): a function under protected visibility label to
display the data n1embers intr and deposit.
Define constructor to initialize data 1ne1nber deposit and
set intr with co1nputed value as deposit*0.05*3.
.
·Derive a c1ass na
med "person" from class "account" under
public mode. · · ·b·1·
name: a character array of size 30 under private v1s1 1 1ty
label. • 'b·1· I b I
display(): a function under protected v1s1 1 1ty a e to \
display the data member name.
Define a constructor to initialise the data member name.
Write a relevant main progran1 to create object of class
"person" to initialize data members of all classes. Use the \
same object to display the data members of all classes.
34 Given the binary file "Student.dat" containing objects of the 4
following class declaration :
class Student
{
char stud~name[30];
char addr[30];
int age;
public :
void enter_details();
void display();
int check(char a[3 0])
{ I
~
if(strcmp(addr, a)==0)
else
return 1; I
~-
.~
return 0; ~
} ~
~--::
)-~
};
Write appropriate main function which will delete all the
records qf the student staying in "Porvoriin" or "Mapusa"
from the file "Student.dat" . I·~
OR ~1
~~~
Consider the class PAINTING as declared below.
class Painting
{
int Pitemno;
char Pname[30];
float price;
public:
'I
I.~
I~
~
II
I.
void buyitem();
void show() {
~1-
•II'
float getprice()
{ return price; }
}; -
Write appropriate main function to read the objects of
J
Painting.dat and copy all paintings items which are priced ~
between 15000 to 30000 to another binary file Gallery.dat fI
~
·.•. '~
35 Consider the following class declaration 4 ~
~ class Stack
{
struct Customer
{ "'~
int cust_no;
it
char cust_Name [20];
Cust~*next;
}*top;
6
'I~
~
•
public:
stack()
{ top = NULL; }
void push();
void show();
};
Write a function definition of push () which inserts a new
custo1ner in the stack.
Write function definition of show ( ) to display all customers
in the stack.
OR
Consider the following class declaration
class LIST
{
struct node
{
int age;
node * uext ;
t.
J
*START·'
public:
LIST () { START= N~L; }
void insert( ) ;
void display ( ) ;
t. .
J ,
Write the function definition for the me1nber function
insert() to insert a new node at any position in the linked list.
*****************************