Revision Questions IP 09
Revision Questions IP 09
Unicode encoding standard provides the basis for processing, storage and interchange of text data in any language in all
modern software and information technology protocols.
GNU
MS-Office
BOSS
Windows OS
Ans
Q3 - Name the government organization that contributes to the growth of FOSS in India.
National Resource Centre for Free and Open Source Software (NRCFOSS) is the government organization that
contributes to the growth of FOSS in India.
Q4 - Read the given activities carefully and mention in front of the activity whether that activity is snooping or
eavesdropping
. Snooping.
ii. Eavesdropping.
iii. Eavesdropping.
iv. Snooping.
Q5 - Chanakya has to write a paragraph in English on Nobel laureates as a part of his holiday homework. He is using a
software in which he types the text in Hindi and the software automatically converts the text into English. For example, if
he types
software(s) ? Firefox
Perl
PHP
OpenOffice.org
spreadsheets, presentations,
graphics, databases
• REVISION QUESTIONS NETWORKING
1. The ‘Chalchitra’ theatre has a computer network. The network is in one building. (i) Name this type of network( out of
LAN/MAN/WAN). (ii) Name one communication channel that can be used for fast communication between workstations
of the network.
i.LAN
ii. Optical fiber cable (1 mark for each correct answer)
Star Topology
Two advantages are as follows:
1. Easy to install
2. Easy to diagnose the fault
(1 mark for identifying correct topology)
(½ mark for mentioning each correct advantage)
Draw a network layout of bus topology to connect 5 client computers and 1 server computer.
(½ mark for correct network topology and ½ mark for correct no of
computers)
Mr. John wants to prevent unauthorized access to/from his company's local area
network. Write the name of a system (software/ hardware), which he should install to do the same.
• URL (Uniform Resource Locator) is the complete address of a document on the web, whereas a domain name
specifies the location of document's web server.
• (1 mark for differentiating between URL and domain name ½ mark for correctly
Raj Kamal International School is planning to connect all computers, each spread over
distance within 45 meters. Suggest an economical cable type having high speed data
transfer, which can be used to connect these computers.
Raj Kamal International School is planning to connect all computers, each spread over
distance within 45 meters. Suggest a communication medium for very effective and high speed data transfer, which can
be used to connect these computers.
• Coaxial
• Optical Fibre
• A. an intelligent device that connects several nodes to form a network and redirects the received information
only to intended nodes.
• B. A device that regenerates (Amplifies the received signal) and re-transmits it to its destination.
• C. Anetwork device to connect two different networks together that work upon different networking models so
that the two networks can communicate properly.
• A- switch
• B- repeater
• C- Gateway
1. Denial of service attack: It is an attempt to make one or more network resources unavailable to their legitimate users.
2. Snooping:It is gaining unauthorised access to another person’s or organization’s data.
REVISION QUESTIONS Binary Files 08/11/2016
Q1- Write a definition for function ONOFFER( ) in C++ to read each object of a binary file TOYS.DAT, find and
display details of those toys, which has status as “ON OFFER”. Assume that the file TOYS.DAT is created with the
help of objects of class TOYS, which is defined below:
class TOYS
{
int TID;char Toy[20],Status[20]; float MRP;
public:
void Getinstock()
{
cin>>TID;gets(Toy);gets(Status);cin>>MRP;
}
void View()
{
cout<<TID<<”:”<<Toy<<”:”<<MRP<<””:”<<Status<<endl;
}
char *SeeOffer(){return Status; }
};
Steps to search a record of a BINARY FILE :-
Open file from which data is to be searched.
Read from file
Check comparisons
If matches
In Case of Structure:- display each element using structure variable with dot operator.
In Case of Class :- call to display function.
close file.
void ONOFFER()
{
TOYS T;
ifstream fin;
fin.open(“TOYS.DAT”, ios::binary);
if(!fin)
{ cout<<“Unable to open file “;
exit(0); }
else{
while(fin.read((char*)&T, sizeof(T)))
{ if(strcmp(T.SeeOffer(),”ON OFFER”)==0)
T.View(); }
}
fin.close(); //Ignore
}
Q2 - Write a definition for function Economic() in C++ to read each
record of a binary file ITEMS.DAT, find and display those items, which costs less than 2500. Assume that the file
ITEMS.DAT is created with the help of objects of class ITEMS, which is defined
below:
class ITEMS
{
int ID;char GIFT[20]; float Cost;
public :
void Get()
{
cin>>CODE;gets(GIFT);cin>>Cost;
}
void See()
{
cout<<ID<<":"<<GIFT<<":"<<Cost<<endl;
}
float GetCost() {return Cost;}.
};
void Economic()
{
ITEMS I;
ifstream fin(“ITEMS.DAT”,ios::binary);
if(!fin)
{ cout<<“Unable to open file “;
exit(0); }
else{
while (fin.read((char *)&I,sizeof(I)))
{ if(I.GetCost()<2500)
I.See(); }
}
fin.close();
}
(½ Mark for opening ITEMS.DAT correctly)
(1 Mark for reading all records from the file)
(1 Mark for checking value of Cost < 2500 )
(½ Mark for displaying the desired items)
Given a binary file SPORTS.DAT, containing records of the following
structure type :
struct Sports
{
char Event[20];
char Participant[10][30];
};
Write a function in C++ that would read contents from the file SPORTS.DAT and creates a file named
ATHLETIC.DAT copying only those records from SPORTS.DAT where the event name is “Athletics”.
Steps to modify a record of a BINARY FILE :-
1. Open file from which data is to be searched.
2. Read from file
4. Check comparisons
5. If matches
In Case of Structure:- take input for each element using structure variable with dot operator.
In Case of Class :- call to member function in which data members are accepted from user.
6. Put Pointer to one position back for updating the matched record.
7. Write record taken as input again in the same binary file.
void SP2AT()
{
fstream F1,F2;
Sports S;
F1.open(“SPORTS.DAT”,ios::binary|ios::in);
F2.open(“ATHLETIC.DAT”,ios::binary|ios::out);
if(!F1)
{ cout<<“Unable to open SPORTS.DAT“;
exit(0); }
else{
while(!F1.eof())
{ F1.read((char*) &S,sizeof(S));
if(!strcmp(S.Event,”Athletics”))
F2.write((char *)&S,sizeof(S)); }
}
F1.close();
F2.close();
}
(½ Mark for opening each file in the correct mode)
(½ Mark for reading the content from the file)
(½ Mark for the correct loop)
(½ Mark for the correct comparison with “Athletics”)
(½ Mark for writing the content to the second file)
void modify()
{
fstream F1;
Employee S;
F1.open(“SPORTS.DAT”,ios::binary|ios::in);
while(!F1.eof( ))
{
F1.read((char*) &S,sizeof(S));
if(S.get_salary( )=10000))
{ S.set_salary(20000);
F1.seekp(-1*sizeof(s),ios::cur);
F1.write((char *)&S,sizeof(S));}
}
F1.close();
}
(½ Mark for opening file in the correct mode)
(½ Mark for reading the content from the file)
(½ Mark for the correct comparison)
(½ Mark for the correct salary setting )
(½ Mark for the placing pointer to correct position)
(½ Mark for writing the content back to file)
Write a function in C++ to search for a camera from a binary file "CAMERA.DAT" containing the objects of class
CAMERA (as defined below). The user should enter the Model No and the function should search and display the
details of the camera.
Class CAMERA
{
long ModelNo;
float MegaPixel;
int Zoom;
char Details[120];
Public:
Void Enter() {cin>>ModelNo>>MegaPixel>>Zoom; gets(Details);}
Void Display() { Cout<<ModelNo<<MegaPixel<<Zoom<<Details<<endl;}
Long GEtModelNo() { return ModelNo;}
};
REVISION QUESTIONS 09/11/2016
Deleting data from a binary file
One temporary file need to be created to copy all those records which are not to be deleted.
Remove the original file and rename temporary file with original file.
Write a definition for function ONOFFER( ) in C++ to read each object of a binary file TOYS.DAT delete records
,which has status as “ON OFFER”. Assume that the file TOYS.DAT is created with the help of objects of class TOYS,
which is defined below:
class TOYS
{
int TID;char Toy[20],Status[20]; float MRP;
public:
void Getinstock()
{
cin>>TID;gets(Toy);gets(Status);cin>>MRP;
}
void View()
{
cout<<TID<<”:”<<Toy<<”:”<<MRP<<””:”<<Status<<endl;
}
char *SeeOffer(){return Status; } };
(CBSE 2016 OUTSIDE DELHI)
STEPS TO DELETE RECORD FROM A BINARY FILE :-
1. Open file from which data is to be deleted.
2.Open a temporary file .
for copying all those which are not to be
deleted.
3. Read from first file
4. do comparisons
5. write in to temporary file which are not to be deleted
6. close both files.
7. remove first file
8. rename temporary file with previous files name.
void ONOFFER()
{
TOYS T;
ifstream fin (“TOYS.DAT”, ios::binary);
ofstream fout(“temp.dat”,ios::binary);
if( !fin) { cout<<“\n TOYS.DAT could nor be opened”; exit(0) };
else { while(fin.read((char*)&T, sizeof(T)))
{ if(!strcmp(T.SeeOffer(),”ON OFFER”)==0)
fout.write((char*)&T, sizeof(T)) }
fin.close();
fout.close();
remove(“TOYS.DAT”);
rename(“temp.dat”,”Toys.dat”);
}
}
(1Mark for opening both files correctly)
(½ Mark for reading records from TOYS.DAT)
(½ Mark for comparison statement)
(½ Mark for writing data in temp file)
(1 Mark for removing and renaming files)
Following is the structure of each record in a data file named PRODUCT.DAT.
struct PRODUCT
{ char Product_Code[10] ; char Product_Description[10] ;
int Stock ;
};
Write a function in C++ to delete a record form the file for a particular value of Stock. The Stock , whose data is to
be deleted, is passed as argument to function.
(CBSE 2006 OUTSIDE DELHI)
void ONOFFER( int st)
{
PRODUCT T;
ifstream fin (“PRODUCT.DAT”, ios::binary);
ofstream fout(“temp.dat”,ios::binary);
if( !fin) { cout<<“\n PRODUCT.DAT could nor be opened”;
exit(0) };
else { while(fin.read((char*)&T, sizeof(T)))
{ if(T.Stock)!=st)
fout.write((char*)&T, sizeof(T)) }
fin.close();
fout.close();
remove(“PRODUCT.DAT”);
rename(“temp.dat”,” PRODUCT.dat”);
} }
(1Mark for opening both files correctly) (½ Mark for reading records from PRODUCT.DAT)
(½ Mark for comparison statement) (½ Mark for writing data in temp file)
(1 Mark for removing and renaming files)
Write a function in C++ to search for a camera from a binary file "CAMERA.DAT" containing the objects of class
CAMERA (as defined below). The user should enter the Model No and the function should search and delete camera
detail.
class CAMERA
{
long ModelNo;
float MegaPixel;
int Zoom;
char Details[120];
Public:
Void Enter() {cin>>ModelNo>>MegaPixel>>Zoom; gets(Details);}
Void Display() { Cout<<ModelNo<<MegaPixel<<Zoom<<Details<<endl;}
Long GEtModelNo() { return ModelNo;}
};