Class Xii Computer Science (083) : General Instructions - (I) All Questions Are Compulsory (Ii) Programming Language: C++
Class Xii Computer Science (083) : General Instructions - (I) All Questions Are Compulsory (Ii) Programming Language: C++
2
1
(e)
2.
S[C]=S[L-C-1];
S[L-C-1]=T;
}
}
void main()
{
char Text[ ]="AISSCE 2014";
encode(Text);
cout<<Text<<endl;
}
(f) In the following program, if the value of Guess entered by the user is 65, what
will be the expected output(s) from the following options (i), (ii), (iii) and (iv)?
2
#include <iostream.h>
#include <stdlib.h>
void main()
{
int Guess;
randomize();
cin>>Guess;
for (int I=4;I>=1;I--)
{
New=Guess+random(I);
cout<<(char)New;
}
}
(i) ACBA
(ii) BBCA
(iii) CDBA
(iv) DABA
(a) What do you understand by Data Abstraction? How is it implemented in C++?
2
(b) Answer the questions (i) and (ii) after going through the following class:
2
class Game
{
int Duration;
public:
Game()
//Function 1
{
Duration=70; cout<<"Count Down begins"<<endl;
}
Game (intT) //Function2
{
Duration=T; cout<<" Count Down begins "<<endl;
}
~Game()
//Function 3
{
cout<<"Declare Winners"<<endl;
}
};
i) In Object Oriented Programming, what is Function 3 referred as and when does it get
invoked/called?
ii) In Object Oriented Programming, which concept is illustrated by Function 1 and
Function 2 together? Write an example illustrating the calls for these functions.
(c)Define a class book in C++ with the following descriptions :
4
private members :
3
book_Id
title
author
price
quantity
discount
caldisc()
long
String
String
float
Integer
float
A function to calculate and return discount amount as per the
following criteria.
Price
>=500
300-499
0-299
Discount
10%
5%
No discount
public members:
enter_book()
A function to input the data members book_Id, title, author, price, and
quantity and to invoke caldisc() to assign value to discount.
show_book()
To display the book details.
(d) Answer the questions (i) to (iv) based on the following:
4
class CUSTOMER
{
intCustno;
charCustName[20];
protected:
void Register();
public:
CUSTOMER();
void Status();
};
class SALESMAN
{
intSalesmanno;
charSalesmanName[20];
protected:
float Salary;
public:
SALESMAN();
void Enter();
void Show();
};
classSHOP : public CUSTOMER , private SALESMAN
{
charVoucherNo[10];
charSalesDate[8];
public:
SHOP();
voidSalesEntry();
voidSalesDetail();
};
(i) Write the names of data members which are accessible from objects belonging to class
CUSTOMER.
(ii) Write the names of all the member functions which are accessible from objects belonging to
class SALESMAN.
3.
4.
(iii) Write the names of all the members which are accessible from member functions of class
SHOP.
(iv) How many bytes will be required by an object belonging to class SHOP?
(a) Write a function in C++ which accepts an integer array and its No. of elements as
arguments and exchanges the values of first half side elements with the
second half side elements of the array.
3
Example:
If an array of eight elements has initial content as
1,2,3,4,5,6,7,8
The function should rearrange the array as
5,6,7,8,1,2,3,4 [if the no. of elements is odd middle element will remain unchanged]
(b) An array A[25][15] is stored in the memory along the column with each of its
elements occupying 4 bytes. Find out the base address and the address of an
element A[12][7], if the location A[10][10] is stored at the address 8000.
3
(c) Define the functions push() and pop() of the following class for implementing a dynamic
stack.
4
struct Node
{
intp,q;
Node *Link;
};
class Stack
{
Node *top;
public:
STACK() {top=NULL;}
void push();
void pop() ;
~Stack();
};
(d) Write a function in C++ to print the sum of all the values which are either divisible
by 3 or are divisible by 5 present in a two-dimensional array passed as argument
to the function.
2
(e) Evaluate the following postfix notation of expression:
2
10 20 + 25 15 - * 30 /
(a) Observe the program segment given below carefully and fill in the missing statements.
1
class Team
{ longTid;
charTName[20];
float Points;
public:
void accept();
void show();
voidPointchange();
longR_Tid(){return Tid;}};
voidReplacePoints( long Id)
{ fstream File;
File. Open(Team.DAT, ios::binary||ios::in||ios::out);
Team T;
int Record =0, found=0;
while(!found &&File.read((char*)&T, sizeof(Team)))
{ if(Id==T.R_Tid())
{
cout<<Enter new Points;
T.Pointchange();
5
--------------------- // statement 1 to position file pointer
--------------------- // statement 2 to write the object into the file.
found=1;
}
Record++;
}
if (found ==1)cout<<Record Updated;
File.close();
}
5.
(b) Write a program in C++ tocount the total occurrences of words he and she in a
text file story.txt. [Caseof the words to be ignored]
2
(c) Consider the following class declaration:
class Customer
{
charname[20];
charaddress[30];
char city[15];
charphoneno[15];
public:
void ledger();
voiddisp();
intcheckcity(char A[])
{
returnstrcmp(city, A);
}
};
Write a function COPYCITY() in C++ to search and copy only those records that have
city as Delhi from a binary file CUSTOMER.DAT to DELHIDATA.DAT.
(a) What do you understand by Candidate Keys in a table ? Give a suitable example.
(b) Consider the following tables SHOP and SUPPLIER and answer the following questions:
TABLE : SHOP
ICODE
1005
1003
1002
1006
1001
1004
1009
INAME
Note Book
Eraser
Pencil
Bag
Pen
Sharpener
Box
SCODE
13
12
12
11
13
12
11
QTY
120
80
300
70
250
100
50
RATE
24
5
10
300
20
10
80
BUYDATE
03-May-13
07-Aug-13
04-Mar-13
27-Dec-12
18-Jul-13
23-Jun-13
17-Dec-12
TABLE : SUPPLIER
SCODE SNAME
11
Arya Stationers
12
Stationery House
13
Sapna Stores
(b1) Write SQL commands for the following statements :
(i) To display details of all the items in the shop table in ascending order of
Buydate.
(ii)To display ICODE and INAME of the items with QTY more than 100.
(iii) To diplay the ICODE, INAME and TOTAL AMOUNT of each item ( TOTAL AMOUNT is the
product of QTY and RATE.
(iv) To display SCODE and Number of items supplied for each Supplier
6.
(c) Write thePOS form of a Boolean Function F, which is represented by the following
truth table:
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
2
2
F
1
0
0
1
0
0
1
1
1
1
1
1
NILA
PAMBA
PERIYAR
KABANI
7
Block
PERIYAR
NILA
PAMBA
KABANI
No of Computers
70
40
100
50
1
1
1
1
1
1