Kendriya Vidyalaya Sangathan, Chennai Region: Class Xii - Common Pre-Board Examination
Kendriya Vidyalaya Sangathan, Chennai Region: Class Xii - Common Pre-Board Examination
com
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
(d) Go through the C++ Code shown below & find the possible output from the suggested
output options (i) to (iv). 2
#include<iostream.h>
#include<stdlib.h>
void main( )
randomize( );
cout<<num<<: ;
point- - ;
#include<iostream.h>
a[k] += k;
else
a[k] *= k;
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
(k % 2 = = 0) ? cout<<a[k]<<% : cout<<a[k]<<endl;
void main( )
switch(h, 6, 3);
display(h, 6);
#include<iostream.h>
struct Package
int L, b, h;
};
void occupy(Package M)
Cout<<M.L<<x<<M.b<<x<<M.h<<endl;
void main( )
++B1.L;
occupy(B1);
B3 = B1;
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
++B3.b;
B3.b++;
occupy(B3);
B2 = B3;
B2.b += 50;
B2.h- -;
occupy(B2);
Q2(a) What is an object with reference to Encapsulation? State the different ways to assign
values to the data members of an object. 2
(b) Answer the questions (i) and (ii) after going through the following class Complex: 2
int img;
int real;
public:
Complex(); //function 1
~Complex(); //function 3
};
(ii) Name the function 1 and function 2 and expand the function 2.
Private members
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
Public members
A member function Print() to display Tno, Name, Distance, berth, Psngr and call calcFare()
to calculate the journey fare.
class ADDRESS
char Hno[10];
char City[15];
protected:
long Pincode;
public:
char phone[11];
ADDRESS();
void get();
void show();
};
class OFFICE
char Name[15];
char Manager[20];
char code[10];
public:
int totalEmp;
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
OFFICE();
void Input();
void Output();
};
1 2 0 0
1 2 3 0
1 2 3 4
(b) An Array A[5][5] is stored in the memory with each element occupying 4 Bytes of space.
Assume the Base Address of A to be 1000, compute the address of B[2][4], when the array is
stored: (i) Row Wise (ii) Column Wise. 3
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
(c) Write a function in C++ to delete an element from a dynamically allocated Stack of
Student implemented with the help of following structure: 4
struct Student
int Rollno;
char Name[20];
Student * Link;
};
(d) Write a function C++ which accepts 2D integer array & its size as arguments and
displays the elements which lies on the Diagonals 2
20 40 10
40 50 2
60 10 20
Output should be:
Diagonal 1: 20 50 20
Diagonal 2: 10 50 60
(e) Convert the following INFIX expression to equivalent POSTFIX expression. Show status
of Stack after every step of evaluation 2
A + B * (C D) / E
Q4 (a) Fill in the blanks marked as Statement 1 and statement 2 in the below code according
to the context: 1
#include <fstream.h>
class Customer
int Cno;
char Cname[20];
public:
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
int Countrec();
};
int Customer::Countrec()
fstream f;
f.open(Cust.dat,ios::binary|ios::in);
______________________ //Statement 1
f.close();
return count;
(b) Write a function in C++ to count number of words starting with amend in the text file
named as Amendment.txt 2
Eg:-
A contract to deliver something to a customer once a month can be amended if the customer
wants it delivered once a week. Usually, everyone involved in the contract must agree to the
amendment before it goes into effect. Most contracts are written with rules about
amendments
(c) Following is the class of each record in a data file named "Employee.dat": 3
class EMPLOYEE
int id;
char name[15];
char desg[10];
public:
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
void input();
void output();
};
Table: SENDER
Table: RECIPIENT
(ii) To display the RecID, SenderName, Senderaddress, RecName, RecAddress for every
Receipient.
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
(b) Write the POS Form of Boolean function G, which is represented in a Truth table as
follows: 1
A B C G
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0
(c) Draw the Equivalent Logic Circuit for the following Boolean Expression: 2
(U + V ).[W(U + V)]
(d) A Company is setting up its new campus at Pondicherry at 3 different locations as shown
in diagram & is having its cooperative unit in Mumbai: 4
10
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...
www.ncerthelp.com
Distances between various blocks(in metre) & Expected no. of computers in each block are
as follows:
(i) Suggest the kind of network required for connecting each of following units:
(a) Research lab & Back office (b) Research lab &Dev unit
(ii) Suggest the most suitable device to connect all the computers within each of their office
units:
(iii) Suggest an effective communication media to be used by the company for connecting
their local units in Pondicherry, out of following medias:
(iv) Suggesta cable layout of connections between the units. Also, suggest an effective
method/technology for connecting the companys office unit located in Mumbai.
11
Visit www.ncerthelp.com for Ncert Solutions in Text and Video , CBSE Sample papers, Exam tips,
NCERT BOOKS, Motivational Videos, Notes for All Classes and Many More...