Beruflich Dokumente
Kultur Dokumente
Public Members
v. A function SCHEDULE( ) to allow user to enter values for TestCode, Description, NoCandidate &
call function CALCNTR( ) to calculate the number of centres.
vi. A function DISPTEST ( ) to allow user to view the content of all the data members.
Assume that a text file named TEXT1.TXT already contains some text written into it, write a function named
vowelwords( ), that reads the file TEXT1.TXT and create a new file named TEXT2.TXT, which shall contain only
those words from the file TEXT1.TXT which don’t start with an uppercase vowel(i.e ‘A’,’E’,’I’,’O’,’U’).
For example if the file TEXT1.TXT contains
Carry Umbrella and Overcoat When it Rains
then the file TEXT2.TXT shall contains
Carry When it Rains
Given a binary file APPLY.DAT, containing records of the following class Applicant type
class Applicant
{
char A_Rno[10];
char A_Name[30];
int A_Score;
public:
void Enrol( )
{
gets(A_Rno);
gets(A_Name);
cin>>A_Score;
}
void Status( )
{
cout<<setw(20)<<A_Rno;
cout<<setw(20)<<A_Name;
cout<<setw(10)<<A_Score<<endl;
}
int ReturnScore( )
{ return A_Score;}
};
Write a function in C++, that would read contents of file APPLY.DAT and display Students whose A_Score is below
70.
14. Write the major differences between Object Oriented Programming and Procedural Programming
15. Name the header file to which the following belong:
i. gotoxy()
ii. srand()
16. List the characteristics of constructor and destructors?
17. Define a class Shop in C++ with the description given below :
private members
name array of 40 characters
address array of 40 characters
type of item array of 3X20 characters
availqty array of 3 integers
totalqty array of 3 integers
public members
init() function to ask and store the values of address ,type of items , availqty & totalqty.
purchase() function to ask the qty purchased and type of item from the user and updates the totalqty and
avialqty accordingly .
for example: if the type of items available in the shop are : “Cosmetic” , ”Food Products” , ”Medicines” . And
the shop keeper purchases the “Cosmetic” item then updates the availqty and totalqty of the “Cosmetic”
item.
display() function to display the details of the item in the following format :
Name : <SHOP NAME >
Address : < ADDRESS >
Items :< Type of Item 1> <Type of Item 2> <Type Of item 3>
Balance Stock :< avialqty> <availqty> <avialqty>
18. Answer the questions (i) to (IV) based on the following code:
class CUSTOMER
{
int cust_no;
char cust_name[20];
protected:
void Register( );
public:
CUSTOMER( );
void status( );
};
class SALESMAN
{
int salesman_no;
char salesman_name[20];
protected:
float salary;
public:
SALESMAN( );
void enter( );
void show( );
};
class SHOP: public CUSTOMER, protected SALESMAN
{
char voucher_no[10];
char sales_date[8];
public:
SHOP( );
void sales_entry( );
void sales_detail( );
};
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.
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?
19. Observe the program segment given below carefully and fill in the blanks marked as statment1 and
statement2 using write() and remove() functions for performing the required task.
#include<fstream.h>
class Emp
{
int Eno;
char name[20];
public :
//function which will delete the data of a specific employee
void deleteRec(int Eid);
};
void Emp::deleteRec(int Eid)
{
fstream file;
file.open(“Emp.dat”,ios::in|ios::out|ios::binary);
ofstream ofile(“temp.dat”);
while(file)
{
file.read((char *)this,sizeof(eobj));
if(this->Eno !=Eid)
_________________//statement1
}
________________//statement 2
rename(“temp.dat”,”emp.dat”);
}
20. Write a function to reverse only those lines ends with vowel character from a text file poem.txt.
21. Write a function in C++ to update the SUPPLIER NAME for a given SNO from a binary file “SUPP.DAT”,
assuming the binary file is contained the objects of the following class:
class SUPPLIER
{
int SNO;
char SUPP_NAME [20];
public:
int SUPPNO ( ) { return SNO; }
void Enter ( ) { cin >> SNO; gets (SUPP_NAME); }
void Display ( ) { cout << SNO <<SUPP_NAME ; }
};
22. What is the difference between Global Variable and Local Variable? Also, give a suitable C++ code to
illustrate both.
23. What do you understand by Data Encapsulation and Data Hiding? Also, give a suitable C++ code to
illustrate both.
Distance Fuel
<=1000 500
more than 1000 and <=2000 1100
more than 2000 2200
class CUSTOMER
{
int Cust_no;
char Cust_Name[20];
protected:
void Register();
public:
CUSTOMER();
void Status();
};
class SALESMAN
{
int Salesman_no;
char Salesman_Name[20];
protected:
float Salary;
public:
SALESMAN();
void Enter();
void Show();
};
class SHOP : private CUSTOMER , public SALESMAN
{
char Voucher_No[10];
char Sales_Date[8];
public:
SHOP();
void Sales_Entry();
void Sales_Detail();
};
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.
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?
Write a function in C++ to count the number of lines present in a text file "STORY.TXT".
Given a binary file PHONE.DAT, containing records of the following structure type.
class Phonlist
{
char Name[20] ;
char Address[30] ;
char AreaCode[5] ;
char phoneNo[15] ;
public :
void Register();
void show();
int CheckCode(char AC[ ])
{
return strcmp(Areacode, AC) ;
}
};
Write a function TRANSFER () in C++, that would copy all those records which are having AreaCode as
“DEL” from PHONE.DAT to PHONBACK.DAT.
34.
AssignAccess( ) Generates random numbers between 10 and 99 and return it.
Public Members
o A function INTAKE( ) to allow the user to enter the values of Food_Name,
Calories, Food_type, cost and call function AssignAccess( ) to assign Access_no.
o A function OUTPUT( ) to allow user to view the content of all the data members, if the Food_type
is Fruit.Otherwise display message, “Display only for fruit”
Write a function that reads binary file CONSUMER.DAT containing records of above class, and copy those
records to CONSUMERAREA.DAT , whose area is same as given by user. Also, display the number of
such records found.
If extra_time<=10, penalty=1
If extra_time>10 but <=20 penalty=2, otherwise, penalty=5
Public members:
o A fuinction Extradata () to allow user to enter values for target_score, over_bowled, Extra_time.
o A function DspData( ) to allow user to view the contents of all data members.
Write a function in C++ which accepts a 2D array of integers and its size as arguments and display the elements
which lie on diagonals.
[Assuming the 2D array to be a square matrix with odd dimension, i.e., 3x3, 5x5, etc..]
Example, if the array contents is
5 4 3
6 7 8
1 2 9
Output through the function should be :
Diagonal One : 5 7 9
Diagonal Two: 3 7 1
An array Arr[15][20] is stored in the memory along the row with each element occupying 4 bytes. Find out the Base
Address and address of the element Arr[3][2], if the element [5][2] is stored at the address 1500.
Give the necessary declaration of queue containing integer. Write a user defined function in C++ to delete an integer
from the queue. The queue is to be implemented as a linked list
Write a function in C++ to print the sum of all the values which are either divisible by 2 or are divisible by 3 present in
a two-dimensional array passed as the argument to the function.
Evaluate the following postfix notation of expression:
o 0 + 25 15 - * 30 /
Write a function in C++ to count the number of alphabets present in a textfile “Para.Txt”.
Write a function in C++ to add new objects at the bottom of a binary file “Student.Dat”, assuming the binary file is
containing the object of the following class
class STUD
{
int Rno;
char Name[20];
public:
void Enter ()
{
cin>>Rno;
gets(Name);
}
void Display()
{
cout<<Rno<<Name<<endl;
}};
What do you mean by static variable? Explain with help of example.
Write the header files to which the following functions belong:
. getc ( )
i. isalnum ( )
ii. scanf ( )
iii. getxy ( )
How member functions and non member functions differ?
The function should create another file OUT.TXT with the text
I like ice cream.
57. Write a function in C++ to transfer a particular type of stock from the file “inventory.dat” to another file
“backinvent.dat”. Assuming that the binary file is containing the records of following structure :
struct Products
{
int id;
char Iname[30];
int type;
};
Remember that transfer means deletion from the “inventory.dat” file and addition in the “backinvent.dat” file.
DBMS :-
Table : CLUB
Table: INTERIORS
Table: NEWONES
No ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1. To show all information about the Sofa from the INTERIORS table.
2. To list the ITEMNAME which are priced at more than 10000 from the INTERIORS table?
3. To list ITEMNAME and type of those items, in which DATEOFSTOCK is before 22/01/02
from INTERIORS table in descending order of ITEMNAME.
4. To display ITEMNAME and DATEOFSTOCK of those items, in which the DISCOUNT percentage is more
than 15 from INTERIORStable.
5. To count the number of items, whose TYPE is “Double Bed” from INTERIORS table?
6. To insert a new row in the NEWONES table with the following data:
58.
a) Define
i. Cardinality
ii. Candidate Key
b) Consider the following tables GAMES- storing the details of games and PLAYER –storing the details of players
who have enrolled their names for the scheduled games. Write SQL commands for the statements (i) to (iv) and give
outputs for SQL queries (v) to (vi)
Table: GAMES
Table: PLAYER
13 Jatin 101
14 Nazneen 103
i. To display name of those games whose PrizeMoney is in the range 10000 to 30000 and No_Players above
ii. To display the details of games whose GameName starts with ‘C’ in ascending order of ScheduleDate.
iii. To display count of players enrolled for each game.
iv. Display each PCode, PlayerName and the GameName for which they have enrolled.
v. SELECT SUM(PrizeMoney) FROM GAMES;
vi. SELECT COUNT(DISTINCT GCode) FROM PLAYER;
59.
Table: STORES
Table: SUPPLIERS
Scode Sname
21 Premium Stationary
23 Soft Plastics
22 Tetra Supply
i. Display a report containing cust_id, cust_name, Item,qty,price and bill amount. Bill
amount is calculated as the sum of qty*price
ii. Display how many customers have ordered Pizza in the month of March.
iii. Count the number of customer who have ordered item worth more than 1700. Total amount = sum of qty*
price
iv. Display the name of customer along with their city in alphabetical order of city
v. select Cust_name , City, ord_date from Client A, Bill b Where A.Cust_id =b.Cust_id;
vi. select Cust_name from Client where Cust_id=( Select Cust_id from Bill where Year(ord_date) =2008)
vii. select count(*) from Client group by City;
viii. select Distinct (Item) from Bill;
60.
BOOKS ISSUED
Book_Id Quantity_Issued
T01 4
C01 5
F01 2
C01 6
T02 3
BOOLEAN ALGEBRA
c. Write the canonical P-O-S expression for the following S-O-P expression
F(a,b,c) = ∑(1,2,5,6)
d. Reduce the following expression using K-map and draw the circuit only using NOR gate F(a,b,c,d) =
п(0,1,2,4,5,6,8,9,10,14)
61.
A B C F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
62.
c. Convert the following Boolean expression into its equivalent Canonical Product of Sum Form(POS)
A.B’.C+A’.B.C+A’.B.C’
d. Reduce the following Boolean Expression using K-Map:
F(P,Q,R,S)=∑(0,3,5,6,7,11,12,15)
63.
64.
65.
d.
e. Reduce the following Boolean expression using K-Map:
F(P,Q,R,S)=∏ (0,3,5,6,7,11,12,15)