You are on page 1of 6

S.S.MOTA SINGH SR. SEC.

MODEL SCHOOL
A-4C JANAKPURI, NEW DELHI – 110058
PREBOARD EXAMINATION (2018-19)
CLASS – XII COMPUTER SCIENCE (083)

Max Time : 3 hours Max Marks : 70


Instructions:
(1) All questions are compulsory.
(2) Programming Language is c++.

Q1. a) Write the type of C++ Tokens from the following: (2)
(1) delete (2) While (3) != (4) _abc:

b) Observe the following program very carefully and write the name of those header file(s), (1)
which are essentially needed to compile and execute the program successfully:
#include<iostream.h>
void main()
{
char a[20];
cin.getline(a,20);
for(int i=0;i<strlen(a);i++)
if(isupper(a[i]))
a[i]+=32;
cout<<a;
}

(c) Rewrite the following c++ code after removing any/all syntactical errors with each (2)
correction underlined.
#include<iostream.h>
#define float PI 3.14
void main( )
{
float R=5.5, H=2.5;
A=2*PI*R*H ;
A=A+ 2*PIpow(R,2);
cout<<‘Area=’<<A<<endl;
}

(d) Find output of the following program segments:

(1) K = PB[3] - PB[2] ; (3)


#include<iostream.h> cout<<++*(P+K)<<'&'<<endl;
#include<conio.h> cout<<K++ + *P++ << '&' ;
void main( ) cout<<*P++ <<'&'<< '\n' ;
{ for( ; K >=0 ; K -=2)
clrscr(); cout<<PB[K] << '&' ;
int PB[ ] = {16,13,10,15,24,16,17}; }
int *P = PB , K ;
cout<<++ *P++<<'&';

(2)#include<iostream.h> else (2)


#include<string.h> {
void Encode(char s[],int *p) s[i]='@';
{ int l=strlen(s); (*p)++;
for(int i=0;i<l;++i) } } }
{ void main()
if(s[i]>='A' && s[i]<='Z') {
{ s[i]+=33; ++*p; } char Word[]="PrEBoArD1819"; int n=0;
else if(s[i]>='a' && s[i]<='z') decode(Word,&n);
s[i]=s[i+1]; cout<<Word<<'#'<<n<<endl;}

-1-
(e) Look at the following c++ code and choose the option(s) which are not possible as output from (1+1
option (1) to option (4) specifying the reason. Also write the maximum and minimum value of )
variable p during complete execution of the program.

#include<iostream.h> while(a1<a2)
#include<conio.h> {
#include<stdlib.h> p=random(N)+(a2-a1);
void main() cout<<p<<"#";
{ a1++;
clrscr(); }
const int N=5; getch();
randomize(); }
int a1=1,a2=5,p;

(1) 5#6#6#6# (2) 7#5#3#1# (3) 8#6#1#2# (4) 4#7#5#3#

Q2. (a) Differentiate between a copy constructor and a parameterized constructor giving suitable (2)
example? (or)
Can a copy constructor accept an object of the same class as a value parameter instead of
reference parameter? Explain giving proper reason?

(b)class PLANTS protected: (4)


{ int end_species;
char features[20]; long xylem;
int nospecies; void chk_feature();
protected: public:
void getSpecies(); VASCULAR_PLANTS();
public: void EnterData();
PLANTS(); void DispData();
char bname[50]; };
void Entry(); class ANGIOSPERMS : public PLANTS, VAS_PLANTS
void Disp(); {
}; char species [25];
class VAS_PLANTS
{ public:
char characteristics[30]; void getData();
int ext_species; void showData();
};

(1) Which type of Inheritance is illustrated in the given code also specify the order of execution
of constructors, when an object of ANGIOSPERMS class is declared?
(2) How much of memory space will be occupied by the object of class VAS_PLANTS &
ANGIOSPERMS.
(3) Name the members accessible by the objects of class ANGIOSPERMS?
(4) Name the data members accessible to the function getData() & showData().

(c) Define a class IT_CLUB in C++ with following description: (4)


Private Members
 Sno of type int, Name of type string, Activity of type string, Section of type string,
Charges of type float
 A member function Ass_Sec_Charge( ) to assign the suitable section and charges according
to the activity as follows :
Activity Section Charges
Coding Programmer’s Paradise 500
Designing Designer’s Den 900
Robotics Robotics Refuge 1000

Public Members
 A function SignIn ( ) to allow users to enter values for Sno,Name,Activity and call
function Ass_Sec_Charge( ) to assign suitable Section and charges.
 A function List () to allow users to view the details of all the data members
-2-
(d) Consider the following program code and answer the questions given below: (3)

#include<iostream.h> void abc::disp (int N)


#include<conio.h> {
class abc for (int I=1 ; I<=N ; I++)
{ cout<<ch ;
int n; cout<<endl ;
char ch; }
public: void abc::disp (int A, int B)
abc() //f1 {
{ for (int I=1;I<=B ;I++)
n=10; cout <<(char) (A+I);
ch='@'; cout<<endl ;
} }
abc(int a, char b='*') //f2 void abc::disp (char T,int N)
{ {
n=a; for (int I=1 ; I<=N ; I++)
ch=b; cout<<T++ ;
} cout<<endl;
void disp(); //f3 }
void disp(int); //f4 void main ( )
void disp(int,int); //f5 {
void disp(char,int); //f6 clrscr();
}; abc A1, A2(12,'$'), A3(30);
A1.disp() ;
void abc::disp ( ) A2.disp(5) ;
{ A3.disp(97,10);
for (int I=1 ; I<=n ; I++) A3.disp('A',5);
cout<< ch; }
cout<<endl;
}

(1) Name the OOPS feature implemented by functions f3,f4,f5 & f6 and also name the function f1
& f2.
(2) Give the output of the above code.

Q3. (a) WAF which requires a two dimensional numeric array of dimension m X n to be passed as (2)
parameters and function display sum of both left and right diagonals separately along with
the diagonal elements.

(b) WAF which requires an array of n students to be passed as a parameter and arranges the array (2)
elements in descending order of percentage. Student is defined as follows :
struct student { int examno; char name[50]; float percentage; };

(c) An array ARR[10][30] is stored in the memory along the column with each element requiring 4 (3)
bytes of storage. Find out memory location of ARR[5][7], if ARR[2][15] is stored at location 8200.
or
An array ARR[30][10] is stored in the memory along the row with each element requiring 8 bytes
of storage. Find out memory location of ARR[12][8], if ARR[5][6] is stored at location 4500.

(d) Observe the following program segment and answer the question given below: (3)
struct LIST
{ char name[30]; LIST *next;
};
class stack
{ LIST *top;
public:
stack()
{ TOP = NULL;}
void PUSH(char * ); void POP(); };
Write complete definition of the function PUSH() & POP() of the above class stack.

-3-
(e) Complete the definition of Insert() the following given class:- (2)
class circularQ
{ int queuet[100]; int f,r;
public :
circularQ( ) {f=r=0; }
void Insert(int);
int Delete();
};

(f) Evaluate the following postfix expression also show the stack status after every operation- (1)
T,F,AND,NOT,T,F,OR,AND

(g) Convert the following Infix expression to its postfix form, also show the stack status along: (1)
A/(B + D - E) / F * G

Q4. (a) A binary file “CLIENTS.DAT” contains data of 20 clients where each client data is an object of (1)
the following class:
class client
{ long ccode;char cname[30];
public:
void EnterData() {cin>>ccode; cin.getline(cname,30);
void ShowData() {cout<<ccode<<” - ”<<cname<<endl;}
};
With reference to this information, write output of the following
program segment:
void main()
{
fstream File; client C;
File.open(“CLIENTS.DAT”,ios::binary|ios::in);
File.seekg(3*sizeof(C));
File.read((char*)&C, sizeof(C));
cout<<”\nClient Number:”<<File.tellg()/sizeof(C)+1;
File.close();
}

(b) Consider the following class declaration: (3)


class product
{ int pno;char pname[20];char pcat[20], float pprice;int pstock;
public:
void input() {cin>>pno>>pname>>pcat>>pprice>>pqty;}
void display()
{cout<<pno<<” “<<pname<<” “<<pcat<<” “<<pprice<<” “<<pstock;}
void updateqty(int q)
{ pstock+=q; }
char *getpcat(){ return(pcat); }
};
The file “product.dat” stores the details of products. Write a function in C++ to increase the
stock of the products for the given category by the given quantity.

(c) Write a function disprev() which reads the contents of a text file “ABC.TXT” and display all
those words in reverse order , which starts with a given alphabet (irrespective of the alphabet
case) and other words are displayed as it is. (2)
Or
WAF to AlphaFreq() which reads the contents of a text file “ABC.TXT” and displays all alphabets
present in file along with the frequency count.
For Example if file contains My address is A4C Janakpuri. Then output should be
ALPHABET FREQUENCY
A 3
C 1
-- ---

-4-
Q5. (a) Differentiate between DDL & DML commands. Identify DDL & DML commands from the (2)
following :- (UPDATE, INSERT, CREATE, DROP, ALTER, SELECT)
or
Differentiate between Primary key and Candidate key giving suitable example.

Consider the following tables STOCK and ORDERS :


TABLE:STOCK
DVD_ID DVD_NAME CATEGORY Qty PRICE ARRIVAL_DATE
D101 Sunny Day Motivational 3 500 2015-09-16
D102 Maths for Children Educational 2 350 2012-11-25
D103 Titanic Entertainment 4 400 2011-12-19
D104 Sholay Entertainment 2 450 2011-09-15

TABLE: ORDERS
CUST_ID CUST_NAME DVD_ID PHONE_NO
1 Rohan Sharma D102 9963214578
2 AlkaVerma D104 9845123265
3 Vaibhav Sharma D102 9641235875
4 Saumya D103 9711665765
5 Samarth D104 9654299234

(b) Write SQL commands for the following statements: (5)

1. To display DVD_ID and DVD_NAME of DVD’s of Motivational or Educational category in


descending order of their price.
2. To display customer name and corresponding DVD name, quantity and price.
3. To increase the price of those DVD’s by 50 whose quantity is less than 3.
4. To display the details of all DVD’s which are arrived in stock after ‘2012-12-31’ having price
between 400 and 500.
5. To display category wise number of dvds along with the average price.

(c) Give the output of the following SQL commands: (1)

(1) SELECT CUST_NAME, PHONE_NO from ORDERS where CUST_NAME like “S%”
(2) SELECT CUST_NAME,DVD_NAME FROM STOCK S, ORDERS O WHERE S.DVD_ID=O.DVD_ID

Q6. a) Obtain the Boolean Expression for the logic circuit shown below: (1)

(b) Draw the logic diagram for the Boolean expression X’.(Y+Z)’ using basic logic gates. (1)
(c) Give a canonical SOP expression for the F(X,Y,Z)= π (2,3,5,7) (1)
(d) State the De Morgan’s law and prove it algebraically. (2)
(e) Find the simplified expression for the following Boolean function using Karnaugh’s map: (3)
F(A, B, C, D) = π(0,1,2,3,4,5,8,10,11,14)

Q7. a) Write full form of CDMA and VOIP? (1)


b) Daniel has to share the data among various computers of his two offices branches (1)
situated in the same city. Name the network specifying reason (out of LAN, WAN, PAN and
MAN) which is being formed in this process. ?
c) Differentiate guided and unguided medium of communication giving example each. (1)
(1)
-5-
d) What is Denial of service in internet technology? (1)
e) What are the spam mails? What can be done to prevent getting unwanted mails. (1)
f) What is data Encryption? What is its use?

(g) Riana Medicos Center has set up its new center in Dubai. It has four buildings as shown in the (4)
diagram given below:

Research
Accounts Lab

Store Packaging
Unit

Distances between various buildings are as follows


Accounts to Research Lab 55 m
Accounts to Store 150 m
Store to Packaging Unit 160 m
Packaging Unit to Research Lab 60 m
Accounts to Packaging Unit 125 m
Store to Research Lab 180 m

Number of Computers
Accounts 25
Research Lab 100
Store 15
Packaging Unit 60

i) Suggest the best wired medium and draw the cable layout of efficiently connect various
buildings of Riana Medicos Center.
ii) Suggest the most suitable place (i.e. buildings) to house the server of this organization.
iii)Suggest a device and the protocol that shall be needed to provide wireless internet access to
all Smartphone/laptop users in Riana Medicos Center.
iv)Suggest a device/software and its placement that would provide data security for the entire
network of the school.

-6-

You might also like