Thursday, March 1, 2018

SEE Computer Science solved PABSON KTM

Computer Science Kathmandu Pabson SEE Board Exam

Group A

1a) What is centralized network? How it is different from client server network?
Ans: A centralized computing network is a
network in which a central host computer
performs data processing and storage on behalf
of clients. It is different from client server
network as client server network consists of at
least one server and one or more client as well as client server provides high security of data and other resources.

b) List any three types of internet connection and define any one of them.
Ans: Any three types of internet connection are:
i) Dial Up Connection
ii) ADSL Connection
iii) Fiber Connection
ADSL is a technology for transmitting digital
information at a high bandwidth on existing
phone lines to homes and businesses. Unlike
regular dialup phone service, ADSL provides
continuously-availbale, "always on" connection.

c) What is multimedia computer system? What
are the components of multimedia?
Ans: A multimedia computer is a computer
equipped with special hardware and software
that makes multimedia possible. The components of multimedia are: text, graphics, video, audio and animation.

d) Why does a computer need air-conditioned
room?
Ans: Computer system needs air conditioned
room because the factor of climate such as
temperature and humidity can pose a threat to
computer security. Extremely heat can cause
failure of electronic components. Excessive or
very low humidity can also have an adverse
effect on the computer equipment.

e) Define computer virus. List few types of virus.
Ans: Computer virus is a program written by the
programmer with the intention of destroying and
damaging the data and programs residing in the
computer system. The few types of virus are: boot
sector virus, program virus, script virus etc.

3. Match the following.
NOS ➡➡➡ Windows Server
Web Page ➡➡➡ Any pages of the web site
CAT-5 ➡➡➡ Transmission media
Spyware ➡➡➡ Virus

4. Replace the following definitions with a
technical term.
a) Medium that carries data without physical
path. Unguided Media
b) Learning through electronic media. E-Learning
c) A collection of internet resources such as files, hyperlinked text, audio, video etc. WWW
d) The electronic transfer of monies with the goal of hiding its source and possibility its destination. Cyber Laundering.

5. Write the full forms:
a) CCTV - Closed Circuit Television
b) SQL - Structured Query Language
c) .ORG - Organization
d) RGB - Red Green Blue

6. Choose the best answer.

a) Which is not the network protocol?
i) TCP/IP
ii) STP
iii) FTP
iv) All of the above
Ans: STP
b) An important countermeasure against data
corruption or loss.
i) Password Policy
ii) Backup system
iii) Scan disk
iv) Defragmentation
Ans: Backup system

c) Which one is not the type of virus?
i) Message Carrying
ii) Boot Sector
iii) Special Purpose
iv) System infector
Ans: Special Purpose

d) E-commerce..............
i) is a type business
ii) is a type of virus
iii) Both i and ii
iv) None of the above
Ans: is a type of business

Group B

7a) What is relational database software? Give
any two examples.
Ans: It is a database management system that is
based on the relation model in which data is
stored in the form of tables and the relationship
among the data is also stored in the form of
tables.
E.g.: SQL, MS-Access, Oracle, etc.

b) What is a form? What is the purpose of
preparing form in MS-Access?
Ans: Form is an object of database which
provides graphical interface to enter data into
the tables or multiple linked tables. The purpose
of preparing form in MS-Access is to provide an
interactive platform for input of data into the
database as well as to display data in more
presentable form than a datasheet.

c) Identify a record, field and value from the
following table structure.
Roll Name Marks
1 Kopila 87
2 Rabin Rana 56
Ans: Record = 1 Kopila 87, 2 rabin Rana 56
Field = Roll, Name, Marks
Value = 87, 56

8a) Which is the default data type of MS-Access?
i) Number
ii) Auto Number
iii) Text
iv) Currency
Ans: Text

b) Field Size, Format, Input Mask, Default Value
are ...........
i) Key elements
ii) Field Properties
iii) navigation modes
iv) Data types
Ans: Field Properties

c) Primary Key does not accept..............
i) Text
ii) Number
iii) Null Value
iv) None of the above
Ans: Null Value

d) Which is not MS-Access object?
i) Form
ii) Query
iii) Caption
iv) Table
Ans: Caption

9) Match the following.
Show final output ➡➡➡ Report
Data Entry ➡➡➡ Form
Change the table structure ➡➡➡ Design View
Validation Rule ➡➡➡ Field Properties

10. a) Write any two differences between user
defined function and built-in-function.
Ans:
The two differences between user defined
function and built-in-function are
User Defined Function: Function which is defined by the user according to the need is called user defined function. Examples: SUM ( ) , SHOW ( ), etc.
Built-in Function: Library functions are built-in
or ready made functions provided by QBASIC.
E.g. SQR( ), INT ( ) etc.

b) List any two data types used in C language.
The two data types used in C language are int
and char.

c) Write down function of:
i) CLOSE: It closes one or all open files.
ii) NAME AS: The NAME statement renames a file on a diskette

11. Write the output of the following program:
DECLARE SUB Series( )
CALL Series
END
SUB Series ( )
R = 2
M = 5
WHILE M >=1
PRINT R
R = R * 10 + 2
M = M - 1
WEND
END SUB
The Output is :
2
22
222
2222
22222

12. Rewrite the following program correcting the bugs.
REM to print only male record on the printer
from the data file.
OPEN "EMP.DAT" FOR OUTPUT AS #1
DO
INPUT #4, N$, A%, S$
SELECT CASE S
CASE MALE
PRINT N$, A%, S$
END SELECT
LOOP UNTIL EOF(1)
STOP #1
END
Debugged Program
REM to print only male record on the printer
from the data file.
OPEN "EMP.DAT" FOR INPUT AS #1
DO
INPUT #1 , N$, A%, S$
SELECT CASE S$
CASE "MALE"
PRINT N$, A%, S$
END SELECT
LOOP UNTIL EOF(1)
CLOSE #1
END

13.
DECLARE SUB PATTRA (N)
N = 7
CALL PATTRA(N)
END
SUB PATTRA(N)
FOR I = 1 to 5
PRINT N
IF N MOD 2 = 1 THEN
N = (N*2) + 1
ELSE
N = N / 2
END IF
NEXT I
END SUB
Questions:
a) Write the output of the above program?
Ans: The output is:
7
15
31
63
127
b) Write down the function of MOD in the above
program.
Ans: The function of MOD operator is to find the
remainder.

14.a) WAP to calculate the area of four walls
using FUNCTION.......END FUNCTION.
DECLARE FUNCTION AREA (L, B, H)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
INPUT “ENTER HEIGHT”; H
AR = AREA(L, B, H)
PRINT “AREA OF FOUR WALLS”; AR
END
FUNCTION AREA (L, B, H)
A = 2 * H * (L + B)
AREA = A
END FUNCTION

b) WAP that ask any number and calculate its factors using sub procedure.
DECLARE SUB FACT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL FACT (N)
END
SUB FACT (N)
PRINT "FACTORS OF"; N; "=";
FOR I = 1 TO N
IF N MOD I = 0 THEN PRINT I;
NEXT I
END SUB

c) Write a program to input product name,
quantity and price of some items and store them in STOCK.DAT file along with serial number for each record.
OPEN "STOCK.DAT" FOR OUTPUT AS #1
DO
CLS
INPUT "ENTER PRODUCT NAME"; N$
INPUT "ENTER QUANTITY"; Q
INPUT "ENTER PRICE"; P
C = C + 1
WRITE #1, C, N$, Q, P
INPUT "DO YOU WANT TO CONTINUE(Y/N)";
CH$
LOOP WHILE UCASE$(CH$) = "Y"
CLOSE #1
END

SEE Computer Science 2073 Solved

SEE 2073 Computer Science Question Solved

1. Answer the following questions.

a) Write any two advantages of BUS topology.
Ans : The advantages of bus topology are:
It is easy to set up computers and other devices in bus topology, because all the devices are connected through a single wire.
It requires fewer cable media, so it is cheaper than other topologies.

b) Define computer security.
Ans: The security given to the computer for the
protection of hardware, software and data from
being lost or damaged due to accidental or
intentional harm is known as computer security.

c) Write any two preventive measures to protect
computer system from computer virus.
Ans: Any two preventive measures are:
i) Do not install pirated software, especially
computer games
ii) Scan the mail or unknown files of internet
before opening in your computers.

d) What is multimedia?
Ans: Multimedia is the integration of multiple
forms of media, which presents information in
more interesting and understandable way.

e) Write the use/function of File Transfer
Protocol.
Ans: The use of File Transfer Protocol is to
transfer the file from one computer to another
computer. It helps to upload and download the
files.

2. a) Perform the conversion as per the direction:
i) (BAD)₁₆ into binary
Solⁿ:
Converting Hexadecimal to Binary
B = 1011
A = 1010
D = 1101
(BAD)₁₆ = (101110101101) 2
ii) (1111001)₂ into octal
Solⁿ:
Converting Binary to octal
001 = 1
111 = 7
001 = 1
(1111001)₂ = (171)₈

b) Perform the binary calculations:
i) 11 × 10 + 11
                               1 1
                            × 1 0
                           ______
                                0 0
                           +1 1 ×
                        _________
                              1 1 0
Now, Adding with 11
                                        1 1 0
                                        + 1 1
                                      _______
                                      1 0 0 1
∴ 11 × 10 + 11 = 1001

ii) 110 ÷ 10
10) 110 ( 11
      -10
      _____
          10
        - 10
        _____
           00
∴Quotient = 11
Remainder = 00

3. Match the following:
a) Malicious software                      i) UPS
b) Primary storage device               ii) virus
c) Power protection Device            iii) copyright
d) Intellectual property law             iv) RAM
                                                            v) CD-ROM
Answer
a) Malicious software               ➡   virus
b) Primary storage device     ➡       RAM
c) Power protection Device      ➡    UPS
d) Intellectual property law   ➡       copyright

4. State whether the following statements are true or false:
a) Computer Network reduces the cost. True
b) WWW is an organization which controls
Internet. False
c) Microwave transmission is an example of
bound media. False
d) The parts of the computer which can be seen
and touched are called hardware. True

5. Write the appropriate technical terms of the
following:
a) A type of network in which every computer
works as both client and server.
Ans: Peer-to-peer network
b) Protocol used to receive email from the mail
server.
Ans: POP( post office protocol)
c) The moving graphics images.
Ans: Animation
d) The law that controls cyber crimes.
Ans: Cyber Law

6. Write the full forms:
a) LAN: Local Area Network.
b)ROM: Read Only Memory.
c) SMTP: Simple Mail Transfer Protocol.
d)NOS: Network Operating System.

7. Answer the following questions.

a) Define data and database.
Ans: Data can be numbers, letters or symbols
representing facts and figures which may or may
not give any sense. Database is a collection of
related and organized information that can be
used for different purpose.

b) What is primary key? Write its importance.
Ans: Primary key is a field that uniquely
identifies the record. It is needed because it
neither accepts duplicate values nor permit null
values.
The importance of Primary key are:
i) To reduce and control duplication of record in
a table.
ii) To set the relationship between tables.

c) Name any four data types used in MS-
Access.
Ans: Any four data types of MS-Access are:
i) Text
ii) Number
iii) Memo
iv) Currency

8. Select the correct answer:
a) The columns in a database table are
called………………………
Ans: Field
b) Which is the suitable data type to store video?
Ans: OLE object
c) …………… object of MS-Access is used to print
formatted data.
Ans: Report
d) Which is not a type of query?
Ans: Search

9. Match the following:
a) Query.                    i) Printed format
b) Form                      ii) Stores data
c) Table                iii) Allows view, edit, input data
d) Report       iv) Extracts selected record for view
                              v) DBMS
Answer
a) Query     ➡     Extracts selected record for view
b) Form      ➡           Allows view, edit, input data
c) Table      ➡            Stores data
d) Report    ➡           Printed format

10. a) What is a loop?
Ans: Loop can de defined as repeating the
statement of statement blocks for a number of
times.

b) Write the functions of NAME and CLOSE statements.
Ans: The function of NAME statement is to
renames a file on a diskette. The function of
CLOSE statement is to close one or all open files.

c) What is variable?
Ans: The data item whose value changes during the execution of a program is called variable.

11. Re-write the given program after correcting the bugs:
DECLARE SUB SUM(N)
INPUT “Any Number”; N
PRINT SUM(N)
END
SUB SUM (N)
S=0
WHILE N=0
R= R MOD 10
S=S+R
N=N/10
WEND
PRINT “Sum of digits”;S
END
Debugged Program
DECLARE SUB SUM(N)
INPUT “Any Number”; N
CALL SUM(N)
END
SUB SUM (N)
S=0
WHILE N< > 0
R= N MOD 10
S=S + R
N=N \ 10
WEND
PRINT “Sum of digits”;S
END

12. Write the output of the following program.
DECLARE FUNCTION AREA (L, B)
CLS
LET L = 50
LET B = 10
LET ans = “; ans
PRINT “The area=”; ans
END
FUNCTION AREA (L, B)
Ar=L*B
AREA=ar
END FUNCTION
Output
The area = 500

13. State the following program and answer the given questions:
DECLARE FUNCTION Diff(A, B)
CLS
INPUT “Enter first number”; A
INPUT “Enter second number”; B
PRINT “The difference”; Diff(A, B)
END
FUNCTION Diff(A, B)
Difference= A – B
Diff = difference
END FUNCTION

a. List all the numeric variables used in the above program.
Ans: The numeric variables used in the above
program are A, B and Difference

b. List the local variables used in the above program.
Ans: The local variables used in the above
program is A, B and Difference 14

14 a) Write a program to calculate the area of four walls using Sub….End Sub. [Hint: Area=2H(L+B)
DECLARE SUB AREA (L, B, H)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
INPUT “ENTER HEIGHT”; H
CALL AREA (L, B, H)
END
SUB AREA (L, B, H)
A = 2 * H * (L + B)
PRINT “AREA OF FOUR WALLS”; A
END SUB

b) Write a program to input a word in the main
module and count the total number of vowel
characters present in the word using FUNCTION…END FUNCTION.
DECLARE FUNCTION COUNT (S$)
CLS
INPUT "ENTER ANY STRING"; S$
PRINT "TOTAL NO. OF VOWELS= "; COUNT(S$)
END
FUNCTION COUNT (S$)
VC = 0
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = "A" OR C$ = "E" OR C$ = "I" OR C$ = "O"
OR C$ = "U" THEN
VC = VC + 1
END IF
NEXT I
COUNT = VC
END FUNCTION

c) Create a data file to store the records of few
employees having Name, Address, Post, Gender and Salary fields.
OPEN “std.rec” FOR OUTPUT AS #1
DO
CLS
INPUT “Enter Name”; N$
INPUT “Enter Address”; A$
INPUT “Enter Post”; P$
INPUT “Enter gender”; G$
INPUT “Enter Salary”; S
WRITE #1, N$, A$, P$, G$, S
INPUT “Do you want to continue”; CH$
LOOP WHILE UCASE$(CH$)=”Y”
CLOSE #1
END

SEE computer Science 2071 Supplimentary Solved

SLC Supplementary 2071

1. Answer the following questions.

a) What is computer network? List any two
advantages of computer network.
Ans: A group of interconnected computers through transmission media in order to
communicate and share resources like hardware,
data and software.
Any two advantages of computer network are as
follows:
i) The computers on a network can share
hardware devices like printer, hard disk, scanner
etc.
ii) File can be transferred from one computer to
another in a network.

b) What is antivirus? Name any two examples of
antivirus software
Ans: Antivirus software is software designed to
detect and remove virus from computer system o ensure virus free environment.
Any two examples of antivirus software are:
i) Kaspersky ii) NOD32

c) What is hardware security? Name any two
software security measures.
Ans: The security given to the various hardware
tools or equipment from being lost or damaged
due to accidental or intention is known as
hardware security.
Any two software security measures are:
i) Password
ii) Backup

d) Give the importance of MODEM to the
computer network.
Ans: The importance of MODEM to the computer
network is that it transfers data from one
computer to another through telephone line and
access internet as well as performs modulation
and demodulation process.

e) What is internet?
Ans: Internet is an interconnection of several
thousands of computers of different types
belonging to the various networks all over the
world.

2a. Convert as instructed
i) (74)₈ to decimal
Solⁿ :
=7×8¹ + 4×8¹
=7×8 + 4×1
=56 + 4
= 60
(74)₈ = (60)₁₀

ii) (FAC)₁₆ into binary
Solⁿ :
Converting hexadecimal to binary,
F = 1111
A = 1010
C = 1100
(FAC)₁₆ =(111110101100)₂

b. Perform the binary calculations.
i) 111×11
                1 1 1
                × 1 1
                _____
                1 1 1
           +1 1 1 ×
           _________
           1 0 1 0 1
111×11 = 10101

ii) 1 0 1 – 1 1
                 1 0 1
                  - 1 1
                 _____
                    1 0
   101-11 = 10

3. Match the following.
Group A                                              Group B
a) Node                                              i) Workstation
b) Server                                            ii) HTTP
c) Coaxial cable                               iii) Repeater
d) Protocol                                iv) Main computer
                                         v) communication media
Answers:
Group A                                                 Group B
a) Node                👉                       i) Workstation
b) Server               👉            ii) Main computer
c) Coaxial cable   👉    iii) communication media
d) Protocol            👉         iv) HTTP

4. Select the correct answer.
a) Which refers to the communication media?
i) UTP cable ii) Fiber optic iii)
Microwave     iv)✓ All of the above

b) Which one is not a type of virus?
i) Message carrying virus ii) Boot
Sector virus iii) System Infector
iv)✓ Special purpose application infector

c) E-commerce
i)✓ is a type of business    ii) is a type of virus iii) Both (i) and (ii)            iv) None of the above

d) Which one is an example of unbound media?
i) UTP cable           ii)✓Microwave transmission                          iii) Fiber optic cable          iv) All of the above

5. Give appropriate technical terms for the
following:
a) Physical layout of LAN. Topology
b) A card through which a computer is connected to the network. NIC (Network Interface Card)
c) Network of networks. Internet
d) The moral principles that control cyber crime.
Computer ethics
6. Write the full form of:
a) SMTP : Simple Mail Transfer Protocol
b) NOS : Network Operating System
c) ISP : Internet Service Provider
d) ICT : Information and Communication Technology

Group B [Database Management]

7. Answer the following questions:

a) What is database?
Ans: Database is a collection of related and
organized information that can be used for
different purpose.

b) What is report? Write its importance.
Ans: Report is an object of database which
displays the output in an effective way to present the data in a printed format.
The importance of report is that it prints
documents according to user’s specifications of
the summarized information through query or
table.

c) What is Primary key?
Ans: Primary key is a field that uniquely
identifies the record which neither accepts
duplicate values nor null values.

8. Match the following.
a) MS-Access                    i) Data entry and                    editing interface.
b) Query ii) Electronic spreadsheet
c) Record iii) Tool to retrieve data
from one or more than one tables
d) Form iv) Database management
software
v) Collection of related
fields
Answers
a) MS-Access      👉  i) Database management
                                software
b) Query          👉         ii) Tool to retrieve data
                       from one or more than one tables
c) Record    👉    iii) Collection of related fields
d) Form    👉  iv) Data entry and editing interface.

9. Write whether the following statements are
true or false.
a) Table is not the data type of MS-Access. True
b) MS-Access is not a spreadsheet software. True
c) Index increases the speed of query and sort
operations. True
d) Primary key accepts null value. False

Group C [Programming]

10a) Define variable
Ans: The data item whose value changes
during the execution of a program is called
variable.

b) Name any two data types used in C language.
Ans: The name of any two data types sued in C
language are char and int

c) Write the functions of NAME and CLOSE
statements.
i) NAME : The NAME statement renames a
file on a diskette.
ii) CLOSE: The CLOSE statement closes one
or all open files.

11a. Re-write the given program after correcting the bugs:
DECLARE SUB FIBO ( )
CLS
EXECUTE FIBO
END
SUB FIBO
REM Program to generate 2, 2, 4, 6, 10…upto
10 th terms.
A=2
B=2
FOR Ctr = 5 TO 1
DISPLAY A; B;
A=A+B
B=A+B
NEXT Ctr
END FUNCTION
Debugged Program
DECLARE SUB FIBO ( )
CLS
CALL FIBO
END
SUB FIBO
REM Program to generate 2, 2, 4, 6, 10…upto
10 th terms.
A=2
B=2
FOR Ctr = 5 TO 1 STEP-1
PRINT A; B;
A=A+B
B=A+B
NEXT Ctr
END SUB

12. Write the output of the following program:
DECLARE FUNCTION test (N)
CLS
FOR Ctr = 1 TO 3
READ N
Sum = Sum + test (N)
NEXT Ctr
PRINT “The result=”; Sum
DATA 3, 2, 1
END
FUNCTION test (N)
Test = N^2
END FUNCTION
The output will be:
The result = 14

13. Study the following program and answer the
given questions:
DECLARE FUNCTION JPT (N)
FOR ctr = 1 TO 6
READ N
J = JPT (N)
Sum = Sum + J
NEXT ctr
PRINT Sum
DATA 10, 20, 30, 40, 50, 60
END
FUNCTION JPT (N)
IF N MOD 2 = 0 THEN JPT = N
END FUNCTION

a) What is name to the function used in the above
program?
Ans: The name of the function used in the
above program is JPT

b) How many times the function will be executed
in the above program?
Ans: The function will be executed six times.

14a) Write a program using FUNCTION …END
FUNCTION to calculate and display the volume of a cylinder. [Hint: volume of cylinder = PR2H]
DECLARE FUNCTION VOLUME (R)
CLS
INPUT “ENTER RADIUS”; R
PRINT “VOLUME OF SPHERE ”; VOLUME(R)
END
FUNCTION VOLUME (R)
VOLUME = (4 / 3) * 3.14 * R ^ 3
END FUNCTION

b) Write a program using SUB…END SUB to print
the first ten odd numbers.
DECLARE SUB DISPLAY ( )
CLS
CALL DISPLAY ( )
END
SUB DISPLAY ( )
A = 1
FOR I = 1 TO 10
PRINT A
A = A + 1
NEXT I
END SUB

c) A sequential data file called ‘Marks.dat’ has
stored data under the field heading Roll No.,
Name, English, Nepali and Maths. Write a
program to display all the information of those
students whose marks in Nepali is more than 50.
OPEN “Marks.dat’ FOR INPUT AS #1
CLS
WHILE NOT EOF (1)
INPUT #1, R, N$, E, NE, M
IF NE > 50 THEN PRINT N$, E, NE, M
WEND
CLOSE #1
END

QBasic programs for SEE

QBASIC PROGRAMS FOR SEE/SLC – SET 1 (FUNCTION AND SUB )

1. Write a program to calculate the volume of a cylinder using FUNCTION……END
   FUNCTION. [Hint: PI*R^2*H]
    Ans:
DECLARE FUNCTION VOL(R,H)
CLS
CONST PI=3.14
INPUT “Enter radius and height”; R, H
PRINT “The volume=”; VOL(R,H)
END
FUNCTION VOL(R,H)
V=PI*R^2*H
VOL=V
END FUNCTION

2. Write a program to test whether the given number is positive or negative using
SUB……END SUB.
Ans: DECLARE SUBTEST(N)
CLS
INPUT “Enter a number”; N
CALL TEST(N)
END
SUB TEST(N)
IF N>0 THEN
PRINT N; “is positive number”
ELSE
PRINT N; “is negative number”
END IF
END SUB

3. Write a program to print the following series: 1,4,7,……. up to 10th term using FUNCTION……END FUNCTION.
ANS :
DECLARE FUNCTION SERIES
CLS
D= SERIES
END
FUNCTION SERIES
FOR I = 1 TO 10
PRINT A;
A=A+3
NEXT I
END FUNCTION

4. Write a program which accepts any three different numbers and find the
maximum number among them using CALL statement.
Ans:
DECLARE SUB MAX(A,B,C)
CLS
INPUT “Enter any three number’; A,B,C
CALL MAX(A,B,C)
END
SUB MAX(A,B,C)
IF A>B AND A>C THEN
PRINT A; “is maximum number”
ELSEIF B>A AND B>C THEN
PRINT B; “is maximum number”
ELSE
PRINT C; “is maximum number”
END IF
END SUB

5. Write a program to display greater number among any two numbers using
FUNCTION……. END FUNCTION.
ANS :
DECLARE FUNCTION GREAT(A,B)
CLS
INPUT “Enter any two number”; A,B
PRINT “The greater number is”; GREAT(A,B)
END
FUNCTION GREAT(A,B)
IF A>B THEN
GREAT= A
ELSE
GREAT=B
END IF
END FUNCTION

6. Write a program to print the following series: 1, 8, 27, 64, …….. up to 10th terms
using SUB procedure
Ans:
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES
FOR I = 1 TO 10
PRINT I^3;
NEXT I
END SUB

7. Write a program to find the factorial number of any non-negative number using
FUNCTION…… END FUNCTION.
Ans:
DECLARE FUNCTION FACT(N)
CLS
INPUT “Enter a non-negative number”; N
PRINT “The factorial of given number is”; FACT(N)
END
FUNCTION FACT(N)
F=1
FOR I =1 TO N
F=F*I
NEXT I
FACT=F
END FUNCTION

8. Write a program to display the series 55555, 5555, 555, 55, 5 using
SUB………END SUB.
Ans:
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES
A#= 55555
FOR I = 1TO 5
PRINT A#;
A#=A#\10
NEXT I
END SUB

9. Write a program to display vowels and consonants of the entered string by using
FUNCTION …….. END FUNCTION.
Ans: DECLARE FUNCTION VOW(S$)
DECLARE FUNCTION CON(S$)
CLS
INPUT “Enter a word”; S$
VO= VOW(S$)
CO= CON(S$)
END
FUNCTION VOW(S$)
PRINT “The vowels are”
FOR I = 1 TO LEN(S$)
B$=MID$(S$,I,1)
C$=UCASE$(B$)
IF C$= “A” OR C$= “E” OR C$= “I” OR C$= “O” OR C$=”U” THEN PRINT B$
NEXT I
END FUNCTION
FUNCTION CON(S$)
PRINT “The consonant are”
FOR I = 1 TO LEN(S$)
B$=MID$(S$,I,1)
C$= UCASE$(B$)
IF C$<> “A” AND C$<> “E” AND C$<> “I” AND C$<> “O” AND C$<> “U” THEN PRINT
B$
NEXT I
END FUNCTION

10.Write a program to display the reverse of the entered number by using SUB…..
END SUB.
Ans: DECLARE SUB REV(N)
CLS
INPUT “Enter a number”; N
CALL REV(N)
END
SUB REV(N)
S=0
WHILE N<>0
R=N MOD 10
S=S*10+R
N=N\1
WEND
PRINT “The reversed form=”;S
END SUB

11. Write a program to declare a user defined function to return a given number
in reverse order by using FUNCTION…… END FUNCTION.
Ans:
DECLARE FUNCTION REV(N)
CLS
INPUT “Enter a number”; N
PRINT “The reverse form is”; REV(N)
END
FUNCTION REV(N)
S=0
WHILE N<>0
R=N MOD 10
S=S*10+R
N=N\10
WEND
REV=S
END FUNCTION

12 Write a program to declare a SUB procedure module to generate multiplication table of any non-negative number, where number is passed as a parameter by using SUB….. END SUB statement.
Ans: DECLARE SUB MUL(N)
CLS
INPUT “Enter a number”; N
CALL MUL(N)
END
SUB MUL(N)
FOR I = 1 TO 10
PRINT N; “*”;I; “=”; N*I
NEXT I
END SUB

13. Write a program to define a function procedure to display area of sphere where
user has to input the required data in the main module. [Hint: Area of sphere: 4*PI*R^2]
Ans:
DECLARE FUNTION AREA(R)
CLS
CONST PI= 3.14
INPUT “Enter radius”; RPRINT “The area of sphere=”; AREA(R)
END
FUNCTION AREA(R)
A=4*PI*R^2
AREA=A
END FUNCTION

14.Write a program to define SUB procedure to display the following series of
number: 1, 1, 2, 3, 5, …..up to 13thterm.
Ans:DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES
A=1
B=1
PRINT A;B;
FOR I =1 TO 11
C=A+B
PRINT C;
A=A+B
B=A+B
NEXT I
END SUB

15. Using user defined function, write a program to input monthly income in parameter then computer annual tax to be paid. The tax rate is 15% if annual income is above Rs. 200000, otherwise tax rate is 1%.
Ans:
DECLARE FUNCTION TAX(I)
CLS
INPUT “Enter monthly income”; I
PRINT “Tax to be paid=”; TAX(I)
END
FUNCTION TAX(I)
A=I*12
IF A>200000 THEN
TAX=15/100*A
ELSE
TAX=1/100*A
END IF
END FUNCTION

16. Write a program to generate the series using SUB …… END SUB : -10, -8, -6, -4, ………. Up to 20th term.
Ans:
DECLARE SUB SERIES()
CLS
CALL SERIES
END
SUB SERIES
A=-10
FOR I = 1 TO 20
PRINT A;
A=A+2
NEXT I
END SUB

17. Write a program using FUNCTION….END FUNCTION to calculate and print the
total surface area of a sphere.
Ans:
DECLARE FUNCTION TSA(R)
CLS
CONST PI=3.14
INPUT “Enter radius”; R
PRINT “The total surfacearea of sphere=”; TSA(R)
END
FUNCTION TSA(R)
T= 4*PI*R^2
TSA=T
END FUNCTION

18. Write a program to declare Sub procedure to print only the vowels from a given word.
Ans:
DECLARE SUB VOW(S$)
CLS
INPUT “Enter a word”; S$
CALL VOW(S$)
END
SUB VOW(S$)
PRINT “The vowels are”
FOR I = 1 TO LEN(S$)
B$=MID$(S$,I,1)
C$=UCASE$(B$)
IF C$= “A” OR C$= “E” OR C$= “I” OR C$= “O” OR C$=”U” THEN PRINT B$
NEXT I
END SUB

19. Write a program that asks any number and calculates its factors using a SUB procedure.
Ans:
DECLARE SUB FACT(N)
CLS
INPUT “Enter a number”; N
CALL FACT(N)
END
SUB FACT(N)
PRINT “The factors of”; N; “are”
FOR I = 1 TO N
IF N MOD I = 0 THEN PRINT I
NEXT I
END SUB

20. Write a program that asks any three numbers and displays the difference
between the greatest and the smallest value among the 3 supplied numbers using
FUNCTION procedure.
Ans:
DECLARE FUNCTION DIF(A,B,C)
CLS
INPUT “Enter three numbers”; A, B, C
PRINT “THE DIFFERENCE=”; DIF(A, B, C)
END
FUNCTION DIF (A, B, C)
G = 0
S = 0
IF A > B AND A > B THEN
G = A
ELSEIF B > A AND B > C THEN
G = B
ELSE
G = C
END IF
IF A < B AND A < C THEN
S = A
ELSEIF B < A AND B < C THEN
S = B
ELSE
S = C
END IF
DIF = G – S
END FUNCTION



QBASIC PROGRAMS For SLC/SEE Appearing Students – SET 2 |



21. Write a program to find area of four walls. Using Function Procedure:

DECLARE FUNCTION AREA(L,B,H)
CLS
INPUT “ENTER LENGTH” ; L
INPUT “ENTER BREADTH” ; B
INPUT “ENTER HEIGHT” ; H
PRINT “THE AREA OF FOUR WALLS= ” ; AREA(L,B,H)
END
FUNCTION AREA(L,B,H)
AREA=2*H*(L+B)
END FUNCTION
Using SUB Procedure
DECLARE SUB AREA(L,B,H)
CLS
INPUT “ENTER LENGTH” ; L
INPUT “ENTER BREADTH” ; B
INPUT “ENTER HEIGHT” ; H
CALL AREA(L,B,H)
END
SUB AREA(L,B,H)
A=2*H*(L+B)
PRINT “AREA IS “; A
END FUNCTION

22. Write a program to define a function procedure that returns simple interest.
Using FUNCTION Procedure :
DECLARE FUNCTION SI(P,T,R)
CLS
INPUT “ENTER PRINCIPLE” ; P
INPUT “ENTER TIME” ; T
INPUT “ENTER RATE” ; R
PRINT “SIMPLE INTEREST IS = ” ;SI(P,T,R)
END
FUNCTION SI(P,T,R)
SI=(P*T*R)/100
END FUNCTION
Using SUB Procedure :
DECLARE SUB SI(P,T,R)
CLS
INPUT “ENTER PRINCIPLE” ; P
INPUT “ENTER TIME” ; T
INPUT “ENTER RATE” ; R
CALL SI(P,T,R)
END
SUB SI(P,T,R)
I=(P*T*R)/100
PRINT “INTEREST IS ” ; I
END SUB

23. Write a program to convert the supplied Nepalese currency into its equivalent Indian currency.
Using FUNCTION Procedure :
DECLARE FUNCTION CONV(N)
CLS
INPUT “ENTER NEPALESE CURRENCY ” ; P
PRINT “INDIAN CURRRENCY = ” ;CONV(P)
END
FUNCTION CONV(P)
CONV=P/1.6
END FUNCTION

Using SUB Procedure:
DECLARE SUB CONV(N)
CLS
INPUT “ENTER NEPALESE CURRENCY ” ; P
CALL CONV(P)
END
SUB CONV(P)
C=P/1.6
PRINT “INDIAN CURRENCY “; C
END SUB

24. Write a program to check whether an input number is even or odd.

Using Function Procedure:
DECLARE FUNCTION CONV$(N)
CLS
INPUT “ENTER A NUMBER ” ; P
PRINT CONV$(P)
END
FUNCTION CONV$(P)
IF P MOD 2 = 0 THEN
CONV$=”EVEN NUMBER”
ELSE
CONV$=”ODD NUMBER”
ENDIF
END FUNCTION

Using SUB Procedure:
DECLARE SUB CONV(P)
CLS
INPUT “ENTER A NUMBER ” ; P
CALL CONV(P)
END
SUB CONV(P)
IF P MOD 2 = 0 THEN
PRINT “EVEN NUMBER”
ELSE
PRINT “ODD NUMBER”
ENDIF
END SUB

25. Write a program to check whether the input number is divisible by 4 and 6 or not.

Using Function Procedure:
DECLARE FUNCTION CHECK$(N)
CLS
INPUT “ENTER A NUMBER ” ; P
PRINT CHECK$(P)
END
FUNCTION CHECK$(P)
IF P MOD 4 =0 AND P MOD 6=0 THEN
CHECK$=”DIVISIBLE BY BOTH NUMBERS”
ELSE
CONV$=”NOT DIVISIBLE BY BOTH NUMBERS”
ENDIF
END FUNCTION
Using Sub Procedure:
DECLARE SUB CHECK(N)
CLS
INPUT “ENTER A NUMBER ” ; P
CALL CHECK(P)
END
SUB CHECK(P)
IF P MOD 4 =0 AND P MOD 6=0 THEN
PRINT “DIVISIBLE BY BOTH NUMBERS”
ELSE
PRINT “NOT DIVISIBLE BY BOTH NUMBERS”
ENDIF
END SUB

26. Write a program to calculate the square of all digits of input number.

Using Function Procedure:
DECLARE FUNCTION SQU(A)
CLS
INPUT “ENTER A NUMBER” ; N
PRINT SQU(N)
FUNCTION SQU(N)
WHILE N<>0
R=N MOD 10
S=R^2
PRINT S
N=N\10
WEND
END DUNCTION

Using Sub Procedure :
DECLARE SUB SQU(A)
CLS
INPUT “ENTER A NUMBER” ; N
CALL SQU(N)
END
SUB SQU(N)
WHILE N<>0
R=N MOD 10
S=R^2
PRINT S
N=N\10
WEND
END SUB

27. Write a program to calculate the circumference of circle.

Using Function Procedure:
DECLARE FUNCTION CIR(A)
CLS
INPUT “ENTER RADIUS OF A CIRCLE”; R
PRINT “CIRCUMFERENCE IS” ; CIR(R)
END
FUNCTION CIR(A)
P=3.14
CIR=2*P*A
END FUNCTION

Using SUB Procedure:
DECLARE SUB CIR(A)
CLS
INPUT “ENTER RADIUS OF A CIRCLE”; R
CALL CIR(R)
END
SUB CIR(A)
P=3.14
C=2*P*A
PRINT “CIRCUMFERENCE IS ” ; C
END SUB

28. Write a program to display the reverse of input string .

Using Function Procedure:
DECLARE FUNCTION REV$(N$)
CLS
INPUT “ENTER A STRING” ; W$
PRINT “REVERSED STRING::”;REV$(W$)
END
FUNCTION REV$(N$)
FOR I = LEN(N$) TO 1 STEP -1
D$=D$+MID$(N$,I,1)
NEXT I
REV$=D$
END FUNCTION

Using SUB Procedure:
DECLARE SUB REV(N$)
CLS
INPUT “ENTER A WORD” ; W$
CALL REV(W$)
END
SUB REV(N$)
FOR I = LEN(N$) TO 1 STEP-1
C$=C$+MID$(N$,I,1)
NEXT I
PRINT “REVERSED STRING” ; C$
END SUB

9. Write a program that accepts three different numbers and returns
the smallest one.

Using Function Procedure:
DECLARE FUNCTION SMALL(A,B,C)
CLS
INPUT “ENTER FIRST NUBER” ; A
INPUT “ENTER SECOND NUMBER” ; B
INPUT “ENTER THIRD NUMBER” ; C
PRINT “THE SMALLEST NUMBER IS” ; SMALL(A,B,C)
FUNCTION SMALL(A,B,C)
IF A<B AND B<C THEN
SMALL=A
ELSE IF B<A AND A<C THEN
SMALL=B
ELSE
SMALL=C
END FUNCTION

Using SUB Procedure:
DECLARE SUB SMALL(A,B,C)
CLS
INPUT “ENTER FIRST NUBER” ; A
INPUT “ENTER SECOND NUMBER” ; B
INPUT “ENTER THIRD NUMBER” ; C
CALL SMALL(A,B,C)
FUNCTION SMALL(A,B,C)
IF A<B AND B<C THEN
PRINT “SMALLEST” ; A
ELSE IF B<A AND A<C THEN
PRINT “SMALLEST” ; B
ELSE
PRINT “SMALLEST” ; C
END SUB

10. WAP to find whether the first character of the input string is avnumber, an uppercase or lowercase character or none of them.

Using Function Procedure:
DECLARE FUNCTION CHTR$(A$)
CLS
INPUT “ENTER A STRING” ; C$
PRINT CHTR$(C$)
END
FUNCTION CHTR$(A$)
D$=LEFT$(A$)
A=ASC(D$)
IF A>=65 AND A<=90 THEN
CHTR$=”FIRST LETTERIS UPPERCASE LETTER”
ELSEIF A>=97 AND A<=122 THEN
CHTR$=”FIRST LETTER IS LOWERCASE”
ELSEIF A>=48 AND A<=57 THEN
CHTR$=”FIRST LETTER IS NUMBER”
ELSE
CHTR$=”NONE OF THEM”
END FUNCTION

Using SUB Procedure:
DECLARE SUB CHTR(A$)
CLS
INPUT “ENTER A STRING” ; C$
CALL CHTR(C$)
END
SUB CHTR(A$)
D$=LEFT$(A$)
A=ASC(D$)
IF A>=65 AND A<=90 THEN
PRINT “FIRST LETTER IS UPPERCASE LETTER”
ELSEIF A>=97 AND A<=122 THEN
PRINT “FIRST LETTER IS LOWERCASE”
ELSEIF A>=48 AND A<=57 THEN
PRINT “FIRST LETTER IS NUMBER”
ELSE
PRINT “NONE OF THEM”
END SUB

QBASIC Programs SET-3 [SUB and FUNCTION]

31.Write a program to display the reverse of input string .
Using Function Procedure.
DECLARE FUNCTION REV$(N$)CLS
INPUT “ENTER A STRING” ; W$
PRINT “REVERSED STRING::”;REV$(W$)
END
FUNCTION REV$(N$)
FOR I = LEN(N$) TO 1 STEP -1
D$=D$+MID$(N$,I,1)
NEXT I
REV$=D$
END FUNCTION

Using SUB Procedure
DECLARE SUB REV(N$)
CLS
INPUT “ENTER A WORD” ; W$
CALL REV(W$)
END
SUB REV(N$)
FOR I = LEN(N$) TO 1 STEP-1
C$=C$+MID$(N$,I,1)
NEXT I
PRINT “REVERSED STRING” ; C$
END SUB

32. write a program to check whether the entered number is prime or composite.

using sub procedure
DECLARE SUB PRIME (N)
INPUT “ENTER ANY NUMBER”; N
CALL PRIME (N)
END
SUB PRIME (N)
C = 0
FOR I = 1 TO N
IF N MOD I = 0 THEN C = C + 1
NEXT I
IF C = 2 THEN
PRINT N; “IS PRIME NUMBER”
ELSE
PRINT N; “IS COMPOSITE NUMBER”
END IF
END SUB

Using function procedure
DECLARE FUNCTION PRIME(N)
CLS
INPUT “ENTER ANY NUMBER”; N
P = PRIME (N)
IF P = 2 THEN
PRINT N; “IS PRIME NUMBER”
ELSE
PRINT N; “IS COMPOSITE NUMBER”
END IF
END
FUNCTION PRIME (N)
C = 0
FOR I = 1 TO N
IF N MOD I = 0 THEN C = C + 1
NEXT I
PRIME = C
END FUNCTION

33.write a program to check input number is Armstrong or not?

USING SUB PROCEDURE
DECLARE SUB ARM (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL ARM (N)
END
SUB ARM (N)
A = N
S = 0
WHILE N < > 0
R = N MOD 10
S = S + R ^ 3
N = N \ 10
WEND
IF A = S THEN
PRINT A; “IS ARMSTRONG NUMBER”
ELSE
PRINT A; “IS NOT ARMSTRONG NUMBER”
END IF
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION ARM (N)
CLS
INPUT “ENTER ANY NUMBER”; N
A=N
AR = ARM (N)
IF A = AR THEN
PRINT A; “IS ARMSTRONG NUMBER”
ELSE
PRINT A; “IS NOT ARMSTRONG NUMBER”
END IF
END
FUNCTION ARM (N)
S = 0
WHILE N < > 0
R = N MOD 10
S = S + R ^ 3
N = N \ 10
WEND
ARM = S
END FUNCTION

34.write a program to find the area of square.

USING SUB PROCEDURE
DECLARE SUB AREA (L)
CLS
INPUT “ENTER LENGTH”; L
CALL AREA(L)
END
SUB AREA (L)
A = L ^ 2
PRINT “AREA OF SQUARE”; A
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION AREA (L)
CLS
INPUT “ENTER LENGTH”; L
AR = AREA(L)
PRINT “AREA OF SQUARE ”; AR
END
FUNCTION AREA (L)
A = L ^ 2
AREA = A
END FUNCTION

35.write a program to input a string and count the total numbers of vowels.

USING SUB PROCEDURE
DECLARE SUB COUNT (S$)
CLS
INPUT “ENTER ANY STRING”; S$
CALL COUNT(S$)
END
SUB COUNT (S$)
VC = 0
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = “A” OR C$ = “E” OR C$ = “I” OR C$ = “O” OR C$ = “U” THEN
VC = VC + 1
END IF
NEXT I
PRINT “TOTAL NO. OF VOWELS= “; VC
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION COUNT (S$)
CLS
INPUT “ENTER ANY STRING”; S$
PRINT “TOTAL NO. OF VOWELS= “; COUNT(S$)
END
FUNCTION COUNT (S$)
VC = 0
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = “A” OR C$ = “E” OR C$ = “I” OR C$ = “O” OR C$ = “U” THEN
VC = VC + 1
END IF
NEXT I
COUNT = VC
END FUNCTION

36.write a program to input a string and display only vowels.

USING SUB PROCEDURE
DECLARE SUB DISPV (S$)
CLS
INPUT “ENTER ANY STRING”; S$
CALL DISPV(S$)
END
SUB DISPV(S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = “A” OR C$ = “E” OR C$ = “I” OR C$ = “O” OR C$ = “U” THEN
PRINT B$
END IF
NEXT I
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION DISPV (S$)
CLS
INPUT “ENTER ANY STRING”; S$
VC = DISPV(S$)
END
FUNCTION DISPV(S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = “A” OR C$ = “E” OR C$ = “I” OR C$ = “O” OR C$ = “U” THEN
PRINT B$
END IF
NEXT I
END FUNCTION

37.write a program to input string and display only consonants.

USING SUB PROCEDURE
DECLARE SUB DISPC (S$)
CLS
INPUT “ENTER ANY STRING”; S$
CALL DISPC(S$)
END
SUB DISPC(S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ <> “A” AND C$ <> “E” AND C$ <> “I” AND C$ <> “O”
AND C$ <> “U” AND C$ <> ” ” AND C$ <> “.” THEN
PRINT B$
END IF
NEXT I
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION DISPC (S$)
CLS
INPUT “ENTER ANY STRING”; S$
CC = DISPC(S$)
END
FUNCTION DISPC(S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ <> “A” AND C$ <> “E” AND C$ <> “I” AND C$ <> “O”
AND C$ <> “U” AND C$ <> ” ” AND C$ <> “.” THEN
PRINT B$
END IF
NEXT I
END FUNCTION

38. write a program to check whether the input number is positive, negative or zero.

USING SUB PROCEDURE
DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END
SUB CHECK (N)
IF N > 0 THEN
PRINT N; IS POSITIVE NUMBER”
ELSEIF N < 0 THEN
PRINT N; IS NEGATIVE NUMBER”
ELSE
PRINT N; IS ZERO”
END IF
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “ENTER ANY NUMBER”; N
PRINT N; “IS “; CHECK$(N)
END
FUNCTION CHECK$ (N)
IF N > 0 THEN
CHECK$ = “POSITIVE NUMBER”
ELSEIF N < 0 THEN
CHECK$ = “NEGATIVE NUMBER”
ELSE
CHECK$ = “ZERO”
END IF
END FUNCTION

39.write a program to print string in alternate capita .eg.CoMpUtEr

USING SUB PROCEDURE
DECLARE SUB ALTERNATE (A$)
INPUT “ENTER STRING”; A$
END
SUB ALTERNATE (A$)
FOR I= 1 TO LEN (A$)
B$= MID (A$, I, 1)
IF I MOD 2 = 0 THEN
B$= LCASE$ (B$)
ELSE
B$ = UCASE (B$)
END IF
ALT$ = ALT$ +B$
NEXT I “THE REQUIRED ALTERNATE IS” ;ALT$
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION ALTERNATE$ (A$)
CLS
INPUT “ENTER STING”; A$
PRINT “THE REQUIRED ALTERNATE IS”; ALTERNATE$ (A$)
END
FUNCTION ALTERNATE$ (A$)
FOR I = 1 TO LEM (A$)
B$ = MID$ (A$, I, 1)
IF I MOD 2 = 0 THEN
B$= LCASE$(B$)
ELSE
B$ = UCASE$ (B$)
END IF
ALT$ =ALT$ +B$
NEXT I
ALTERNATE$= ALT$
PRINT “THE REQUIRED ALTERNATE IS”; ALT$
END FUNCTION

40.write a program that prints the sum of even digits.

USING SUB PROCEDURE
DECLARE SUB SUMEVEN (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL SUMEVEN (N)
END
SUB SUMEVEN (N)
S = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 0 THEN S = S + R
N = N \ 10
WEND
PRINT “SUM OF EVEN DIGITS”; S
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION SUMEVEN (N)
CLS
INPUT “ENTER ANY NUMBER”; N
SU = SUMEVEN (N)
PRINT “SUM OF EVEN DIGITS”; SU
END
FUNCTION SUMEVEN (N)
S = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 0 THEN S = S + R
N = N \ 10
WEND
SUMEVEN = S
END FUNCTION

41.write a program to convert the temperature given in the centigrade to farenhiet.
(9C +160/5)

USING SUB PROCEDURE
DECLARE SUB CONVERT (C)
CLS
INPUT “ENTER TEMPERATURE IN CELCIUS”; C
CALL CONVERT (C)
END
SUB CONVERT (C)
F = C * (9 / 5) + 160
PRINT “TEMPERATURE IN FARENHEIT=”; F
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION CONVERT (C)
CLS
INPUT “ENTER TEMPERATURE IN CELSIUS”; C
PRINT “TEMPERATURE IN FAHRENHEIT=”; CONVERT (C)
END
FUNCTION CONVERT (C)
F = C * (9 / 5) + 160
CONVERT = F
END FUNCTION

42.write a program to find the perimeter of the rectangle.2(l+b)

USING SUB PROCEDURE
DECLARE SUB PERIMETER (L, B)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
CALL PERIMETER(L, B)
END
SUB PERIMETER (L, B)
P = 2 * (L + B)
PRINT “PERIMETER OF RECTANGLE ”; P
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION PERIMETER (L, B)
CLS
INPUT “ENTER LENGTH”; L
INPUT “ENTER BREADTH”; B
PR = PERIMETER(L, B)
PRINT “PERIMETER OF RECTANGLE ”; PR
END
FUNCTION PERIMETER (L, B)
P = 2 * (L + B)
PERIMETER = P
END FUNCTION

SLC Computer Science 2070 Solved

SLC 2070 (Solved)
Computer Fundamental (22 marks)

1. Answer the following questions: 2×5=10

1. a) What is network topology? Write any one
advantage of star topology.
Ans: A network topology is the arrangement of computers, cable and other components on a network. Any one advantage of star topology is:
i) Easy to add new computer and remove existing one. So, it is flexible.

b) Give any two advantages of E-mail over traditional mail.
Ans: Any two advantages of E-mail over traditional mail are
i) It is the cheapest and fastest means of communication
as compared to our conventional postal mail.
ii) Email can be accessed from any part of the world and at any time.

c) List any two main aims of formulating cyber law in Nepal.
Ans: The two main aims of formulating cyber law in Nepal are:
i) To legalize the transaction through electronic media to control various types of electronic frauds
ii) To punish a person who does criminal activities through electronic means especially on computers.

d) Give any two symptoms of virus attack.
Ans: The two symptoms of virus attacks are:
i) Increased use of disk space and growth in file size
ii) Computer system slows down, files disappear.

e) Give the importance of UPS to the computer system.
Ans: The importance of UPS in computer security system is that it controls fluctuation of electric voltage and provides enough backup electric power to the computer system in the event of power failure of the source which
protects the computer system and our valuable data.

a) Convert as instructed: 0.5×2=1
i) (BED)₁₆ into binary
Converting Hexadecimal to Binary equivalent value
   B                        E                              D
1011                  1110                        1101
Thus, (BED)₁₆ = (101111101101)₂
ii) (1010111)₂ into octal
Converting Binary to Octal equivalent value
Making group of three bits from extreme right
001                010                 111
Octal equivalent 1 2 7
Thus, (1010111)₂ =(127)₈

b) Perform the binary calculations 0.5×2=1
i)              1010 *10
                  1 0 1 0
                      * 1 0
                 _________
                   0 0 0 0
              +1 0 1 0
             ____________
                1 0 1 0 0

ii) 10101 / 11
11) 10101 ( 111
        -11
_________
         100
        – 11
__________
              11
             -11
____________
                 0

Q = 111
R = 0

3. Match the following 0.5×4=2
Group A                                      Group B
i) Combination of several media a) Guided Media
ii) POP                         b) Power Protection Device
iii) UTP                         c) Multimedia
iv) UPS                         d) Protocol used in e-mail
                                      e) CD-ROM
Solution:
Group A                                                Group B
i) Combination of several media     a) Multimedia
ii) POP                           b) Protocol used in e-mail
iii) UTP                        c) Guided Media
iv) UPS                       d ) Power Protection Device

4. Choose the correct answer 0.5×4=2

a) Which of the following is an audio output device?
i) Microphone  ii)✓Speaker iii) Monitor iv) Printer

b) Which one is not a type of virus?
i) Message Carrying virus ii) Boot sector virus
iii)System virus
iv) Special Purpose Application Infector

c) Which one is bounded media?
i) ✓Fibre optics           ii) Microwave            
  iii) Infrared              iv)Laser

d) Which one is an operating system software?
i) MS-Word ii)MS-Excel    iii)Firefox iv)✓MS-DOS

5. Give an appropriate technical term for the
following. 0.5×4=2
a) A program that can disinfect a file from virus
[Antivirus Software]
b) A person who steals or destroys other’s data,
information and program [Hacker ]
c) A company that provides internet service   
       [ ISP (Internet Service Provider) ]
d) A computer in a network which can provide services to other computer. [Server]

6 . Write the full forms of: 0.5×4=2
a) TCP/IP = Transmission Control Protocol /   Internet Protocol
b) LAN       = Local Area Network
c) UPS = Uninterruptible Power Supply
d) FTP        = File Transfer Protocol

Group B
Database (10 marks)

7. Answer the following:                      2×3=6

a) Define data and information.
Ans: Data can be numbers, letters or symbols
representing facts and figures which may or may not give any meaning.
Information is an organized collection of related data which gives a complete meaning.

b) What is report? Give its importance.
Ans: Report is an object of database which displays the output in an effective way to present the data in a printed format.
The importance of report are:
i) It displays the information the way we want to view it.
ii) It presents the information in designed layouts by adding necessary titles, setting font colour or font size, etc.

c) Name any four data types that can be defined in MS-Access.
Ans: Any four data types that can be defined in MS-Access are:
i) Text    ii) Memo    iii) Number    iv) Date/time

8. Choose the best answer. 0.5×4=2
a) The columns in database tables are called:
i) Record ii)✓Field iii) Report iv) Memo
b) Which is suitable data type to store video?
i) Text  ii) Number   iii) Hyperlink  iv)✓OLE object
c) Text data type can store maximum of ___ characters
i) 250       ii) 350              iii)✓ 255      iv) 355
d) Which of the following is database application?
i) MS-Word      ii) ✓MS-Access
iii) MS-Excel    iv) QBASIC

9. Match the following 0.5×4=2
Group A                                      Group B
i) Indexing Data                a) Size upto 1 GB
ii) Form                             b) Column of datasheet
iii) Field                             c) Row on a datasheet
iv) OLE object                   d) Searching Fast
                      e) Graphical interface for data entry
Ans:
Group A                                  Group B
i) Indexing Data            a) Searching Fast
ii) Form         b) Graphical interface for data entry
iii) Field                      c) Column of datasheet
iv) OLE object                         d) Size upto 1 GB

Group C
Programming (18 marks)

a) What is a variable?
Ans: Variable are the data item whose value may change during the execution of a program.

b) Name any two data types used in C language.
Ans: Any two data types used in C language are:
i) int                  ii) float

c) Give the functions of:     0.5×2=1
Ans:     i) NAME AS : The NAME statement renames a file on a disk.
ii) CLOSE : The CLOSE statement is used to close one or all open files.

11. Rewrite the following program after correcting the bugs:       2
DECLARE SUB Series(.)
DLC
EXECUTE Series
END
SUB Series
REM to generate 2 2 4 6 10….. upto 10th term
P=2
Q=2
FOR Ctr=1 TO 5
DISPLAY P,Q,
P=P+Q
Q=P+Q
WEND
END Series()
Debugged Program
DECLARE SUB Series( )
CLS
CALL Series
END
SUB Series
REM to generate 2 2 4 6 10….. upto 10th term
P=2
Q=2
FOR Ctr=1 TO 5
PRINT P,Q,
P=P+Q
Q=P+Q
NEXT Ctr
END SUB

12. Write the output of the following program.
DECLARE FUNCTION AREA(L,B)
LET L=10
LET B=5
PRINT “The area = ”; AREA(L,B)
END
FUNCTION AREA(L,B)
A=L*B
AREA=A
END FUNCTION
OUTPUT: The area = 50

13. Study the following program and answer the
questions: 1 ×2=2
DECLARE FUNCTION Sum(A,B)
INPUT “Enter first number:”; A
INPUT “Enter second number:”; B
PRINT “The sum of the two number=”;Sum(A,B)
END
FUNCTION SUM(A,B)
S=A+B
Sum=S
END FUNCTION

a) List the numerical variables used in the above
program.
Ans: The numerical variables used in the above program are A, B and S.

b) Will the program run if the first line (i.e. DECLARE….) is deleted?
Ans: Yes, the program will run even if the first line (i.e. DECLARE…) is deleted.

14. a) Write a program using Function…..End Function to get temperature in Celsius from the user and then print the temperature in Fahrenheit.(hint: F=9C/5+32).       3
DECLARE FUNCTION TEMP (C)
CLS
INPUT “ENTER TEMPERATURE IN CELCIUS”; C
PRINT “TEMPERATURE IN FAHRENHEIT=”; TEMP (C)
END
FUNCTION TEMP (C)
F = 9 * C / 5 + 32
TEMP = F
END FUNCTION

b) Write a program using Sub….End Sub to get a word from the user and then print it in reverse order.                                         3
DECLARE SUB REVERSE (N$)
CLS
INPUT “ENTER ANY STRING”; N$
CALL REVERSE(N$)
END
SUB REVERSE (N$)
FOR I = 1 TO LEN(N$)
B$ = MID$(S$, I, 1) + B$
NEXT I
PRINT “REVERSED STRING IS “; B$
END SUB

c) A sequential data file called “Marks.dat” contains Name, English, Nepali, Maths and Science Fields. Write a program to display all the contents of that data file. 3
OPEN “Marks.dat” FOR INPUT AS #1
CLS
PRINT “NAME”, “ENGLISH”, “NEPALI”, “MATHS”,
SCIENCE”
DO WHILE NOT EOF(1)
INPUT #1, N$, E, N, M, S
PRINT N$, E, N, M, S
LOOP
CLOSE #1
END

SEE Computer Science 2072 Solved

SLC 2072 COMPUTER SCIENCE SOLVED PAPER

Group – A
(Computer fundamentals)

1. Answer the following questions.

1. a)  Define LAN topology. Draw star topology.
Ans: The arrangement or connection pattern of nodes or computers and other devices of the network is called LAN topology.

1. b)  Give any two symptoms of virus attacks.
Ans: The symptoms of virus attacks are:
i)   Program takes more time to load, fail to load
or hang frequently.
ii) Unexpected messages or images appear
suddenly on the screen.
1. c) Write one advantage and one disadvantage of multimedia.
Ans: The advantage of multimedia is:
i)     One can present ideas, information to
others in effective ways.
The disadvantage of multimedia is:
i)    The cost of developing a multimedia product
is high.

1. d) Write any two ways of protecting computer
software.
Ans: The two ways of protecting computer software are:
i)Antivirus Software
ii)Backup System

1. e)      Write any two services of internet.
Ans: The two services of internet are:
i) WWW (World Wide Web)
ii)E-mail

2. a)Convert as indicated:
i)(208)₁₀ into Binary
Converting decimal to binary,
2          208                 0
2          104                 0
2           52                  0
2            26                 0
2            13                 1
2             6                  0 
2             3                  1
               1
(208)₁₀=(11010000)₂

ii)(104)₈ into decimal
Converting octal to decimal,
=1*8²+0*8¹+4*8⁰
=1*64+0*8+4*1
=64+0+4
=68
(104)₈=(68)₁₀

1. b) Perform the binary calculations:
i)1011+1101
     1011
   +1101
_________
   11000

1011+1101=11000

ii)110*11

     110
     *11
________
     110
+ 110
________
10010
✓110*11=10010

3. Match the following:
Answers:
1. a)  Microwave : Unguided media
2. b)  UTP :  Guided media
3. c)  UPS : Power protection device
4. d) SMTP :    Protocol

4. State whether the following statements are true or false:
5. a) Walky-talky is an example of full duplex mode.
Ans: False
1. b) Data transfer rate is higher in optical fiber
cable than in co-axial cable.
Ans: True
1. c) The computer security refers to hardware
security only.
Ans: False
1. d) Sound Card is one of the components of
multimedia.
Ans: True

5. Write the appropriate technical terms of the
following:
a)  A program that can disinfect a file from virus.
Ans: Antivirus software
b) A person who steals or destroys other’s data, information, files and program.
Ans: Hacker
c) A company which provides the internet facilities.
Ans: ISP (Internet Service Provider)
d) A computer which provides services to other computers in a network.
Ans: Server Computer

6. Write the full forms of:
i)URL : Uniform Resource Locator
ii)HTTP : HyperText Transfer Protocol
iii)LAN :Local Area Network
iv)MODEM :Modulator-Demodulator

Group – B
(Database)

7. Answer the following questions:

a)      Write any four data types used in Ms-
ACCESS.
Ans: Four data types used in Ms-ACCESS are:
i)     Text ii)   Number iii) Currency
iv) Date/Time

b)      Define database with example.
Ans: The systematic collection of organized and related information that can be used for different purposes is called database. For example: dictionary and telephone directory.

c)      What is query?
Ans: A query is one of the objects of MS-Access that allows us to retrieve the desired information from a table or multiple linked tables.

8. State whether the following statements are true or false:
a) A query is used to select fields and records
from only one table.
Ans: False
b)      MS-ACCESS is DBMS software.
Ans: True
c)      Index decreases the speed of query and
sort operations.
Ans: False
d)     Data in primary key has to be unique and
not null.
Ans: True

9. Match the following:
a)      OLE                    : Data type
b)      Validation Rule : Limits the value
c)      Form                  : Data Entry
d)     Indexing              :  Easy to search

Group – C
( Programming)

10. a) What is procedure?

Ans: The separate block of statements used by the module level code and called by any number of times is called procedure.

b) Write any two data types used in ‘c’ language.
Ans: The two data types used in the ‘c” language are:
1. i)     int ii)      float

c) Write down the functions of the following
statements:
i) OPEN: It opens a sequential file for one of the
three possible operations i.e. reading, writing or
appending.
ii) MKDIR: It makes or creates a new directory on
the specified disk.

11. Re-write the following program after correcting the bugs:
FUNCTION SUM(m,n)
Rem to print sum of two numbers
a=6
b=7
DISPLAY SUM(a,b)
END
FUNCTION SUM(m,n)
S=m+n
S=SUM
END SUM
Debugged program:
DECLARE FUNCTION SUM(m,n)
Rem to print sum of two numbers
a=6
b=7
PRINT SUM(a,b)
END
FUNCTION SUM(m,n)
S=m+n
SUM=S
END FUNCTION

12. Write the output of the following program:
DECLARE FUNCTION Interest(p,t,r)
CLS
LET p=100
LET t=2
LET r=5
LET d=Interest(p,t,r)
PRINT “The simple interest=”;d
END
[possible missing code………]
FUNCTION Interest (p,t,r)
Interest=(p*t*r)/100
End FUNCTION

OUTPUT
If the sub module is missing then error message will be
displayed.
Otherwise : The Output will be:
The simple interest = 10

13. Study the following program and answer the
following questions:
DECLARE FUNCTION Prod(N)
INPUT “Any number”;N
X=Prod(N)
PRINT X
END
FUNCTION Prod(N)
F=1
FOR K=1 TO N
F=F*K
NEXT K
Prod=F
END FUNCTION

a)      Write the name of the user defined
function used in the above program.
Ans: The name of the user defined function used in the
above program is Prod.
b)       Name the loop in the above program.
Ans: The loop in the above program is FOR…NEXT.

14. a) Write a program using SUB…..END SUB to
display reverse of input-string.
DECLARE SUB REV(A$)
CLS
INPUT “ENTER ANY STRING”;A$
CALL REV(A$)
END
SUB REV(A$)
FOR I= 1 TO LEN(A$)
B$=MID$(A$,I,1)
W$=B$+W$
NEXT I
PRINT “REVERSED STRING=”W$
END SUB

b) Write a program using FUNCTION…END
FUNCTION to find area of the triangle.
DECLARE FUNCTION AREA(B,H)
CLS
INPUT “ENTER BASE”;B
INPUT “ENTER HEIGHT”;H
PRINT “AREA OF TRIANGLE”;AREA(B,H)
END
FUNCTION AREA(B,H)
AREA=0.5*B*H
END FUNCTION

c)      A sequential data file called “Marks.dat”
contains NAME, AGE, CITY, and TELEPHONE
fields. Write a program to display all the contents of the data file.
OPEN “Marks.dat” FOR INPUT AS #1
CLS
DO WHILE NOT EOF(1)
INPUT #1, N$, A, C$, T#
PRINT N$, A, C$, T#
LOOP
CLOSE #1
END

SEE Computer Science 2071 Solved

Answer the following questions:

a. Give two-two difference between peer-to-peer and client/server network architecture.
Ans:These are the differences between peer-to peer and client/server network architecture:
Peer-to peer
Client/server

1.The type of network architecture in which all the connected computers acts as both client and server is known as Peer-to-Peer network architecture.
1.The type of network architecture in which all other computers in a network known as clients are handled or controlled by a single computer known as server is known as Client/Server.

2. It doesn’t have centralized server.
2. It contains a separate centralized server.

3. It is expensive to setup and less secure.
3. It is cheaper to setup and more secure.

b. What is the function of file transfer protocol (FTP)?
Ans:The functions of File Transfer Protocol(FTP) are:
i.It enables the downloading and uploading of files into the internet.
ii.It manages the interaction between the computers on internet.

c. What is cyber crime? Give any two examples.
Ans: The crimes done through the misuse of computers, network and internet is known as
cyber crime. The two examples of cyber crime are:
i. Hacking
ii. Phishing

d. Write any four preventive measures for computer hardware security.
Ans:Any four Preventive measures for solving Hardware security problems are:
i. Insurance
ii. Regular maintenance
iii.Protection from dusts.
iv.Use of Power protection device

e. Write any two medium for transmission of computer virus.
Ans: Any two mediums for transmission of computer virus are:
i. Downloading of malicious files through internet and use of corrupted files.
ii. Sharing infected files through portable storage devices like pen drives.

2. a.Convert as indicated:
i.(108)₁₀ into binary
Ans:
Do your self.......

      (108)₁₀= (1101100)₂

ii. (765)₈
into decimal

Ans:
(765)8=7×8²+6×8¹+5×8⁰
=448+48+5
=(501)₁₀
∴               (765)₈=(501)₁₀

b.Perform the following binary calculations:
i. 111*11
Ans:
        111
        *11
̅̅̅        ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅
        111
   +1110
̅   ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅ ̅
    10101
∴   111*11=10101

ii. Divide 1101 by 11
Ans:

11 ) 1101 (100
        -11
       _____
         00   
          -0
      ______
           01

∴  Quotient=100
∴  Remainder=01

3. Match the following:
i. E-commerce                Power protection device
ii. Volt guard                    online shopping
iii. Satellite link                WAN
ivSound card                    Optical fiber
                                           Multimedia
Ans:
E-commerce – Online shopping
Volt guard – Power protection device
Satellite link – WAN
Sound card – Multimedia

4. Choose the best answer:
a. Which of the following is remote login service?
i.Video conferencing ii.FTP  iii.Telnet  iv.TCP/IP
Ans: Telnet
b. Process of arranging the scattered parts of file into a contiguous manner is _______.
i. debugging              ii.Backup            iii.Defragmentation           iv.Scandisk
Ans: Defragmentation
c. Which of the following is an audio input device?
i. Printer           ii. Microphone           iii. Head phone           iv. Speaker
Ans: Microphone
d. Virus is a type of ___________.
i. System program       ii. Package program        iii. Destructive program        iv. Web program
Ans: destructive program

5. Technical terms:
a. The data carrying capacity of communication channel.
Ans: Bandwidth
b. The moral principles that control cybercrime.
Ans: Computer ethics
c. Buying and selling product and services online.
Ans: E-commerce
d. An integration of text, audio, graphics and video.
Ans: Multimedia

Write down the full forms:
LAN :     Local Area Network
VOIP :    Voice Over Internet Protocol
Gbps :    Giga bits per second
DVD :      Digital Versatile Disk

6. Answer the following question:
a. Write any two advantages of computerized database.
Ans: The two advantages of computerized database are:
i. Larged volume of data can be stored in managed and systematic way.
ii. Retrieving of data is also easy due to data sorting and indexing.

b. Name any four objects of MS-Access database.
Ans: The four object of MS-Access are:
Table
Form
Query
Report

c. What is data sorting?
Ans: The method of arranging and grouping the data in ascending or in descending order in
a database is known as data sorting.

7. State whether the following are true or false:
Graphics can also be stored in MS-Access database. True
Maximum field size of memo field is 256 characters. False
A form is an object of MS-Access used for entering data. True
An action query makes changes in a table. True

8. Match the following:
Indexing data                                       Final output
Report                                                   View data
Yes/No                                                   Searching fast
Select query                                           Picture
                                                                 Data type
Ans:
Indexing data – Searching fast
Report – Final output
Yes/No – Data type
Select query – View data

9. Answer the following:
a. Mention the types of procedures used in QBasic.
Ans: The types of procedure used in QBasic are:
Sub procedure
Function procedure

b. Write two characteristics of C language.
Ans: The two characteristics of C language are:
i. It can be used for making large and powerful programmes.
ii. It’s easy for programming since it is a High Level Programming Language.

c. Write down the function of:
SHARED
Ans: The function of SHARED is to declare a variable globally.
CALL
Ans: The function of CALL statement is to call sub procedure for performing specific task.

9. Re-write the following correcting the bugs:
DECLARE SUB CUBE(N)
CLS
FOR I = 1 TO 5
READ
CALL CUBE(No)
NEXT X
DATA 3, 5, 2, 6, 4
END
SUB CUBE( )
DISPLAY N^3
END SUB
Ans:
DECLARE SUB CUBE(N)
CLS
FOR I = 1 TO 5
READ No
CALL CUBE(No)
NEXT I
DATA 3, 5, 2, 6, 4
END
SUB CUBE(N)
PRINT N^3
END SUB

10. Write down the output:
DECLARE FUNCTION AVGE(A,B,C)
X=10
Y=5
Z=15
AV= AVGE(X,Y,Z)
RPINT “Average of three numbers”; AV
END
FUNCTION AVGE(A, B, C)
S=A+B+C
AVGE = S/3
END FUNCTION
Ans:
Average of three numbers 10
The output of the above programme is:

11. Study the following program and answer the following:
DECLARE SUB Stde(N$U)
FOR Loop = 1 TO 5
READ NM$(Loop)
NEXT Loop
DATA RAMA, PRATIMA, PRASANT
DATA NISHA, RUDHRA
CALL Stde(NM$U)
END
SUB Stde(N$U)
PRINT “Name starting from P”
FOR J = 1 TO 5
C$=MID$(N$,(J),1,1)
IF C$=”P” THEN
PRINT N$(J)
END IF
NEXT J
END SUB

a. List the library function used in the above program.
Ans: The library function used in the above program is MID$
b.List the conditional statement used in the above program.
Ans: The conditional statement used in the above program is:
IF …. THEN

12. Write a program using FUNCTION….END FUNCTION to input a string and
count the total number of consonants.
Ans: DECLARE FUNCTION COUNT(W$)

CLS
INPUT “Enter a Word”; W$
PRINT “The total numberr of consonant is”; COUNT(W$)
END
FUNCTION COUNT (W$)
C = 0
FOR I = 1 TO LEN(W$)
B$ = MID$(W$, I, 1)
C$ = UCASE$(B$)
IF C$ <> “A” AND C$ <> “E” AND C$ <> “I” AND C$ <> “O” AND C$ <> “U” THEN C = C + 1
NEXT I
COUNT = C
END FUNCTION

13 Write a program using SUB……END SUB to find the area of circle.
Ans: DECLARE SUB AREA(R)
CLS
INPUT “Enter radius”; R
CONST PI=3.14
CALL AREA(R)
END
SUB AREA(A)
A=PI*R^2
PRINT “The area of circle=”; A
END SUB

14. A data file “Salary.Dat” contains the information of employee regarding their
name, post and salary. Write a program to display all the information of employee
whose salary is greater than 15000 and less than 40000.
Ans:
OPEN “Salary.Dat” FOR INPUT AS #1
CLS
WHILE NOT EOF(1)
INPUT #1, N$, P$, S
IF S>15000 AND S<40000 THEN PRINT N$, P$, S
WEND
CLOSE #1
END