cs notes1
cs notes1
5. Name the stream classes supported by C++ for file input and output.
Classes Meanings
ifstream It is a stream class to read from files. It provides input operations for file. It inherits get(
),getline( ),read( ) ,seekg( ) and tellg( ) functions from istream class
ofstream It is a stream class to write on files. It provides output operations for file. It inherits put(
),write( ), seekp( ) and tellp( ) functions from ostream class.
fstream It is stream class to both read and write from/to files. It provides support for simultaneous
input and output operations. It inherits all the functions from istream and ostream classes.
a) Opening a file for ouput purpose only using an b) Opening a file for input purpose only using an
object of ofstream class and open() member function. object of ifstream class and open( ) member
function
Syntax: Syntax:
ofstream_object.open(“file_name”); ifstream_object.open(“file_name”);
Example: Example:
ofstream fp; ifstream fp;
fp.open(“student.dat”); fp.open(“book.dat”);
4.
Differentiate between ifstream class and ofstream class
ifstream ofstream
1.It is a stream class to read from files 1.It is a stream class to write on files
2.This class supports input operations 2.This class supports output operations
3.It contains open( ) with default input mode 3.It contains open( ) with default output mode
4.It inherits get( ),getline( ),read( ),seekg( ) and 4. It inherits put(),write(),seekp() and tellp()
tellg( ) functions from istream function from ostream
5.Example: ifstream fb; fb.open(“text.dat”); 5.Example: ofstream fb; fb.open(“text.dat”);
Web Server is used to store the web connectivity software and the business logic.
These are part of application used to access the right amount of data from the data base
server.
This layer acts like a medium for sending partially processed data between the database
server and the client.
4. Explain Radom/direct file organization.
Direct access file organization allows immediate direct access to individual records on
the file.
Here the records are stored in memory based on the address generated by the “hashing
algorithm” H(key field)=address, This algorithm also takes care of conflict which may
arise when 2 or more key field are mapped to the same address.
This type of organization also allows the file to access sequentially.
5. Write the different symbols used in E-R diagram with their significance.
The different notations or symbols for E-R diagram are
Hierarchical data model: This data Model organizes the data in a tree like structure. All the
nodes are linked to each other with a definite hierarchy. This model represents the nodes as
one-to-one and one-to many relationships.
Advantages:
This model is easy to design and simple.
The data access is quite predictable in the structure.
Process of retrieval and updates are optimized.
Network data model: This data model organizes the data in the form of graph. All the nodes
are linked to each other without any hierarchy. It is a powerful model, but database design is
complicated. This model has many-to-many relationships on data. It has one parent node and
many child nodes known as dependants; hence the data access is easier.
CHAPTER 14
SQL
1) SYNTAX AND EXAMPLE FOR CREATE COMMAND.
This command is used to create a new table
SYNTAX:
CREATE TABLE tablename( column1 datatype, column2 datatype, column3 datatype,
....
);
EXAMPLE:
CREATE TABLE STUDENT
(
Regnum number(6),
Name varchar(25),
Combination char(5),
Dob date,
Fees number(4,2),
);
EXAMPLE:
Alter table student add (addressvarchar(30));
Alter table student modify (addressvarchar(35));
Alter table student delete (address);
SYNTAX:
DROP TABLE table_name;
EXAMPLE:
DROP TABLE Shippers;
EXAMPLE:
a) To delete all the records whose fees is less than 15,000.
DELETE FROM Student WHERE fees < 15000;
b) To delete all the records.
DELETE FROM Student;
EXAMPLE:
//to insert data only for selected columns
INSERT into Student (Regnum, Name, Combination) values (123, ‘John’, ‘ceba’);
EXAMPLES:
a) SELECT Regnum, fees FROM Student;
b) SELECT * FROM Student;
c) SELECT Regnum, Name FROM Student WHERE totalmarks> 500;
This command gives list of names and combination in sorted order of names
(ascending order).
SYNTAX OF GROUP BY:
SELECT col1, col2, … FROM tablename WHERE condition GROUP BY col1,
col2, .. ; EXAMPLE:
SELECT Name, Combination FROM Student GROUP BY Combination;
COUNT (): This function returns the number of rows(records) in the table that satisfies
the condition specified in the WHERE condition. If the WHERE condition is not specified, then
the query returns the total number of rows present in the table.
Example:
MAX(): This function is used to get the maximum value from a column.
Example:
SELECT MAX (salary) FROM employee;
MIN(): This function is used to get the minimum value from a column.
Example:
be: SELECT MIN (salary) FROM employee;
AVG(): This function is used to get the average value of a numeric column.
Example:
SELECT AVG (salary) FROM employee;
c) BETWEEN OPEARTOR: The BETWEEN operator tests an expression against a range. The
range consists of a beginning expression, followed by an AND keyword and an end expression.
EXAMPLE:
SELECT Regnum, Marks FROM Student WHERE Marks BETWEEN
550 AND 600; //this command gives the list of students whose marks
are between 550 and 600.
b) AND OPEARTOR:
EXAMPLE:
SELECT Regnum, Combination, Marks FROM Student WHERE Combination = ‘PCMB’
AND
Marks>500;
//this command gives the list of students whose combination is PCMB and marks
are more than 500.
SELECT Regnum, Combination FROM Student WHERE Combination IN (‘PCMB’,
‘CEBA’); //this command gives only those records that match with combination
PCMB and CEBA.
e) OR
OPEARTOR:
EXAMPLE:
SELECT Regnum, Combination FROM Student WHERE Combination = ‘PCMB’ OR
Combination=
‘HEBA’;
//this command gives the list of students whose combination is either
PCMB or HEBA.
f) IS NULL OPEARTOR:
EXAMPLE:
SELECT Regnum, Fees FROM Student WHERE Fees IS NULL;
//this command gives the list of students whose fees field is left blank.
LAN:
Circuit Switching:
physical connection between sender and receiver is established in an unbroken path and then
data is transmitted from the source to destination
E.g: In telephone system, a complete path (end to end) must exist before communication
can take place
Message Switching (Store and forward):
there is no dedicated path is established between the sender and receiver. But the sender
appends a “destination address” to the data.
E.g: Telex forwarding
Packet Switching:
data is broken into distinct, addressed, fixed size parts called as packets, that can be transferred
separately via different paths. Each packet contains the address of sender, address of
destination, sequence number and some data. Finally, at the receiver end, packets are reordered
by sequence number and the original message is reconstructed.
1. Star Topology
In this type of topology, all the computers are connected to a single hub or a switch through a
cable. This hub is the central node and all others nodes are connected to the central node.
Advantages of a Star Topology
It is able to replicate.
It requires a host program as a carrier.
It is activated by external action.\
Its replication ability is limited to the system it entered.
Chat:
Exchange of typed in message by several people who are using the internet at the same time as
you are. In telephonic conversations, you say something, people hear it and respond, and you
hear their responses on the spot and can reply instantly.
Video Conferencing:
A two-way videophone conversation among multiple participations is called Video
Conferencing.
Wi-fi:
Wi-Fi is short for Wireless Fidelity, which lets you connect to the internet without a
direct line from your PC to the ISP. For Wi-Fi to work, you need:
Voice mail:
It is a method of storing voice message electronically for later retrieval by the intended
recipients.
CHAPTER 16
INTERNET AND OPEN SOURCE CONCEPTS
1.What is Open Source Software?
Open Source Software is a software which can be freely used but it does not have to
be free of charge
2. Define E-Commerce.
E-commerce is the trade of goods and services with the help of telecommunication
and computers.
3. Write any 2 Web browsers.
Internet
Explorer
Netscape
Navigato
r.
4. What is Web server?
Web Server is a WWW server that responds to the requests made by web browsers. Each website has a
unique address called URL (Uniform Resource Locator). ( or )
Web server is an internet host computer that may store thousands of websites. It responds to the
requests made by the web browsers. 5. Define Freeware
Freeware is a software which is available free of cost and which allows copying and further distribution,
but not modification and whose source code is not available.
7.What is HTTP?
Hyper Text Transfer Protocol is a network protocol used to send the message from source to destination.
8.What is web browser?
It is a software that enables the user to navigate through the www, to view webpage and move from one
website to another website.
8.What is WWW?
It is a “set of protocols” that allow users to access any document on the internet through the naming
system based on URL.
Global participation.
Optimization of resources.
Improved market intelligence and strategic planning.
Buyer makes a buying decision, create the purchase order but does not print it.
Reduced time to complete business transaction, particularly from delivery to payment.
Type://address/path OR protocol://host/location
Where type: specifies the type of the server in which the file is located, address is the address of server,
path tells the location of file on the server.
http://encycle.msn.com/getinfo/styles.asp
Limitations:
6. Define E-commerce. Write the various technologies and services used in E-commerce.
E-commerce is the trade of goods and services with the help of telecommunication and computers.
(ii). Dynamic Websites: Dynamic websites contain information that changes, depending on the
time of day, the viewer and other factors.
Step 2: Choose Your Hosting
Server Basically, two types of
hosting platforms Linux
Hosting, Windows Hosting.
Step 3: Select Your Web Hosting Plan