You are on page 1of 50

COMPUTER

APPLICATION 2008 - 09
S I
Study
..by Mr. P.H.Prasad Materia
l
COMPUTER APPLICATIONS - ID YEAR
BBM SECON

GANDIKOTA BUSINESS SCHOOL


PRINCIPLES OF MANAGEMENT
MODEL PAPER - I
Time : Three hours Maximum : 70 marks
Answer the following questions

1. Answer the following questions . Each question 10 lines compulsory.


a. Central Processing Unit :
The heart of the computer is called CPU processor. The CPU performs :
(a) Arithmetic operations (add, subtract, multiply , divide )
(b) Logical operations (logical expressions)
(c) Input – output operations (accepting data to be processed generating
the output or results of processing )
(d) Internal data movement (moving data between various parts of
storage)
(e) Data manipulation (accepting data , sorting it, processing it , generating
required information )
To perform these various operations the CPU has various components.
1. Arithmetic – logic unit (ALU)
2. Control Unit (CU)
3. Memory Unit
The Arithmetic Logic Unit performs the actual calculations like additions , subtraction ,
multiplication and , division and comparisons like greater than, lesser than, equal to ,
positive , negative, zero.
The Control Unit coordinates the operations of the hardware. It also coordinates the flow
and execution of data and instructions that are fed into the memory or main storage via
the CPU. The Control Unit functions in a fetch-execute cycle. It fetches the instructions
and data from the memory unit , decodes them and sends them to the Arithmetic logic
unit (ALU). The output from the ALU is fetched by the control unit and sent to various
parts of the computer.
Memory unit or main store hold data , instructions (that are being interpreted and
executed ) , intermediate results and final results ready for output. The data and
instructions are passed from the main store into ALU or to and from the storage devices
under the control of the C.U . All instructions or data are stored in the memory unit before
being used by the ALU or the CU . The main store is divided into the a number storage
locations . These locations can be accessed by a unique number or address.
Within the CPU are a number of high speed , special purpose memory units called
REGISTERS . These registers carry out functions in the execution of programs. A
computer has four basic types of registers.
I. Accumulator register (ACC)
II. Store operand register (SOR)
III. Control register (CR)
IV. Instruction address register (IAR)
In addition to the registers, there is an instruction decoder which identifies each
instruction and manipulates the appropriates ALU instructions.
The control unit and internal storage are linked together by sets of parallel electrical
conducting lines called BUSES . These buses that carry data are called DATA BUSES .
To retrieve data from memory it is necessary to identify the ADDRESS BUS.
The frequency with which the processor executes instructions is called it clock speed.
The frequency is measured in megahertz (MHz). The minimum frequency of the PC clock
is 4.77 MHz.

(a) RAM : RAM means Random Access Memory. A read / write memory

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

is called as Random Access Memory. As the name implies, data can be read or written
into this memory. If the information is available in a fixed time regardless of its address,
the memory is a random access memory.
To write the data , the address is placed on the address bus and the chip is informed
that a writing operations is going to take place, by enabling the WRITE pin. Then the
data is placed at the data bus which is then stored. Similarly to read the data , the
address and the RE4AD pin are enabled and the data is retrieved without disturbing
the actual content. The data stored is said to be volatile, which means that once the
power supply is removed, the contents of the memory is lost.
The Random Access Memory comprises of the main memory of the
computer system . It can be used for storing of data temporarily in memory chips. If we
have more RAM, the complex software’s, which require more memory capacity can be
stored . The RAM chips are arranged in rows and installed in the mother-board of the
computer. There are two types of RAM .
1. Dynamic Ram (DRAM)
2. Static Ram (SRAM).
The DRAM is often used because of its simplicity and less cost. However,
it requires recharging periodically in Milliseconds. This makes DRAM slightly
complicated. But comparatively its packing density is more than SRAM.
The SRAM stands for the ensured data, that is , momentary power supply
flickers cannot corrupt the data because recycling / recharging is not necessary. But
SRAM is costly and requires more area. But SRAM and DRAM are volatile.
(b) APPLICATION PROGRAMS :
An application program is designed to handle a particular task required by the end –
user . It handles all aspects of a routine application, including error situations , the display
of menus to aid the user thus making it possible for a user having very little computer
expertise to process the application . For example a financial accounting package
may have an opening menu featuring all required options such as entry of data into
different accounts, producing and printing balances sheets and analysis of expense
accounts. All input / output transfers and error situations are automatically handled by the
package itself, no direct communications being required between the user and the
operating system. Displays and outputs are in formats suitable to the user’s needs.
Packages may be routine packages or may be designed for a specific
purpose :
Example of applications packages :
- Production control packages :
- Production scheduling
- Bills of material processing
- Labor costing

 Stock control and Inventory management.


- Automatic stock replenishment
- Forecasting requirements
- Costing

[[
 Payroll
- piece work calculations
- Bonus calculations
- Credit control
(c) WHAT IS SEQUENTIAL FILE
For information to be useful it should not only be recorded , but it should also be
easy to access and retrieve the information when required.
For organizing records efficiently in acomputer file.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Data must be organized in a logical manner.


 The file structure must allow quick access to data.
 Allow for addition or deletion of data according to requirements.
File organization may be :
 Serial or sequential order
 Direct Access
 Indexed sequential order
( d ) EDIT command
 ‘ EDIT ‘ command is used to alter a record.
 EDIT command , display the current record for editing.
 After editing the record contents, then user has to press Control - End key /
Control – w to save .
 If correct record is not selected for editing , then move one record at a time by
using PgDn, PgUp , ← → ↓ ↑ keys.
 In the EDIT command, we can use condition also.

Syntax :
EDIT <scope> FIELDS <list> FOR condition /
WHILE condition
CHANGE command is identical to EDIT .
CHANGE <scope> FIELDS <list> FOR condition /
WHILE condition
( e ) SAY and GET command
 This statement is used to display the text at a row and column.
 @ symbol followed by row and column.
 Row and column notation starts at 0,0 , which is first row and first column on
the screen.
 Therefore , rows are 0 – 24 for a 25 line and columns are 0 - 79 for a 80
columns screen.
 SAY and GET statements are used individually or in combination with @ row,
column .
Example :
@ 7,10 say “ What is your name “  line 1
@ 7, 50 get name  line 2
@ 11, 10 say “ Pin Number “  line 3
@ 11,50 get pin  line 4
READ
In above program,
Line – 1 display the question “What is your name “ at
row 7 and column 10th position on the
screen.
Line-2 allows data entry from the key board into
‘name‘ variable.
Line – 3 display the question “PIN number “ at
row 11 and column 10th position on the
screen.
Line-2 allows data entry from the key board into
‘pin‘ variable.
‘READ’ statement is used to read to the GET
statement into the specific field / variable.
(f) INDEX command
 If we want to search the record very fast, then that database file must be indexed.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Indexing is a process in dbase III plus use to provide the data in ascending order to
locate the data very quickly.
 When using indexing , dbase iii plus create a new index file , this index file later user
can use .
 But this index file is linked to the database.
 The records in the database is in the same physical order . These records was not
disturbed. When user open the index file , then only database records was in
ascending order.
 How to do index file ?
- first open the database file by using USE command.
- INDEX ON <key expression> TO <index filename>
- This index file name extension is .NDX.
- Advantage of index file is , when user modify the data (add, delete, edit ) in
the database file, automatically, index file will be updated.
- Now if we want to search a record in index file by using FIND and SEEK,
then it was very fast.
- Using indexed files can help with the speed problems of locate.
Ex :
USE EMP
INDEX ON EMPNO TO EMPIND
100% indexed.
(g) BROWSE command
 ‘BROWSE’ command is to display a ‘screenful’ of the database and allow you
to scan and make changes to the database.
 By using browse, display the records for editing and appending also.
 If you need to alter several records at a time , then we can use ‘BROWSE’.
 If the records are longer than 80 characters , we can not see all the record on
the screen at once.
 So , we can move across the record a field at a time using Control  and thus
display the relevant field for alteration.
BROWSE FIELDS <field list > [ LOCK <expression> ]
FREEZE < field > ] [NOFOLLOW] [ NOMENU]
WIDTH <exprN> ] [ NOAPPEND]

(h) IF – THEN – ELSE command


IF Condition is used to compare the values , when condition is TRUE or
FALSE.
It allows a program to make decisions , while it is running. The IF
command means the same thing that it does in English ;
IF condition is TRUE then do some thing ELSE do another thing. IF is end
with ENDIF.
Syntax :
IF (condition) THEN
<commands> / <statements>
ELSE
<commands> / <statements>
ENDIF
- IF is endwith ENDIF
- ELSE statement is optional
Example :
Write a program to find the maximum value for a given two numbers by using if
condition.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

a=10
b=5
If (a > b) then
? “ first number is big “
else
?” second number is big”
Endif
( I ) SERIAL ORGANIZATION (SEQUENTIAL FILE )
In a serial file, each data record is placed in turn in the next available
storage space. The record keys need not be in any particular order , and
there may be no relationship between the logical position of an item on the file and its
physical position on the device. Records can only be accessed in the order in which
they occur on the storage medium.
In sequential file organization , records are held and accessed in a predetermined
sequence of keys . Records can be organized in numerical , alphabetical or
chronological order.

Magnetic tape is a common medium for storing sequential and serial files.
Files however may also be stored on disk, which allows convenient storage and faster
access than on magnetic tape. Data however , must be retrieved sequentially .
A file on a magnetic tape has :
 A header record containing identification information.
 Blocks of data
 Trailer record with reconciliation information.
2. What do you mean by System Software ? Explain the Advantages
Software is the part of the computer system which enables the hardware
to operate.
Computer software can be divided into two major classifications.
 System software
 Application software
System software included the computer programs that run a computer system itself or
that assist a computer in running application programs . It also includes the
documentation that describes how these programs operate.
System Software consist of
 Operating System
 Utilities
OPERATING SYSTEM
An operating system is an integrated set of specialized programs which permit
the continuous operation of a computer from one program to the next with the minimum
amount of operator intervention.

Through the O.S the computer can supervise its own operations by automatically
calling in the applications program, translating any other special service programs, and
managing the data to produce the desired output.

Thus the OS tends to isolate the hardware from the user. The user communicates
with the OS supplies application program and inputs data that are in a language and
format acceptable to the OS and receives the output results.
From the largest mainframes and supercomputers to the small personal
computers almost all computer system run under OS control. The general goal being
to operate the computer with a minimum of idle time and in the most efficient and
economical way during the execution of user programs.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

While personal computer generally use disk operating system DOS ie. Operating
system whose instructions are mostly stored in disk and transferred into the CPU only
as needed, many mainframes and minicomputers use operating systems that presently
reside in primary memory.

The operating system might offer the facilities of multi programming ,


multi processing, batch processing or time sharing ,
MULTI PROGRAMMING :
Programming systems which allow several programs to simultaneously occupy portion
of the computer memory and compete for processor time will be referred to as the
multi programming systems.
In characterizing multi programming systems, it is convenient to thing of the computer
as a collection of resources of different kinds , some of which are in greater demand
than the others.
If any given interval of time the useful work done by a multi programming system is the
sum total of the time spend amount of useful work done by the system is referred to as
the throughout.

MULTI PROCESSING :
Multi processing is the execution of two or more different programs at the same time.
Typically, in multi processing multiple CPUs sharing a common memory are
used . Instructions from different and independent programs can be processed at the
same instant by different processors. On the other hand the processor may
simultaneously execute different instructions from the same program.
Multiprocessing system can be classified as :
a) Loosely coupled multiprocessing
b) Functionally Specialized processors
c) Tightly Coupled multiprocessing
d) Parallel processing
Multi processor system , there are two or more CPUs . Each CPU has a
control unit. ALU, registers and in some cases, cache. An interconnection mechanism
allows each CPU access to a shared main memory and input / output devices. The
processors can communicate exchange signals. Memory is organized so that there is
multiple simultaneous access to separate blocks of memory . In some configurations ,
in addition to the shared resources each CPU may have its own main memory and I / O
Channels.
The entire system is controlled by an integrated operating system. The OS
provides interaction Between processors and their programs.

TIME SHARING :
Time sharing allows a large number of users at various remote terminals to
simultaneously use a centrally located for problem solving. Each user operates
independently and receives such fast response that he has no awareness of the use of
the facility by others. The OS which as the time sharing facilities supervise the scheduling
or jobs, transfer control of the central processor from one user to another and moves
programs in and out of the main memory. In effect, the computer gives time on a
rotational basis to the users. Ordinarily the elapsed time between spurts of attention to
the user is so brief that he has the impression that he alone is being served.
The time sharing system results in an economic advantages which is the primary reason
for its extensive use.
Operating System Facilities :
Multi programming however, presented complex organizational problems. Some of the
operations required to run each program are :

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Program loading
 Loading of input data
 Loading of files
 Allocation of the peripherals to the program
 Monitoring of the program’s actions
 Obeying program request (i.e interrupts)
A number of describe features of a comprehensive operating system are :
- Job control language
- Failure and recovery
- File security
- Logging
- Scheduling
- Monitoring system status
- Multi-access control
SOFTWARE UTILITIES
These are programs or routines which carry out certain procedures which are common to
virtually all applications. Utility programs are different from applications packages.
Application packages are complete systems for specific computer applications. Ex.
Financial accounting , pay roll , inventory control
Utility software performs needed services such as :
Sorting records into a particular sequence for processing .
Ex : A number of outstanding invoices may be processed in date order. The date is used
as the key field . Then all the invoices for one day may be sorted on invoices number, the
number can be minor key field.
Thus by using the command SORT in a source program the computer will provide the
necessary routine. The programmer does not have to write a separate sort program.
- Merging several sorted files into single updated large file
- Transferring data from one I / O device to another.
- Printing of files held on backing storage.
- Printing the contents of main memory.
Job control statements tell the operating system which utility programs are needed.
3. Explain the procedure for creation of a database file in Dbase III plus.
 Database is nothing but collection of field names and records.
 This file extension is .dbf.
 Dbase III plus can accept a lot of data.
 Each record can contain up to 128 field names or 4,000 characters.
 Maximum one billion records we can enter in one d database file.
 Dbase III plus having various types of field names like
 Character field
 Numeric field
 Date field
 Logical field
 Memo field
Character field :
character data consist of alphabetic characters ,numerals and punctuation characters.
Character field can be from one to 254 characters in length .
Ex : names, address, descriptions , part numbers, telephone nos.
Numeric field :
Numeric data types are used to store numbers for calculation. In dbase , numbers can be
up to 19 digits long.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

Ex : subject marks, employee number, student roll number, employee salary , item
amount etc.,
Logical field :
Logical data types are used for ‘yes ‘ or ‘no’ data that is either true or false.
This field accept only one character like ‘y’ , ‘n’ , ‘t’ , ‘f’.

Date filed :
- This field stores data in the form of
mm/dd/yy.
- you no need to specify a length for date field as dbase fills in the default
value of 8 characters .
- Memo field :
- This is special type of field to store free-form text in an efficient manner.
- When entering the data in memo field, dbase iii display the word processor
. So user can enter the data very easily.
- Memo field can be up to 4,000 characters long .
- This file extension is .dbt.
How to create database file :
In dbase iii plus, user can create the database by using two methods.
They are a) Assistant menu
b) dot prompt
Assistant Menu :
 In the sub menu, lists the drives , first user select the disk work area .
 Enter the name of file and press Enter key .
 No need to enter the file extension , dbase iii plus provides .dbf automatically.
 Enter the field specifications like field name , type (c, n, l, d, m) , length .
 By pressing Ctrl + End key , save the complete structure.
 Now display the following message :
“ input data records now ? ( Y/N) “
 Type ‘y’ to enter the data.
 After entering the records , press Ctrl + End to save .
Dot Prompt method

 CREATE command is used to create the database file.


 CREATE <database file name> Press Enter key.
 Now user enter the Field names and Records.
 Press Ctrl + End key to save the database file.
4) Explain the Date Functions in Dbase iii plus.
 Dbase III plus is having various functions like
- Mathematical functions
- String Functions
- Date Functions
- Statistical methods
Date Functions are used to handle the dates and time.
Various date functions are available in dbase iii plus. They are
1) Date() : it return the current system date . This date is correct only , if you
entered the correct date when you started your computer.
Ex : ?date()
01-08-09
2) Day() : It returns the numeric value of the day of the month from the date
variable.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

. ?day(date())
08
3) Month() : It returns the numeric value of the month from a date variable.
This must be beween 1 to 12.
. ?month(date())
01
4) Year() : it return the numeric year from the date variable. It display 4 digit
of the current year.
. ? year (date())
2009
5) Dow() : It returns the numeric code for the day of the week from a date
variable. Monday is day number one.
. ? dow(date())
2 (i.e Tuesday)
6) Cdow() : It returns a character day of the week instead of the numeric day
of the week like Monday, Tuesday etc.,
. ? cdow(date())
Tuesday
7) Cmonth() : It returns name of the month for a date .
. ? cmonth(date())
January
8) Ctod() : This function convert the character date into date format.
Ex. 1 . ? cmonth(ctod(“12/09/08”))
December
Ex. 2 . Display all for duedate >=ctod(“06/01/86”)
9) Dtoc() : This is opposite of Ctod(). This function convert the date format
into character format.

. ? “ The date paid is “ + dtoc(paydate)


The date paid is 07-15-2009

10) ?time() : It return current time in hh:mm:ss format. (i.e system time)
. ? time()
10:20:40
5) Describe the procedure for Label Creation in dbase III ?
 Mailing label form is used to design the addresses for mailing purpose.
 Firstly open the database file by using USE command.
 The field characteristics within the selected database file are used to help the design
the label form.
 By using CREATE or MODIFY LABE command , we can designed the label format.
 Once designed the label form , by using LABEL FORM <fielname> to produce the
label form on the screen.
 LABEL FORM <fielname> TO PRINT command is used to print the labels on the
printer as it is displayed on the screen.
 The default extension given a label form file is .LBL.
How to generate the label form ?
 Open the EMP.DBF file and give the CREATE LABEL command.
 Then dbase displays a menu screen with three items in the main menu as follows :
- Options
- Contents
- Exit
By default the menu items OPTIONS is highlighted. In the menu item OPTIONS , there
are 7 sub-items . By default “ Predefined sizes “ is highlighted .

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

Contents having
OPTIONS
Predefined size : 31/2 x 15/16 by 1
Label width : 35
Label height : 5
Label margin : 0
Lines between labels : 1
Space between labels : 0
Label across page : 1

Contents
Label contents :
1.
2.
3.
4.
5.
By pressing enter key and press F10 to display all field names of the current database
file. Then select only by one field name from the list. These field names to be display on
the screen as mailing label.
Press CTRL + W to save the label file and return back to dot prompt.
How to run the label form ?
. LABEL FORM <filename>
To display on the screen .
LABEL FORM <filename> TO PRINT
This command is to print labels on the printer.
6) What are the different editing commands in dbase III?
 There are several ways to edit the data in dbase iii plus.
 The following keys are used to edit the data.
→←↑↓ to move the record pointer
around the editing form.
Pgup , Pgdn : to move the record pointer from one record to another .
Del key : to delete characters
Ctrl + w / Ctrl + End : to save the modified data.
Dbase III plus having to the following editing commands.
a) update b) append c) edit d) browse e) replace
a) UPDATE :
 The update menu allows full screen editing of records within in the database . User
can add , alter or delete records . If user is editing the records in index file,
automatically updated.
Syntax :
UPDATE ON <key filed> FROM <alias> REPLACE<field > WITH<exp> [,< fields>] WITH
<expr2> [ RANDOM ]
b) APPEND
 Append command is used to add the records to the active database.

Syntax : APPEND [ BLANK ]


User can copy the data from an existing file to the end of the current database.
APPEND FROM <filename> [FOR condition ] [ TYPE ] <filetype>

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

C) EDIT command
 ‘ EDIT ‘ command is used to alter a record.
 EDIT command , display the current record for editing.
 After editing the record contents, then user has to press Control - End key /
Control – w to save .
 If correct record is not selected for editing , then move one record at a time by
using PgDn, PgUp , ← → ↓ ↑ keys.
 In the EDIT command, we can use condition also.

Syntax :
EDIT <scope> FIELDS <list> FOR condition /
WHILE condition
CHANGE command is identical to EDIT .
CHANGE <scope> FIELDS <list> FOR condition /
WHILE condition

d) BROWSE command
 ‘BROWSE’ command is to display a ‘screenful’ of the database and allow you
to scan and make changes to the database.
 By using browse, display the records for editing and appending also.
 If you need to alter several records at a time , then we can use ‘BROWSE’.
 If the records are longer than 80 characters , we can not see all the record on
the screen at once.
 So , we can move across the record a field at a time using Control  and thus
display the relevant field for alteration.
BROWSE FIELDS <field list > [ LOCK <expression>] [ FREEZE <
field > ] [NOFOLLOW] [ NOMENU] [WIDTH <exprN> ] [ NOAPPEND]

e) REPLACE :
 This command is used to replace the content of field for all records or for
records meeting a specified condition.
 i.e replace the old values with new values in the records.
Syntax :
Replace [<scope>] <field> WITH <exp> [,<field2> WITH
<exp2>… ] [ WHILE <condition>] [FOR condition]
7) Explain various library functions in BASIC
 Basic contains built-in library functions, which perform some computations .
 The following functions are available in Basic language. They are
Function Meaning
Abs(x) Absolute value of x
Atn(x) Arctangent of x
Cos(x) Cosine of x
Exp(x) ex value. Where e=2.71828
Int(x) Integer of x. i.e remove the decimal places
Log(x) Natural Logerithmec of x
Rnd(x) Generate random numbers between 0 to 1

Sgn(x) Display the sign of x value.


1 if x>1
0 if x=0
-1 if x<1
Sqr(x) Square root of x

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

Tab(x) Carriage control to provide x spaces


Tan(x) Tangent of x
Note : x is constant or variable or expression
8) Write a program to calculate Simple Interest ?

Step 1 :
. Modify command si.prg
(open the program file)
Step 2 :
Type the following Program
Set talk off
P=0
T=0
R=0
SI=0
Clear
Input “ Enter Principle Amount “ to P
Input “ Enter Rate “ to R
Input “ Enter time “ to T
SI=(P * T * R)/100
?”Simple interest is “ , SI
return
press Ctrl + End key to save the program.
Step – 3
. Do si.prg ( to get the output)
Enter principle amount 2000
Enter Rate 10
Enter time 3
Simple interest is 600
9. Write a basic program to create a data file containing the details of name, roll
no. and marks in four subjects of 100 students.
 Basic having two types of files.
 They are
- Sequential file
- Random file
10 Rem this program is to store 100 student details in stud.dat file.
20 rem rno à Roll number
30 rem sname$ à student name
40 rem maths à maths marks
50 rem phy à physics marks
60 rem chem. à chemistry marks
70 rem eng à English marks
80 rem open the file for writing mode
85 open “o” , #1 , “stud.dat”
90 for i=1 to 100
100 input “ enter roll number “, rno
110 input “ enter student name
120 input “ enter maths marks “,maths
130 input “ enter physics marks “ , phy
140 input “ enter chemistry marks “,chem.
150 input “ enter English marks “,eng
160 Write #1, rno, sname$, maths,phy,chem.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

170 print
180 Next I
190 close #1
300 end
The above program is used to store 100 student details and write into stud.dat file by
using ‘for’ loop.
SECTION – B
(compulsory)
Write a program to evaluate the sales performance of N sales representatives each
selling M products. The comparison should be based on the total value of the
products sold by each representative.
Solution :
10 Rem ** Salesman Problem **
20 Dim R(10) , P(10)
30 Read N,M
40 Rem ** R(J) = Cost of Jth Product ***
50 For J= 1 to M
60 Read R(J)
70 Next J
80 Rem – P(J) = Number of Jth Product Sold **
90 Let I = 1
100 Let C=0
110 For J=1 to M
120 Read P(J)
130 Let C=C+P(J) * R(j)
140 Next J
150 Print “ Sales Man “ , I,C
160 If I=N then 999
170 Let I = I + 1
180 Goto 100
190 Data 5, 5
200 Data 100,150, 200, 250, 300
210 Data 1,2,3,4,5
220 Data 2,3,4,5,1
230 Data 3,4,5,1,2
240 Data 4,5,1,2,3
250 Data 5,1,2,3,4
999 End
Output
SALESMAN 1 : 3500
SALESMAN 2 : 3000
SALESMAN 3 : 2750
SALESMAN 4 : 2750
SALESMAN 5 : 3000

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

BBM-II

COMPUTER APPLICATIONS – I

UNIT WISE IMPORTANT QUESTIONS

UNIT – 1
INTRODUCTION TO COMPUTER
1. Explain the generation of computers ?
 The term “generation” was belongs to hardware and software .
 The computers can be divided into FIVE generations. i.e depending
upon the technologies used.
1st Generation : (1946 to 1955)
 Comparatively large in size .
 Produce lot of heat .
 Basic component is Vacuumed Tubes.
 Low capacity internal storage.
 Individual , non-related models.
 Speed in milli seconds.
 Internal storage consisted of magnetic drum and delay lines.
 Restricted computing capacity
 Short life span
 Complex maintenance schedules.
 Speed of operations is 40 to 300 additions / second.
2nd Generation : (1956 to 1965)
 Smaller in size compared to the first generation.
 Generated a lower level of heat.
 Basic component of these computers is Transistors.
 Transistors occupy small space .
 More powerful than Vacuum tubes.
 Increase reliability.
 Higher capacity of internal storage.
 Related series of processors – the family concept.
 Processor operand in the micro seconds speed.
 High cost direct access storage.
 Speed operation is 3,000 to 30,000 additions / second.
3rd Generation : (1966 to 1975)
 Basic component of this computer is Integrated Circuits (ICs).

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Smaller in size compared to second generation.


 Higher capacity
 Remote communication facility
 Multi-programming facilities.
 Reduced cost of direct access storage.
 Processors speed is in nano seconds.
 Use of high level languages such as COBOL.
 Wide range of optional peripherals.
4th Generation : (1976 to 1985)
 Basic component of this computer is LSI – Large Scale Integrated
Chips (micro processors).
 Increased user-computer interaction and speed.
 Semiconductor is used as internal storage.
 Speed of operations has been increased.
 PC, PC-XT and PC-AT personal computers are very popularized
by IBM.
 Intel-8088 micro processor chip is used .
 Semi conductor memories are very small and very cheap.
 VLSI has made the fourth generation computers very
compact, less expensive, faster , more reliable and of much
greater data processing capacity than third generation
computers.
5th Generation : (1985 onwards)
 Japan and many other countries are working on these systems
called EXPERT SYSTEMS.
 Considerably improve the man-machine interaction.
 Systems would integrate the advancements in both hardware and
software technologies .
 They can also process non-numeric information ex. Graphs,
pictures etc.,
 Reliable and efficient software development by new languages.
 New computer architecture over come previous problems.
2. Explain the parts of computers ? Or Functional Components of a
Computer ?
 The hardware of any computer system can be broadly classified into the
a) Central Processing Unit
b) Peripherals.

a) Central Processing Unit :


This question answer refer to Examn paper code 6240/5
question no I , page no. 2
b) Peripheral Devices :

 The peripheral devices can be classified as Input devices, output devices and
Backing storage devices.
 The Input devices allow the user to get the data into the machine . A large rang of
input devices are available Ex : keyboard , mouse
 The output devices are peripherals used to output results to the user . They
include printer, monitor , plotters.
 Backing storage devices are used to store data and programs permanently . Ex :
hard disks, disk packs, floppy disks and tapes.

3. Explain the characteristic of computers ?


Computer having notable features are there . They are
- speed

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

- storage
- accuracy
- versatility
- automation
- diligence
- reliability
Speed :
- Computer speed is measured in nanoseconds / picoseconds .
- There fore computer is fastest processing electronic device.
- For example , add two 18 digit number in 300 to 400 nanoseconds ,
computer will be processes.
Storage :
- Computer can store massive information and reused again after years.
- For storing data, we used secondary storage devices like floppy, hard disc,
compact disc, Pen drive , tape etc.,
- Storage capacity measured in bytes, kilo bytes, mega bytes and gigabytes
Accuracy :
- computers are very accurate.
- Computer make the mistake because of faulty program , physical circuit ,
mistake made in feeding data or poorly designed system.
Versatility :
- computer are capable of performing any type of task.
- Computers are used in every field like washing machine, microwave oven
etc.,
Automation :
- computer can run automatically without any human intervention.
- Computer is an intelligent device and execute the program step by step.
Diligence :
- Computer does not show any signs of fatigue, tidiness, lack of
concentration or lost interest.
- The speed , accuracy and quality would be absolutely same in the first
and last calculation.
Reliability :
- All the above qualities of the computer make them reliable and also make
us too dependent on them.
- Computers can run for years and years without any loss of date or any
other problem.

4. Explain the classification of computers ?


Computer can be broadly classified on the basis of
 purpose,
 components
 size.
PURPOSE :
 Analog Computers
 Digital Computers
 Hybrid Computers
Analog Computers
 These computers are measure physical quantities like pressure,
temperature, length etc. and convert them to numeric values.
 These computers are mainly used for scientific and engineering
purpose.
Digital Computers :

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON


Digital computers count the numbers (for digits ) that represent
numerals , letters or special symbols.
 Mainly used in automobiles to control fuel , banking systems, etc.,
Hybrid Computers :
 The feature of analog and digital machines are combined to create
hybrid computing system.
 For example , analog devices measure a patient’s heart functions .
These are then converted to numbers and supplied to the digital
components that monitor the patient’s vital signs.
COMPONENTS :

 The earliest computers were mechanical computing devices like


vacuum tubes , transistors, integrated chips etc.,
 In single chip, greater amount of data that can be stored
 Now-a-days , entire processor of the computer on single chip .
 Intel 8088 micro processor chip is used in PCs , PC-XTs , PC-ATs .
 Fifth generation computers are conceived as a knowledgeable
information processing systems.

SIZE :
 Modern computers size is in very small like palm.
 Computers can be classified as
 Mini Computers
 Micro Computers
 Portable Computers
 Super Computers.
Micro Computers :
- smallest type of computer .
- Inside this computer , arithmetic and control unit are combined on single
chip called “ Micro Processor “
- Micro computers are used in home, small business purpose , doctor
maintain patient information etc.,
Mini Computers :
- These computers are powerful than micro computers.
- Data processing is very quickly.
- First mini computer name is PDP-8 launched in 1965.
- Medium size organizations may use it for processing of payrolls and
financial accounts , handling of costing , sales analysis etc.,
Main Frame Computer :
- Main computers are far more powerful .
- Main frames are very large computers with a very high capacity of main
store.
- This is used big companies , banks , governments departments .
- They can be linked into network with smaller departmental computers.
- Example of Main frame computer is IBM-4381 , ICL-39.
Super Computer :
- Complex scientific applications like weather forecasting require a large
amount of data to be manipulated with a very short time.
- This computers have multiple ALUs.
- Each ALU is specialized for particular operation and all capable of
performing simultaneous or parallel processing of different tasks.
- Example : CRY XMP-24, NEC-500.

5. Write Advantages and disadvantages of the computer?


Advantages :

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Making our work easier.


 Reducing the response time.
 Facilitating daily activities.
 Dealing the large amount of data.
 Data storage for longer period.
 Processing speed is very fast.
 Reduce the human dependency
Disadvantages :
 Computer can not think on its own.
 User has to give detailed instructions and every step by step of its
operations has to be described.
 It can not detect flaws in logic input to it
 Computers has no intuition.
 Computer can not draw a conclusion without going through all
intermediate steps.
 Computers can not handle combinatorial explosion.
 Computers do not learn from experience.
 Discarded computers are real junk and consume lot of space.
 They are always a threat to personal privacy.
 Working for too much time on computer gives the user back pain,
nerve injuries etc.,
 By automating tasks – unemployment is increasing at a very high
speed.

UNIT – 2
COMPONENTS OF COMPUTER
1. Explain the parts of C.P.U
This question answer refer to Examn paper code
6240/5 question no. 1 , page no. 2
2. Explain the Main Memory of the computer ?
 The memory unit of the CPU is a place , where programs or instructions and
data are stored ,while processing.
 The device consist of a number of storage locations.
 Each storage location may be identified by a unique number which is called it
address.
 During processing data may be stored in any location which is identified by the
address of the location.
 The storage area may be designed to store a fixed number of characters
which are treated as a single entity or word.
 Memory address may be Word Addressable or Character Addressable.
 If one word is stored in one location is called “Word addressable” and each
character is stored in each cell is called “ Character addressable “
 Main Memory is a combination of RAM and ROM.
RAM : (Random Access Memory)
 Semi conductors elements are used in primary storage sections or main
memory.
 Semi conductor storage elements are small integrated circuits.
 The storage cell circuits and the support circuitry needed for reading and
writing data are packaged on chips of silicon.
 A number of semi conductor storage technologies are in use.
 However, chips that use metal-oxide semi conductor technology are usually
used in the primary storage section.
 The components are called Random Access Memory chips
 It is possible to read from and write to any location within RAM by specifying
its location or address.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 New data can be written onto any location , however , while doing so the
previous existing data is erased.
 RAM chips may be classified as
- Dynamic Ram
- Static Ram
Dynamic Ram chips
 The storage cell circuits contain
- a transistor (functions like a mechanical on-off lights switch)
- a capacitor used to store an electric charge.
 Depending on the switching action of the transistor , the capacitor may have
no charge or hold a charge .
 The charge on the capacitor must be periodically refreshed or recharged.
 So it is volatile memory
Static Ram chips
 It is also volatile storage devices.
 As long as supplied with power, they do not require special regenerator
circuits to retain the stored data.
 More transistors and other devices are needed to store a bit in static RAM.
 These chips are more complicated than Dynamic RAM.

ROM (Read Only Memory)


 There are certain essential functions that the computer must perform when it is
switched on .
 These low level or machine level functions are carried out through a series of
programs or micro programs.
 These micro programs are stored on chips.
 These ROM contains data which can be read randomly when required but
cannot be written onto.
 Data is hardwired onto these chips at the time of manufacturer.
 They can not be change by the user.
 ROM retains the data in it even in the absence of power and is thus non-
volatile storage.
ROM having various types.
a) PROM
b) EPROM
c) EEPROM

 PROM : PROM means Programmable Read Only Memory.


Critical or lengthy operations that are slowly
carried out by software can be converted into
micro programs and fused into a programmable
read only memory chip.
Each bit can be individually programmed to a “1”
or “0” by burning out a fusible link within the
selected cells.
Operations once written cannot be erased. PROM
can be programmed only once.
EPROM : The erasable programmable read only memory makes
it possible for the user to repeatedly erase and reprogram the ROM. Erasing is
done by exposing the EPROM to Ultra Violet rays of a specific frequency.
EEPROM : The Electrically Erasable Programmable Read Only
Memory can be programmed through use of special electric pulses. It is possible
to integrate the circuitry into the computer , so that the EPROM does not have to
be removed from its socket for programming.
VIRTUAL MEMORY

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 The size of the memory units in the CPU is often inadequate, when large
programs need to be stored or large amounts of data need to be processed.
 To overcome this drawback the technique of virtual memory is used.
 The program is divided by the software into pages or segments.
 Only that portion of the program and data that is being processed is kept in
primary storage .
 Part of backing storage is treated as an extension of the main memory and
information that is into required is swapped in and out of main store by the
O.S.
 Thus size of the memory becomes equal to the size of primary memory
storage plus the size of secondary storage being used.
 Processing time is automatically increased.
Cache memory
 Cache memory is small, fast memory is provided between the CPU and main
memory .
 Using cache memory , the size and speed of main memory can be increased.
 A relatively large and slower than main memory is used together with a
smaller , faster cache memory.
 A copy of portions of main memory is maintained in cache.
 When the CPU reads a word of memory, it first reads cache, if found the word
is delivered to the CPU.
 If it is not found in cache, a block of main memory consisting of some fixed
number of words is read into cache.
 The word is delivered to the CPU.
3. Explain the secondary storage devices ? OR Explain the auxiliary storage ?
OR explain data storage devices OR Explain Backing Storage Devices ?
 The secondary storage devices are also called as External or
auxiliary memory backing storage.
 These devices are used to hold mass information’s which can be
desirably transferred at any time.
 It holds larger amounts of data than main storage.
 Though this is less expensive , this takes much time to access the
data
 Secondary storage devices are
- Magnetic Tapes
- Magnetic Disks
- Floppy Disks
- Hard disks
- CD-ROM
- Smart Cards
- Optical Memory Cards
- Flash Memory Cards
Magnetic Tapes
 Magnetic Tapes are plastic tapes coated with magnetic material
such as ferrous oxide.
 By passing this tape under a coil, where the data is fed in the form
current, we can magnetize the tape.
 For reading back, the tape is passed under coil.
 The digital data is converted into electric current which is passed
through the write coil.
 This current throughout the coil, generate magnetic flux which is
stored on the magnetic surface of the tape.
 The tape is divided into number of tracks and the data is stored in
block forms and are separated by an identification gap called Inter
Record Gap (IRG) or Inter Block Gap (IBG).

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 IRG is a gap that exists between two consecutive records stored in


a magnetic tape.
 It allows the tape drive to detect and the end of the record and also
to accelerate the speed required for reading and to deaccelerate
after reading.
 They are used widely in batch processing modes.
 Cost is less.
 It is ultimate mass storage medias.
MAGNETIC DISKS
 A disk is coated with magnetic material is used as the media in this
type.
 A read/write head moves across the surface while the disk is kept
constantly rotating at high speed.
 The disk is divided into number of tracks and sectors.
 The magnetic disks are similar to old gramophone records.
FLOPPY DISKS
 The name floppy disk has come because it can flip.
 It was originally developed by IBM.
 Cost is less, it is portable.
 It is made up of plastic surface , upon which magnetic material is
coated.
 The floppy disks have nearly 70 tracks , it capacity is 3,00,000 to
5,00,000 characters.
 A standard disk can store nearly 1.21 KB data.
 To allow the disks to handle conveniently and to protect them from
dust etc,
 They are permanently sealed in plastic jacket .
 Floppy drive, which is used for reading and writing on the floppy
disks.
 Various sizes are available . They are 8” , 5.25” and 3.5” etc.,
 Disks can be easily changed.
 Cost wise very cheap.
 Can be re-used many times.
 Data can be read / written randomly.
 Less access time.
HARD DISK

 Reading / Writing of Hard disks is similar to floppy disk.


 Much higher storage capacity.
 Disks are permanently fixed and enclosed .
 Read/writing speed is very high compared to floppy disk.
 Normally a disk pack mounted on a spindle , will have stack of 6
plates.
 There are arms mounted with recording or reading heads.
 The arm assembly can move in and out in a radial direction.
 Disk controller is used to read/write operation.
 Data are randomly accessible.
 Compare to floppy disk, it is costly and not portable.
CD-ROM
 CD-ROM stands from Compact Disk – Read Only Memory.
 It is non-erasable disk, used for storing huge volume of data.
 It is read only device.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 This disk having metallic layer which is sandwiched in a protective


transparent cover, made from glass or plastic.
 Information is stored on this metallic layer using laser beam.
 The laser beam burns a hole on the metallic layer or raises a
smaller blister .
 Information is read by a beam by bunching off each hole or
blistering onto a light sensitive device which interprets or reads the
angle of refraction of the beam.
 CD-ROMs have large storage capacity like 180 MB to 630 MB.
 Fast access time.
 Useful for multimedia applications.
 Compact size.
SMART CARDS
 A smart card is a card that is embedded with either a
microprocessor and a memory chip or only a memory chip with non-
programmable logic.
 The micro processor card can add, delete and otherwise
manipulate information on the card, while a memory-ship card ( for
example prepaid phone cards) can only undertake a predefined
operatons.
 Smart cards can carry all necessary functions and information on
the card.
OPTICAL MEMORY CARS
 Optical memory card look like a card with a piece of CD glued on
top.
 Optical memory card can store up to 4 MB of data.
 But once written , the data can not be changed or removed.
 So these are used for medical files, driving records or travel
histories.
 While the cards are comparable in price to chip cards, the card
readers use nonstandard protocols and are expensive.
FLASH MEMORY CARDS
 Flash memory is non-volatile computer memory that can be
electrically erased and reprogrammed.
 It is a technology primarily used in memory cards and USB flash
drives for general storage and transfer of data between components
and other digital products.
 Flash memory cards far less.
 Flash memory is nonvolatile , which means that is does not need
power to maintain the information stored in the chip.
 Fast read access .
4. Explain the Operating System ?
This question answer refer to Examn paper code
6240/5 question no.2 , page no. 11

UNIT – 3
OVERVIEW OF DBASE III PLUS
1. What is database ?
 Database is nothing but collection of information in a structured way.
 We can say that it is a collection of a group of facts.
 Our personal address book is a database.
 Student information is a database . It contains roll number, student name,
maths subject marks, physics subject marks, chemistry marks etc.,

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 These are called FIELD names.


 There fore Field is nothing but smallest unit in a database.
 Each field represents one and only one characteristic of an event of an
item.
 Generally database having various types of field names .
Types of field names
This question answer refer to Examn paper code
6240/5 question no.3 , page no. 14
2. Explain the types of Fields ?
This question answer refer to Examn paper code
6240/5 question no. 3 , page no. 14
3. Explain the Editing commands in Dbase III plus
(update, append , edit , browse , replace)
This question answer refer to Examn paper code
6240/5 question no. 6 , page no. 20
4. Explain the Delete commands in Dbase III plus ?
( delete, erase, pack)

 In Dbase III , delete commands are


- Delete
- Pack
- Erase

Delete :
This command is used to delete the records temporarily.
Records can be marked for deletion. By using BROWSE
command, we can verify that the correct records have been
marked before permanently removing the records.

Syntax :

DELETE [<scope>] [ WHILE <condition> ] [


FOR <condition> ]
Ex: DELETE for Empno=1010
DELETE ALL for results = “fail”
 By using DELETE FILE command, use can delete the file also. But we can not
delete a file that is in use.
Ex: DELETE FILE emp.dbf
ERASE :
 This command is used to delete a file permanently
. But we can not delete a file that is in use.
ERASE <file name>
ERASE emp.dbf
PACK :
 This command is used to delete marked records permanently from the current
database .
 Once delete by using PACK, we can not recall back.
. PACK
. PACK for Empno=101
5. Explain the following commands ?
a) Seek b) Locate c) List d) Display e) Modify Structure
LOCATE :

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Locate command is used to find the records in a database which


satisfy certain conditions.

 Syntax is
LOCATE [ scope ] FOR [ condition ]
Example :
. USE STUDENT
. LOCATE FOR MATHS>=80
The computer will prompt
RECORD 5
 You want to continue the search give the command
. CONTINUE
RECORD 8
. CONTINUE
RECORD 10
. CONTINUE
End of LOCATE scope

 That means searching was completed.


SEEK & FIND
 The FIND and SEEK commands both are used in indexed
database.
 FIND operates with character strings , while SEEK command
operates with either characters string or numeric values.
 If SEEK operates with a character string and string must be
enclosed in a single quotes or double quotes or square bracket.
Example :

. USE STUDENT
. INDEX ON RNO ON STUDX
. USE STUDENT INDEX STUDX
. FIND 1020
. DISPLAY

RNO NAME MATHS PHY CHEM


1020 xxxx 80 90 80]
 The FIND command will move the record pointer to the first record which
matches with find query and the DISPLAY command will display it on the screen.
 The SEEK command like FIND command also works only with an index file.
When we SEEK command with strings , we must use quotes.
Example
. USE STUDENT
. INDEX ON NAME TO STUDN
. USE STUDENT INDEX STUDN
. SEEK “ccc”
. DISPLAY

RNO NAME MATHS PHY CHEM


1070 ccc 78 88 67

 The main difference between SEEK and FIND commands is that SEEK
command will not work with macros , but FIND command is used in macros.
LIST

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 LIST command is used to display all records from the current database
file.
Example
. USE STUDENT
. LIST
 Now display all records from the student file.
 When all the records can not come no a single screen the records scroll
down and we can not see the records in the beginning .
 In order to overcome this problem, we have to use DISPLAY ALL
command.
 DISLAY ALL command displays screen wise records and pauses , until the
user presses a key to continue.
DISPLAY
 This command is used to display the current record details .
Example :
. USE STUDENT
. GOTO 5
. DISPLAY
 Now display the 5th record details
. GO TOP
. DISPLAY
 Now display the 1st record details
. GO BOTTOM
. DISPLAY
 Now display the last record details
MODIFY STRUCTURE
 The MODIFY STRUCTURE command helps to change the
structure of an active database file.
Example
. USE STUDENT
. MODIFY STRUCTURE
 Now display the structure of STUDENT database file.
 After modification of fields, then user has to press CTRL + W to save .
 The MODIFY STRUCTURE command also allows deleting fields or
changing the field type and widths.
 If reduce the width, the data in that field may be lost.
 Hence changes to existing fields must be made with proper care.

6. How to create database file ?


This question answer refer to Examn paper code
6240/5 question no. 3 , page no. 14

UNIT – 4
FUNCTIONS & PROGRAMMING
1. Difference between Sort & Index ?
Sort Index
* Create a new database file * Does not create a new database file.
* Arrange the records in ascending or * Arrange the records only in ascending
descending order order
* file extension is .DBF * File extension is .NDX
* Slower than index file * faster than sort command
* Renumber the record numbers * does not renumber records
* Disk occupy more space * occupy less space
* If we delete/add/edit the records in * When we add / edit the records in original

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

original file, then sorted file is not updated file, then immediately update the index file.
2. Explain the types of Loops in Dbase III plus ?
(Do-while , For loop, loop and End loop )
3. Explain any 5 set commands ?
This question refer to final examn paper no. (5611/3)
Question no. 4 page no. 98
4. Explain the following functions in Dbase III Plus

a) Date Functions :
This question answer refer
to Examn paper code
6240/5 question no. 4 page no. 16
b) String Functions : Refer to Qno . 1 Unit – 5
page n o. 55
c) Mathematical Functions :
FUNCTION USE
LOG(x*y) Returns the log of the expression
X*y
ABS(expn) Absolute value of numeric operations
EXP(expN) Returns the value of the exponent
INT(expN) Returns the integer
LOG(expN) Returns natural Logarithm
ROUND(n,y) Round off to specific number of decimal
places
SQRT(n) Returns the square root of a positive
number
5) Explain the following commands :
a) Accept b) Input c) Wait d) Exit

a) ACCEPT :
 The ACCEPT command presents a prompt on the screen and
waits for the user to respond by typing some text and pressing
ENTER key .
 When user press ENTER key , then input text is stored into
memory variable.
Syntax :
ACCEPT [ <prompt>] TO <memory variable>
Example : ACCEPT “enter student name “ TO sname

 The data stored in the memory variable can be from 1 to 254


characters in length.
 Prompt must be within double quotes or single quotes or
square brackets.
ACCEPT “ enter your name “ TO name
ACCEPT ‘ enter your name ‘ TO name
ACCEPT [ enter your name ] TO name
b) INPUT :
 INPUT statement is used to enter numeric data from the
user.
Syntax :

INPUT [ < prompt > ] TO memory variable


 Prompt is an optional. It must be within double quotes or
single quotes or square brackets.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

INPUT “ enter your age “ TO age


INPUT ‘ enter your age ‘ TO age
INPUT [ enter your age ] TO age
 The computer will display the prompt on the screen and will
wait until you enter the value for the ‘age’ variable.
c) WAIT :
 The WAIT command suspends processing of a program
and waits for the user to press any key to continue .
 It accept only a single keystroke
 Does not require ENTER key.
 Generally , this statement , we used in the programming
files.

EX :
use student
Do while .not. eof()
Display
wait
skip
Enddo
 The above program is to display all records from the
student.dbf file.
 For each record , temporary stop the execution until press
any key by using WAIT.
d) EXIT:
 The exit command transfers control from DO WHILE loop to
the command line.
 Do while loop is end with ENDDO
Example :
Do while (n<50)
?n
n=n+1
if (n=10) then
EXIT
Endif
Enddo
 The above program is display 9 numbers .
 If ‘n’ value reach 10 , then EXIT statement will be executed.
i.e exit from the program and return back to command line.

UNIT – 5
CHARACTER MANIPULATION AND DATABASE HANDLING
1. Explain the string functions.
 Dbase III plus provides many functions for manipulating character type
data .
 ‘ + ‘ symbol is used for string concatenation
 ‘ $ ‘ symbol is used for search the string .
String Concatenation ( + )
 String concatenation simple takes one string and add the second string .
 Ex: ? “John” + “ William”
JohnWilliam

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

Search ($)
 This symbol is used to search the given string into another string .
 Ex : . Display all for “Steve” $Name
Steven
Stevenson
Stevenraj
Stevenes
 The above example is used to search “Steve” name in the field name ‘Name’.
If condition is true , then only display the records.

String Functions
a) Trim : This function is used to removes trailing blanks from a
string. It is most useful for output purpose.
Example : ? “ Ronald “ + “Regan“
Ronald Regan
? Trim(“Ronal “) + “Regan”
RonaldRegan
b) LTRIM() : To remove the bland spaces from
the left end of a character
expression.
c) UPPER() : This function is used to convert
lower case to upper case.
?Upper(“computer”)
COMPUTER
d) LOWER() : This function is used to convert
upper case to lower case.
? LOWER(“PRINTER”)
printer
e) AT() : To search a character in a given string .
This function return to display the
position. It is very useful for
determining whether exists in a string
or not. If not found , it returns Zero
value.
? AT (“ter”, “computer”)
6
f) SUBSTR() : It returns substring from a main string . In this
function, we need three parameters. First parameter is the string to
take the substring of , the second parameter is the character position
to start the substring at and the third parameter is the number of
characters to extract.
?SUBSTR(“computer”,2,3)
omp
?SUBSTR(“printer”,1,3)
pri
?SUBSTR(“siva reddy”,6,5)
reddy
2. Write a prog. to find given number is Prime or not ?
Set talk off
Clear
Num=0
Input “ enter any number “ to num
M=3

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

Flag=0
If ( mod ( num,2)=0) then
?” Not a Prime number “
flag=1
else
do while (num/2)>M
If( (mod(num,m)=0) then
?” Not a Prime number”
flag=1
else
m=m+2
endif
enddo
If (flag=0) then
? “ Prime number”
Endif
Return

3. Write a program to find the given word is Palindrome or not ?


Declare str[10]
Clear
Accept “ enter any word “ to str
I=0
J=len(str)
Falg=0
Do while (J > I)
If ( substr(TRIM(str),I,1)) <> substr(TRIM(S),N,1)
Then
?” The given word is Not a Palindrome”
Flag=1
EXIT
Endif
I=I+1
J=J-1
Enddo
If (flag=0) then
?”The Given Word is Palindrome”
Endif
Return

UNIT – 6
MULTIPLE FILE HANDLING
1. Explain the following commands clearly ?
a) Select b) Set Relation to
a) SELECT :
 By use ‘USE’ command, we can open only one Data Base file .
Dbase allots a work area for that file.
 But when we use multiple files (upto 10 files) , we have to specify
the area in which the different files will work.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 The SELECT command is used to allot work area for different


database files in dbase.
 Dbase assign number 1 to 10 or characters A to J to these work
areas.
. SELECT workarea
. USE filename
Ex : . SELECT A
. USE STUDENT
. SELECT B
. USE MARKS
 Now in the memory, two database files are opened in two different
areas.
 By using → marks , we can access the data from non-active area.
Ex : List A rno, Asname,
Bmaths, Bphysics ,
 In above example, rno, sname read from work area ‘A’ and
maths, physics marks from work area ‘B’.
 CLOSEALL command is used to close all opened
database files.
b) SET RELATION TO
 This command is used to link two database files with or without a
common field between them.
 After link between the database files, ‘ One-to-One’
correspondence will be created.
Example :
. SELECT A
. USE STUDENT
. SELECT B
. USE MARKS
. SET RELATION TO RECNO() INTO B
.LIST RNO, SNAME, BMATHS, BPHY
Now display all student roll numbers, student name from work
area ‘A’ and also display all student maths marks and physics marks from Work area
‘B’.

2. Explain the Statistical Methods in dbase III plus


a) Count b) Sum c) Average
a) COUNT :
 To count all records of the current database file.
 COUNT command can accept FOR clause also. So count only condition
TRUE records only.
COUNT [ <expr> ] [WHILE <condition> ]
[ FOR <condition> ] [ TO <memvar> ]
Ex : . Use Student
. Count
20 records
. Count for maths > 60
To count , those who are having maths
marks > 60 only.
SUM
 Summing of all numeric values of the current database file.
 SUM accept ‘FOR’ clause also for condition TRUE records only.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

SUM [<scope> ] [ <exp list> ] TO [ <memvar> ]


[ WHILE <condition> ] [ FOR <condition> ]
Ex : . USE STUDENT
. SUM
20 records summed

. SUM FOR MATHS > 60


5 records summed
AVERAGE :

 This command is used to obtains the arithmetic mean of selected numeric


fields within the database apply to selected conditions.
AVERAGE <expression list> [<scope> ] ] TO [ <memvar> ]
[ WHILE <condition> ] [ FOR <condition> ]

Ex. : . USE STUDENT


. AVERAGE MATHS
display average of Maths marks

UNIT – 7
INTRODUCTION TO BASIC LANGUAGE
1. Explain the types of operators in Basic language ?
 There are three types of operators available in Basic language.
 They are
Arithmetic operators
Relational operators
Logical operators
Arithmetic Operators :
 All arithmetic operators are used to perform mathematical calculations.
 Arithmetic operators are
+ addition
- subtraction
* multiplication
/ division
** Exponentiation
Relational Operators
> greater than
< less than
>= greater than equal to
<= less than equal to
<> not equal to
= equal to
 Relational operators are used conjunction with conditionals.
IF (A>B) then
IF (A<B) then
IF (A=B) then
Ex :
10 let a=10
20 let b=20
30 if (a>b) then
40 Print “ a is big “
50 else
60 print “ b is big “

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

70 end
Logical Operators
 Logical operators are
and
or
not
 Logical operators are used in multiple conditions like
If (a>b and a>c)
If (maths <40 or phy <40 or chem. or 40)
Logical operators are binary operators.
 Logical operators are performed “bit-wise” i.e the operations is performed
independently on each bit or pair of bits from the operand.
 Logical operations table
AB Not A A and B A or B
1 1 0 1 1
1 0 0 0 1
0 1 1 0 1
0 0 1 0 0
2. Explain the Basic language?
 BASIC language was first invented by J.G.Kemeny and T.E.Kurtz at
Dartmouth college, New Hampshire, U.S.A in 1964.
 BASIC stands for B  BUSINESS A ALLPURPOSE S SYMBOLLILC I
 INSTRUCTION C CODE.
 The basic language was designed to be conversational right from the start.
 In BASIC, the instructional statements are almost similar to normal algebra
and therefore it is easy to understand and quick to learn.
 BASIC contains less number of statements and its grammer is simple.
The important features of BASIC can be follows
 Suitable for conversational programming.
 Facility for manipulation of character strings.
 Dynamic program debugging.
 Ability to carry out arithmetic operations on matrices.
 Provision for filling of programs and daa.
 Simplified grammer.
 Facilities for allowing more sophisticated formats for results.
 Facilities for real-time execution and task scheduling.
 Suitability to both mathematical and business problems.
 Small interpreters and compilers are needed .
BASIC language having lot of features:
 Control Commands and Editing
 Text screen Printing
 Key board input
 Data types and Labels
 Functions and Math Statements
 Loops and Decisions
 Subroutines and Functions.
 Memory Access and Input and Output Ports
 Data Files
 Printing to the Network Printer from with a Program
 Graphics
 String Operations
The following are some general rules of writing a program in BASIC
 All statements should be numbers . The numbers can be anything ranging
from 1 to 9999.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Statements cannot be continued onto next line.


 The highest numbered statement must be the END statement.
 Statements can be entered in any order but the execution will in ascending
order of statement numbers.
 Blank will be ignored except those in string constants.
 Any line of information which begin with a numeric character will be treated
as a line of BASIC.
BASIC LANGUAGE COMMANDS
 LIST : This command is used to display the current
program.
LIST 10-50 to display the program from the line
number 10 to 50
 RUN : To execute the current program
 SAVE “file” : To save the current program for a given file
name.
 LOAD “filename” To store the program into memory from a
given file name
 DELETE : To delete a line numbers from the current
program.
DELETE 10-40
To delete line numbers from 10 to 40 .
 EDIT n : To edit the given line number statements.
 KILL “filename” : To delete a given file name

UNIT – 8
STRING AND ARRAY
1. Explain the types of loops in Basic (while, do, for )
 BASIC provides three ways of performing a sequence of instructions over
and over again.
 They are
 WHILE loop
 DO loop
 FOR loop
The ‘WHILE’ loop
 The while loop enables us to produce a piece of code that will only be
executed while a particular condition is TRUE.
 ‘WHILE’ is end with ‘WEND’ statement.

Syntax :
WHILE (condition)
Statements
WEND
 The above statements execute until loop condition is TRUE.
While Example
WHILE (I<10)
PRITN I
I=I+1
WEND
 The above program is display 1 to 10 numbers . i.e PRINT statement
execute 10 times .
DO - LOOP
 This is second type of loop in BASIC.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 ‘DO’ is end with ‘ LOOP ‘


Syntax
DO
Statements
LOOP (condition)
 In DO loop , condition is last , where as in WHILE loop , condition is first.
 That means in ‘DO’ loop, first execute the loop body , then only verify the
condition. There fore , condition is TRUE or FALSE, compulsory loop body
executed minimum one time compulsory where as in WHILE loop , first verify
the condition, then only execute the loop body.
Example for ‘DO’ loop :
DO
Input “ enter any number “ , n
Print n
LOOP UNTIL ( n=0)
 The above loop execute until ‘n’ value must be Zero.
FOR loop
 This is third type of loop available in Basic .
 ‘FOR’ loop execute depending on predetermined numbers.
 In FOR loop, user has to mention , starting number , ending number and
increment value.
 If increment is not mention , then loop increment automatically by 1.
 The value it assumes on entering the loop (the starting value) is
progressively incremented until it reaches the value required on exit ( the
limit).
 ‘FOR’ loop is end with ‘NEXT’
Example for ‘FOR’ loop
FOR I = 1 TO 10
PRINT I
NEXT I
 The above program display 1 – 10 numbers automatically.
Example for ‘FOR’ loop
FOR I = 1 TO 10 step 2
PRINT I
NEXT I
 The above program is display 1 , 3, 5, 7, 9 only as for every time loop
increment by 2 by using STEP n statement.
2. Explain the Conditional statement in Basic ?
 This is also called as Branching statement or IF-THEN statement.
 This condition execute depending on the condition . If condition is
TRUE then execute some set of statements , if condition is FALSE then
execute another set of statements.
 It is always used in conjunction with a relational operators like > , >= . <
, <= , = etc.,
 Program has two branches to follow , one for FALSE condition and the
other for TRUE condition.
Syntax :
IF (condition) THEN GOTO n
 When an IF…. THEN statement is encountered , the computer first ,
evaluate the relational expression and then determines whether it is
TRUE or FALSE.
 If it is TRUE , then execution jump to the statement labeled ‘n’.
 If the relational expression is FALSE , then the execution continues to
the next line .
Example :

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

10 INPUT A,B,C,D
20 LET N=A+B
30 LET D=C-D
40 IF D=0 THEN GOTO 10
50 LET X=N/D
60 PRINT X
70 GOTO 10
80 END
 After calculating the values of N and D , the values of D is checked to
see whether it is equal to Zero or not.
 If it is zero , the control is transferred to line number 10 thus avoiding a
division by zero.
 When it is not equal to zero, the assignment statement 50 is executed
and after printing the value of X , the control is again transferred to line
number 10.
 ‘QBASIC’ allows the ELSE statement also .
Example :
If (a>b) then
Print “ a is big “
Else
Print “ b is big”
End if
 In ‘QBASIC’ , IF is end with ENDIF
 ‘QBASIC’ support multiple ‘IF’ conditions also.
 Example
If (quantity>5000) THEN
Cost=quantity * rate3
ELSEIF (quantity>4000) THEN
Cost=quantity * rate2
ELSEIF (quantity>3000) THEN
Cost=quantity * rate2
ELSE
Cost=quantity * rate1
ENDIF
3. Explain Library functions in Basic ?
This question answer refer to Examn paper code
6240/5 question no. 7 , page no. 22
4. Explain the types of Arrays (dimensions) in basic
 Arrays is nothing but to store group of values in a single variable. i.e collection
of values grouped together under one common name.
 Arrays are two types.
a) One dimensional array
b) Multi Dimensional array.
One Dimensional Array
 One dimensional array is also called as Vectors.
 Declaration should be starting of the program.
 By using following statement , we can declare the array.
DIM marks (1 to 10)
That means , we can store 10 marks in marks variable
 In this one variable name and one subscript will be there .
 A single subscript variable is also known as “ One Dimensional Array “.
Example :
10 dim a(5)
20 for I = 1 to 5

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

30 read a(i)
40 next i
50 data 10,67,89,7,6
60 End
 In above program, 5 values stored in ‘a’ variable.
When subscript variables are used in a program , certain
Information about them must be supplied before they are met :
1. Which variables are subscripted ?
2. What is the maximum size of each subscript.
 ‘DIM’ statement provide the above information like DIM A(5).
 ‘A’ is called variable name
 ‘ 5 ‘ is maximum size of array.
‘DIM’ is the short term of DIMENSION.
DOUBLE – SUBSCRIPTED VARIABLES
(MULTIPLE DIMENSION)
 In basic language , we can store the values like a matrix format.
 Instead of single dimension subscript variable, we have to use two variables.
DIM N(r,c)
R means number of rows
C means number of columns.
 These values to store in ‘N’ variable like a matrix format.
 Each value of the array can be described by appropriate values
of subscripts.
* DIM N(3,3) means we can store 9 values in N variable
like a matrix format.
* N(1,1)  Ist value
N(1,2)  2nd value
N(1,3)  3rd value
N(2,1)  4th value
N(2,2)  5th value
N(2,3)  6th value
N(3,1)  7th value
N(3,2)  8th value
N(3,3)  9th value
Example :
11 DIM N(3,3)
20 FOR I = 1 TO 3
30 FOR J=1 TO 3
40 READ N(I,J)
50 NEXT J
60 NEXT I
70 READ 2,4,6,7,8,9,4,5,6
80 END
In above program, I refer to Row , J refer to column.‘N’ is the
array variable name.
First loop is for row , second loop is for column.

5. Explain the String Functions ?


 Basic language having various string functions.
 In basic each character is assigned a numeric values known as ASCII
code.
 These codes are very useful for string handling .
 ASCII code can be obtained by using ASC() function.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Character can be displayed by using CHR$() function.


Basic has several functions that operate on numbers and strings . These are

Function Results
CHR$(n) Returns character represented by the ASCII code n
SPACE$(n) Returns a sequence of ‘n’ blank spaces.
STR$(x) Returns the string representation of the number x
ASC(X$) Returns ASCII code of the first character of the string X$
VAL(X$) Returns the numeric representation of the string
LEN(X$) Returns the number of characters in the string X$
LEFT$(X$,n) Returns the left most ‘n’ characters of the string X$
RIGHT$(X$,n) Returns the right most ‘n’ characters of the string X$
MID$(X$,n,m) Returns a string with ‘m’ characters beginning with ‘n’
characters of the string X$
MKI$(x), MKS$(x), Converts numeric value to a string of required length.
MKD$(x)
CVI$(x), CVS$(x), Converts string to a numeric value of required type.
CVD$(x)

Example :
10 PRINT CHR$(65)  result is ‘A’
10 PRINT SPACE$(10) , “GBS”
Result is  10 blank spaces  GBS
10 PRINT STR$(1234)  Convert 1234 numeric type to
string type “1234”
10 PRINT LEN(“computer”)  8
10 PRINT ASC(“BEST”)  66
10 PRINT VAL(“10”) + VAL(“20”)  30
10 PRINT LEFT$(“COMPUTER”,3)  COM
10 PRINT RIGHT$(“COMPUTER”,3)  TER
10 PRINT MID$(“COMPUTER”,4,3)  PUT
Concatenation : ( + )
‘ + ‘ symbol is used for string concatenation . i.e merging of
two strings .
10 PRINT “NEW DELHI “ + “ IS THE “ + “CAPITAL OF “
+ “ INDIA“
 NEW DELHI IS THE CAPITAL OF INDIA

UNIT – 9
FILE HANDLING
1. Explain the Sub-Routine AND functions ?
 Basic language having very important features are subroutine and
functions
SUB ROUTINES
 When we break a large problem into small steps by using subroutine.
 When ever sub routine wants , user can call at any time from the
main program.
 Sub routine program must be end with RETURN statement.
 By using GOSUB n , user can call the sub routine .
 After executing the sub routine , automatically return back to main
program.
 Sub routine may contain many statements like a sub task.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 A sub routine consists of set of program statements that my be used


repeatedly at different places throughout the main program.
 Generally , sub routine program at the end of the main program.
 The structure of sub routine is
1000 Rem “ sub routine Result processing “
1010 …
1020 ….
1030 ….
1040 …
1050 RETURN
 The line numbers should be in sequence and must not occur
elsewhere in the program.
 At any point in the main program control can be transferred to the
sub routine by using the statement GOSUB n.
 Where ‘n’ is the starting line number of SUB-ROUTINE program.
 After transfer the control to GOSUB , execute all statements until
RETURN statements , then return back to next line of the main program.
 A program may contain more than one sub routine and can be called
more than once.
 When the main program is run , at the line number 50 , the computer
is asked to jump to the subroutine that starts with the line number 1000.
During execution of the subroutine , a RETURN statement at the line
1050 is encountered , which transfer the control to the main program line
number 60.
Example :
10 Rem ** This is main program **
20 GOSUB 1000
30 GOSUB 2000
40 GOSUB 3000
50 END
1000 Rem ** Sub routine – 1 ***
1010 PRINT “ THIS IS SUB ROUTINE 1 “
1020 RETURN
2000 Rem ** Sub Routine – 2 ***
2010 PRINT “ THIS IS SUB ROUTINE 2 “
2020 RETURN
3000 Rem ** Sub Routine – 3***
3010 PRINT “ THIS IS SUB ROUTINE-3”
3020 RETURN

 In the above example having one main program and three sub
routine programs.
 From the main program called the Sub routine programs.
 After execution of Sub routine – 1 , return back go main program.
Again control goes to sub routine – 2
 Like that sub routine – 3 also.
There fore output is
This is subroutine – 1
This is subroutine – 2
This is subroutine – 3
Important points , when use SUB-ROUTINE
 Subroutine can be called only through the GOSUB statement.
 The transfer from a subroutine to main program can be only through
RETURN statement.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Generally SUBROUTINE programs can be mentioned below main


program.
 Subroutine may use user-define and system-defined functions.
 Main program should be end with END statement and Subroutine
must be end with RETURN statement.
 The variables used in the subroutines must be defined in the main
program before calling them.
 A sub routine can use any number of new variables and all of them
can be return to main proram.
 The line numbers of sub routine should be unique and written in
increasing order.
FUNCTION
 Basic language allow the programmer to write out a formula for a
function and give it a name using the
DEF FNv(a) = expression
Where
‘v’ is the one-letter name of the function
‘a’ is the argument of the function , which
appears as variable in the expression on the
right-hand side.
DEF FN  means define function
Example
100 DEF FNY(X)=AX**2 + B*X + C
150 LET A=3
160 LET B=5
170 LET C=2
180 LET P=FNY(2)
190 LET Q=FNY(5) – FNY(1)
 Only one letter is allowed to name of a function .
 Maximum of only 26 functions can be defined in a complete program.
 Function formula should be only one line .
2. Explain the sequential files in basic ?
 Basic language having two types of files. They are
1) Sequential file
2) Random File

 Files classification done depending on the way the data is stored and
accessed .
Sequential File
 Sequential files may be created on a magnetic tape or
magnetic disk.
 Data from these files is read sequentially , item after item
starting at the beginning .
 While the sequential files are quite efficient in the use of
computer storage space, they possess the disadvantage that we can not
read or change a particular data item directly.
 Programs are written to read these data values
one after another .
Random Access Data Files
 Random access data files are created on disks to allow us to read or
write from the files in random order .
 Random access allow more flexible access than the sequential files.
 You can read or write any record directly in a random file without
searching through all the records that precede it . Thus reading and
writing of data is faster.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

HANDLING OF SEQUENTIAL FILES


Using data files would require the incorporation of statements in our program
to perform the following functions.
 Giving a name to the file
 Opening the file
 Writing to or reading from the file.
 Closing the file.

Naming a File
- A file is identified by its file specification.
Device name : File Name
- The device name tells the system, which device to
Look for the file .
- File name tells which file to look for on that device.
- The device name followed by colon ( : )
- File name is maximum 8 characters.
- Extension consist of period and three letters.
Opening a File
 Before reading or writing data from a file, that file must be opened by
using OPEN statement.
OPEN “mode”, # file number, “file name”
 Mode is string constant and take one of the following three of them.
“ o “ for sequential output file
“ i “ for sequential input file
“ r “ for random input/output file.
 File mode should be within double quotes.
File number
 File number is an integer number and it can be any number between 1 to
15. It should be unique number.
File name
 A file name specifies the particular file to be used . File name must be
within double quotes.
Closing File
 Opened file can be closed by using CLOSE statement . CLOSE
statement followed by file number.
 If file number is not mentioned , then all opened
files to be closed.
1Writing data to a File
 We may write data to a sequential file by using PRINT # file number,
list of variables or
WRITE # file number, list of variables.
Difference between PRINT # and WRITE # is that WRITE # insert
commas between the data item and quotation marks for string
value.
While PRINT # causes data to be written without any delimiters .
PRINT #1, “KUMAR”, 1750 , the statement would write the following
image to the file #1.
KUMAR 1750 (without commas, quotes)
WRITE #1, “Kumar”, 1750 would write the following image to the file #1.
“KUMAR”, 1750 ( commas , quotes)
Note : Delimiters are very useful when we try to read
the data with an INPUT# statement.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

Reading data from a File


 Data can be read from a sequential file by using INPUT #file number, list
of variables.
 The following statement can be used to read the data.

INPUT #1, N$, sal


File number and list of variables, type of data should be match.
Otherwise display error message.
Reading lines from a File
 The LINE INPUT #file number is used to read an entire line , ignoring
delimeters from a sequential file and assign to a string
variable.
LINE INPUT #file number, list of variables
 This statement read the data upto carriage return.
Example for writing data into sequential file
10 Rem ** Writing data into Seq. File **
20 OPEN “O”, #1, “invent.dat”
30 FOR I = 1 TO 5
40 INPUT “ENTER NAME “,P$
50 INPUT “ ETNER NUMBER “,N
60 INPUT “ ENTER QUANTITY “,Q
70 INPUT “ ENTER RATE “, R
80 WRITE #1, P$,N,Q,R
90 NEXT I
100 CLOSE #1
110 END
Example for reading data from sequential file
10 Rem ** Writing data into Seq. File **
20 OPEN “I”, #1, “invent.dat”
30 PRINT “ NAME NUMBER QTY
RATE “
40 FOR I= 1 TO 5
50 INPUT #1, P$, N, Q
60 LET L=N*Q
70 PRINT P$, N,P,Q,V
80 NEXT I
90 CLOSE #1
100 END
3. Explain the Random Files in basic ?
 Basic language having two types of files. They are
1) Sequential file
2) Random File
 Files classification done depending on the way the data is stored and
accessed .
Sequential File
 Sequential files may be created on a magnetic tape or
magnetic disk.
 Data from these files is read sequentially , item after item
starting at the beginning .
 While the sequential files are quite efficient in the use of
computer storage space, they possess the disadvantage that we can not
read or change a particular data item directly.
 Programs are written to read these data values
one after another .
Random Access Data Files in Basic

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

 Random access data files are created on disks to allow us to read or


write from the files in random order .
 Random access allow more flexible access than the sequential files.
 You can read or write any record directly in a random file without
searching through all the records that precede it . Thus reading and
writing of data is faster.

Creating a Random File (Writing data into a file)


1. open the file
2. allocate the space in the random buffer for variable that will be
written to the file.
3. Move the data into the random buffer.
4. Write the data from the buffer to the disk.
Step – 1
OPEN “R” , #file number, “file name”, record length
 “R” indicates random file is opened for reading
or writing data.
 Record length should be between 1 to 32757.
 Default record length is 128 bytes.
Step – 2
FIELD #file number, variable list is used to allocate the
space in the random buffer .
A FIELD statement define the variables that are used to
put data into or get the data out of a random buffer.
50 FIELD #2, 30 AS A$, 20 AS B$
Define two variables . For A$ , 30 bytes space and for B$ , 20 bytes spaces
was allocated.
Step – 3
Placing the data into the random file buffer is done by the LSET and RSET
statement. They take the form
LSET u$=x$
RSET u$=x$
LSET is left justify and RSET is right justify the string in the field.
Step – 4
Moving the data from a random buffer to a random file is done by the PUT
statement.
PUT #file number, record number
File number refers to the number under which the file was opened.
Record number is the number of the record to be written and expressed as an
integer constant variable.
Example :
PUT #2, 1
Write the information contained in the buffer to the first record of the random
file numbered #2.
Each time PUT statement is executed, a record is written to the file.
Accessing data from random file
Like creation file, accessing a random file include the following steps.
 Open the file for random access.
 Allocate the space for variables by using FIELD statement.
 Bringing the data from the file to the buffer for processing.
 Access and use the data in the program
 Close the file.
STEP-1
 Follow the same procedure of step – 1 in creating file.
STEP-2
 Follow the same procedure of step – 2 in creating file.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

STEP-3
 Bringing data from the file to the buffer is done by the GET statement.
GET #file number, record number
GET #2, 10
Will transfer the content of the record number 10 from the file number 2 to the
buffer.

STEP-4
 After GET statement , the data available in the buffer can be used by the
program for further manipulation and printing outputs.
 In random files, all numeric date are recorded as string values. There fore
string values should be converted into numeric type by using
CVI convert a two-bytes buffer string to an Integer.
CVS convert a four-bytes buffer string to a single precision integer.
CVD convert a 8-bytes buffer string to a double precision integer.
X=CVI(u$)
X=CVS(u$)
X=CVD(u$)
U$ is the name of the string variable containing numeric values in the buffer and x
is a numeric variable.
Writing data into random file
10 REM *** CREATION OF RANDOM FILE ***
20 OPEN “R” , #1, “SALARY”,35
30 FIELD #1, 20 AS N$, 5 AS B$, 10 AS A$
40 INPUT “ ENTER 5 RECORDS NOW “
50 FOR I = 1 TO 5
60 INPUT “ ENTER EMPLOYE ENAME “,X$
70 INPUT “ ENTER BASIC PAY “,P
80 INPUT “ ENTER ALLOWANCES “,Q
90 PRINT
100 LSET N$=X$
110 LSET B$=MKS$(P)
120 LSET A$=MKS$(Q)
130 PUT #1, R
140 NEXT I
150 CLOSE #1
160 END
Reading records from random access file
10 REM * READ DATE FROM RANDOM FILE**
20 OPEN “R” , #1, “SALARY”,35
30 FIELD #1, 20 AS N$, 5 AS B$, 10 AS A$
40 PRINT “ RECORDS ARE “
50 FOR I = 1 TO 5
60 GET #1, I
70 LET P=CVS(B$)
80 LET Q=CVS(A$)
90 LET T=P + Q
100 PRINT
110 PRINT “ RECORDS ARE “;R,N$,P;Q;T
120 NEXT I
130 CLOSE #1
140 END
4. Explain the following Programs in Basic ?
a) Prime number
5 REM ** FIND PRIME NUMBER **
10 CLS

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

20 PRINT
30 INPUT “ ENTER ANY NUMBER “,N
40 PRINT
50 D=N-2*INT(N/2)
60 IF D=0 THEN GOTO 200
70 D=N-3*INT(N/3)
80 IF D=0 THEN GOTO 200
90 FOR I = 6 TO INT(SQR(N))+1
100 D=N(I+1)*INT(N/(I+1))
110 IF D=0 THEN GOTO 200
120 NEXT I
130 PRINT “ PRIME NUMBER “
140 END
200 PRINT “ NOT A PRIME NUMBER “
210 END
B.B.M – II
COMPUTER APPLICATIONS-1
PAPER-V
I. Answer the following questions . Each question 10
lines compulsory.
a) Control Unit
This question answer refer to Page no. 3 , Paper
code 6240/5 – Question no. I
b) Input Devices
It is the input and output devices that form the essential link
between the user of the computer system and the computer system
itself. These devices from the “interface” between the user and the
system.
Input devices are required to get raw data into the computer.
Output devices are those which output the processed information.

In the early years of computing punched card and punched paper


tape were used to input data into the computer.

Input Devices are


 Keyboard
 Mouse
 Joystick
 Barcode Reader
 Optical Markup Reader(OMR)
 Optical Character Reader(OCR)
 Magnetic Ink Character Reorganization
(MICR)
 Punched Cards
 Paper Tapes
 Magnetic Tape
 Magnetic Disk
 Light Pen
 Optical Scanners.
c) Hardware
Hardware is nothing but physical components of the
computer .Programs namely, the list of instructions to be executed by
a computer are known as “Software” of a computer. The electric
circuits used in building the computer that executes the Software
is known as “Hardware” of a computers.

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

Hardware is mainly divided into Two parts.


a) Central Processing Unit
b) Peripherals.

Central Processing Unit divided into three parts.


i) Control Unit
ii ) Arithmetic Logic Unit
iii) Memory
Peripherals are divided into three parts.
a) Input
b) output
c) Storage
d) PACK command
This question answer refer to Page no.47,
Unit – III – Question no. 4
e) DATE functions
This question answer refer to Page no.16 , Paper
Code 6240/5 – Question no. 4
f) SET RELATION TO
This question answer refer to Page no.61, Unit - 6 –
Question no. 1(B)
g) RECALL
The RECALL command is used to unmark those records that were
marked for deletion with DELETE command. Like DELETE command,
RECALL command has several forms.
Ex : .
. RECALL RECORD 4 Unmark record 4 for
deletion.
. RECALL NEXT 3 Unmark the next 3 records
for deletion.
. RECAL ALL  Unmark all records within the
database for deletion.
Ex: . USE STUDENT
. DELETE ALL FOR MATHS < 40
5 records deleted.
. LIST
Now display all records along with deleted records
also. These records was display along with ( * ) symbol.
. RECALL ALL
. LIST
Now display all records without Marked symbol.
h) Data types of Basic
 Basic has two types of variable to handle the
constant data. They are
 Numeric Variables.
 String variables.
Numeric variable :
 Numeric variable create location in computer
memory for storing numeric constants .
 Numeric variable can be any single letter of the
alphabet or any single letter of the alphabet followed by
one the numerals 0,1,2,3,4..9.
 Examples

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

A, B , C ,D E … Z  Single
Character (26)

A1,B1,C1..Z1  two characters


 Basic allows a length up to 40 characters for
variable names.
Ex :
Salary=8000
Empno=1010
Maths=90

String Variable

 String constants should be handled by string


variables.
 String variables end with $ sign.
 Any string variable can be used to store any
string constant.
 String value should be within double quotes.
Ex:
Fruit$=”apple”
Country$=”INDIA”
Name$=”Rao”

i) Mathematical Operations of Basic


There are three types of operators available in BASIC
language. They are
 Arithmetic Operators
 Relational Operators
 Logical operators
Arithmetic Operators :
All arithmetic Operators are
+ Additions
- Subtraction
/ Division
* Multiplication
** Exponent
 Arithmetic negation is a unary operation which requires
one numeric operand and produce a numeric result. The arithmetic
negation operator is the minus sign . The result represents the
additive inverse the operand.
 Multiplication :
 Multiplication is a binary operation which requires two numeric
operands and produce a numeric result. The multiplication operator
is the asterisk .
DIVISION : Division is binary operation , which required
two floating points operands and produces a
floating point result. The division operator is
the slash .
MODULUS :
Integer division is a binary operation which
requires two integer operands and produces an integer result. The modulus

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

operator is the word “MOD” . The result represents the remainder from the division of the
first operands by the second operand.

ADDITION : Addition is a binary operation which requires two numeric operands and
produces a numeric result. The addition operator is the Plus sign . The result represents
the first operand plus and second operand.
j) What is an Array
This question answer refer to Page no.74,
Unit -8 Question no. 4)
1. State and explain the components of the computer
system.
This question answer refer to Page no.31, Unit -1 –
Question no. 2.
2. State and describe different types of memory devices.
This question answer refer to Page no.37, Unit -2 –
Question no. 2.
3. State and explain the different commands available in dbase to
store data in a .dbf file.
Data store commands are
REPLACE,UPDATE,APPEND,BROWSE , EDIT
This question answer refer to final examn paper no. 6240/5 ,
Question no. 6, page no. 20.
4. Describe different SET commands in Dbase.
Dbase III plus contains a large number of SET commands,
which modify the working environment of dbase III Plus.
SET commands Use
SET Display dbase III plus control parameters
SET BELL ON / OFF Turn bell ON / OFF
SET CENTURY ON / OFF Show century in date displays
SET COLOR ON / OFF Toggle between color / monochrome , default
depends on the system.
SET DATE AMERICAN / ANSI / Determine format of date fields, default is normally
BRITISH / GERMAN AMERICAN.
SET DECIMAL TO <n> Set minimum number of decimal places displayed.
SET DEFAULT TO <drive> Select the default drive.
SET DELETED ON / OFF When ON record marked for deletion are not
processed.

SET DEVICE TO PRINT / Route results of @.....SAY commands , default is


SCREEN screen.
SET FIELDS ON / OFF Use / do not use the specified filed list.
SET FIELDS TO <field list> Define fields to be used with the active database.
SET ECHO ON / OFF Display / do not display command lines.
SET ESCAPE ON / OFF Allows program interruption when the <Esc> is
pressed.

5. What is Random File ? Explain how it is created by taking suitable example.


This question answer refer to Page no.88, Unit -9 – Question no. 3.
6. Explain the syntax of different control statement of BASIC .
Control statements are FOR – NEXT
GOTO
GO SUB (subroutine)
IF-THEN-ELSE
This question answer refer to Page no.70, Unit -8 –
Question no. 1

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

This question answer refer to Page no.61, Unit -6 –


Question no. 1.
This question answer refer to Page no.80, Unit -9 –
Question no. 1.
7. How to you retrieve data from multiple .dbf files.
This question answer refer to Page no.61, Unit -6 –
Question no. 1.
8. Explain how subroutines are provided in BASIC.
This question answer refer to Page no.80, Unit -9 –
Question no. 1.
SECION – B
Answer the following question compulsory.
9. The following data is stored in Tel.dbf.
Telephone no. , Month, Intreading, Finalreading to store data about phone
calls of customers.
The telephone department charges the customers as per the following logic :
a) First 50 calls are not charged
b) From 51st call onwards the rental is Rs. 1.15 per call
c) Additional Rs. 180/- is charge as rental charges.
d) Additional services charges at the rate of 10% on call charges.
Write a dbase program which read data from the above . Tel.dbf and computes the
charges. Display the following output.
TELEPHONE NO. : ……………………

INITIAL READING : ……………………


FINAL READING : ……………………
FREE CALLS : ………50 ……………
CHARGED NO. OF CALLS : ………..
CHARGE FOR CARGED CALLS : Rs. ……
RENTAL CHARGES : Rs. 180/-……..
SERVICE CHARGES : Rs.………….

TOTAL AMOUNT TO PAY : Rs. ………………


set talk off
clear
use telephone
TC=0
BAMT=0
SC=0
do while .not. eof()
TC=FR-IR
TC=TC-50
IF (TC>0) THEN
BAMT=TC*1.15
ELSE
BAMT=0
ENDIF
BAMT= (TC-50) * 1.15
SC=0.10*BAMT
? " TELEPHONE NUMBER ", TELNO
?" MONTH NAME ",MONTH
?" INITIAL READING ",IR

Gandikota Business School Page 48


COMPUTER APPLICATIONS - ID YEAR
BBM SECON

?" FINAL READING ",FR


?" TOTAL NO. OF CALLS ",TC
?
?" BILL AMOUNT ",BAMT
?
?" SURCHARGE " ,SC
?"*************************** "
?" TOTAL BILL AMOUNT " , SC+BAMT
? " ******************************* "
WAIT
SKIP
ENDDO
CLOSE ALL
CLEAR ALL
RETURN

Gandikota Business School Page 48

You might also like