Sunteți pe pagina 1din 57

Subject: Computer science (Optional II) 2

Group A(Fundamentals — 20 Marks)


1. Answer the following questions: [5x2=10]
a. What is a network server?
In client server network, a computer that is dedicated to providing information or services in response to external
requests is called network server. In other words, it is a central computer of a network; used for shared storage. A
server may store software applications, databases, and data files for the network users. Depending on the way a
server is used, it also may be called a file sever, application serves' or server.
b. What is a fiber-optic cable? Why electromagnetic interference' is not experienced in data, transmission
through fiber optic cable?
A fiber-optic cable is a thin strand of glass that transmits pulsating beams of light from one end to another end. The
fiber is coated with cladding of a gel that reflects signals back into the fiber to reduce signal loss. Externally it is
covered with plastic jacket. Fiber-optic cable can carry data at more than a billion bits per second or even up to 100
Gbps.

As data travel in the form of light signal in fiber-optic cable, no electromagnetic interference is experienced in data
transmission because light signals are not affected by electromagnetic wave. Fiber-optic cable not only is extremely
fast and can carry large number of messages simultaneously, but it is very secure transmission medium.
c. List out the three main objectives of IT policy, 2057 of Nepal.
The government of Nepal introduced the Information Technology Policy, 2057(2000) with a view to placing
Nepal in global IT map within five years through the fulfillment of following three objectives.
• To make information technology accessible to the general public and increase employment
through this means.
• To built a knowledge-based society.
• To establish knowledge-based industries.
d. What is computer security? Point out any two computer software security measures:
Computer security refers to the protection of computer's resources both hardware and software from accidental,
intentional and natural disasters. In other words, it is a general term that encompass all aspects of the measures taken
to safeguard computer system and the data they contain from to attributable to any kind of attack, whether initiated
by people or natural elements.
Two common software security measures could be:
1. To use password to avoid accessing by unauthorized users.
2. To keep backup copies of important data and software.
e. What is a boot sector virus? Point .out the common routes for virus infiltration.
A computer virus that infects the crucial boot sector of a disk, so that it is loaded into the computer's memory at the
beginning of every operating session. These viruses mostly infect boot record, master boot, FAT and partition table.
Some common routes for virus infiltration are:
• Exchangeable storage medium like floppy disk, flash memory card etc.
• E-mail attachments
• Shareware
• Pirated software.
2. Fill in the blanks given below: [4x0.5=2]
a) In a bus topology network, a special device called................is placed on each end of the cable.
b) ...............is the process of transferring data./file from a network location to the user's computer. .
c) Government of Nepal introduced cyber law in the year ...…..B.S.
d) The capability of generating reproducing the copies of itself is called . .…..
Ans:- a) Terminator b) downloading c) 2061 d) replication
3. Select the best possible alternative. [4x0.5=2]
a. A - - - - - - - is an agreed-upon format for transmitting data between two devices.
i) proctology ii) protoplasm prototype iv) protocol
b An arrangement where user accounts ,are centralized on a -server and PCs gain access to network resources by
accessing this server is called a ----------------
i)peer to peer network ii)server to server network iii) client-server network iv) file server network
c. Which of the following is not related with computer hardware security?
i) Insurance ii) UPS iii) Password lock iv) Room lock

d. Which is not the internet service?


i) Electronic Mail. ii) FTP iii) Internet Browser iv) FAQ
Ans. a) Protocol b) Client server network c) Password lock (d) Internet browser

4. Match the following:


a) WWW i) Cyber Law
b ) Callback ii) Virus
c) Hacking iii) Dr. Berners-Lee
d) Malicious Program iv) Computer Security
Ans. a —iii b— iv c— i d- ii
5. Write full forms of the following: [4x0.5=2]
a) ARPANET b) VAT c) JPEG d) MSAV
Ans. a) Advance Research Project Agency Network b) Very Small Aperture Terminal
c) Joint Photographic Expert Group d) Microsoft Anti Virus

6. Give the appropriate technical terms of the following: [4x0.5=2]


a) A device that connects two dissimilar networks.
b) The law that governs the legal issues of cyberspace
c) The use of the internet for business-to-business and business-to-consumer transaction.
d) The internal interference produced by adjacent pair of twisted pair cable.
Ans. a) gateway b) cyber law c) e-commerce d) crosstalk
Group B (Database Management -10 Marks)
7.Answer the following questions: [3x2=6]
a) What is the difference between database and database management system?
A database is basically a collection of data. A database management system is a program. or collection of program.
that allows number of users to access and modify the data in a database. A DBMS also provides tools that enable users to
construct special requests (queries) to find the records in the database.
b) Why do we need to querying a database?
• To allow the DBMS to locate records.
• To establish relationships or links between tables to update records.
• To list a subset of records.
• To perform calculations.
• To delete obsolete records.
• To perform other data management tasks
c) Logical field holds which kind of data?
Logical fields (also called Boolean fields) store one of only two possible values. We can apply almost any description for
the data (Yes or No, True or False, On or Off and so forth).
8. a. State whether true of false. [4x0.5=2)]
i. Maximum field size of memo field is 25 characters.
ii. Primary key field does not contain duplicate data.
iii. * is a wildcard character that represents any one character in expression.
iv. A query can be used to modify database structure.
Ans :-, i) False. ii)True. iii)False. iv)False
b. Suggest the appropriate field types for the following fields. [4x0.5=2]
i)Item Name ii) Item Photograph iii)Item Description iv)Item Price
Ans. a) Text b) OLE c) Memo. d)Currency
Group C (Programming -20 Marks)
9. Answer the following questions in short: [3x1=3]
a. What do you mean by actual parameter and formal parameter?
In computer programming, the actual values (variables) passed to a function or sub procedure following the parameter
passing convention is called actual parameter where as parameters (variables) declare while declaring procedure in order
to match the actual parameters are called formal parameter. Processing is based on actual parameters whereas convention
is based on formal parameters.
b. What is the differences between opening a sequential file in output mode and append mode?
Both are the writing mode but output mode points the file pointer to the beginning of file(BOF) position and writing
starts from the first data whereas append mode points the file pointer to the end file( EOF) position and writing starts
from last records onwards. Usually a new data file is opened in output mode to store new records whereas an existing
data file is opened in append mode to add more records on to it.

c. Write down the functions of NAME statement and EOF () function.


NAME statement is used to rename an existing file in a disk into new name.
Syntax: NAME "<old-file>" AS "<new-file>"

EOF( ) function is used to check the end of file position. It returns 0 if there are more records below the current
file pointer position and returns 1 if the end of tile has been reached.
Syntax: EOF(file number)
10. a) Re-write the following program correcting the bugs. (2)
DECLARE SUB CURRMTH (D$)
REM PROGRAM TO PRINT CURRENT MONTH FROM THE SYSTEM DATE
DT= DATE$
DISPLAY CURRMONTH (DT$)
END

SUS CURRMONTH (D$)


N = VAL (LEFT$(D$, 2))
FOR M = I TO TWELVE
READ MTH$
IF M = N THEN PRINT "CURRENT MONTH IS ";MTH$
NEXT M
DATA JAN, FEB, MAR, APRL, MAY, JUNE, JULY, AUG, SEPT, OCT, NOV, DEC
END SUB
Ans:-
DECLARE SUB CURRMTH (DS)
REM PROGRAM TO PRINT CURRENT MONTH FROM THE SYSTEM DATE
DT$= DATE$
CALL CURRMTH(DT$)
END

SUB CURRMMTH (D$)


N = VAL(LEFT$(D$,2))
FOR M = I TO 12
READ MTH$
IF M = N THEN PRINT "CURRENT MONTH IS ";MTH$
NEXT M
DATA JAN, FEB, MAR, APRL, MAY, JUNE, JULY, AUG, SEPT, OCT, NOV, DEC
END SUB
b. Write the output of the following program. [2]
DECLARE FUNCTION RESULT (N)
PRINT RESULT (16)
END
FUNCTION RESULT (N)
WHILE N<>0
A=N MOD 2
N=N \2
E$=STR$(A)
F$=ES+F$.
WEND
RT=VAL (F$)
RESULT=RT
END FUNCTION
Ans. 10000
11. Analyze the program in question no 10. b) and answer the following questions. (4x1=4)
a) List the variables used in the program and specify their data types.
b) What happens if we write the statements F$=E$+F$ AS F$=F$+E$
c) What will be the value of F$ in third loop?
d) What will be the output of the program if the print statement is changed as print result(100)
Ans:-
a) A and N numeric variable F$ and E$ string variable
b)00001
c)000
d)100100
12. a) Write a program to declare a user-defined function named ALTC to extract and print alternate characters of a
word using FUNCTION-------END FUNCTION statement. The program should ask to input a word and call the
defined function to print another word comprises of alternate characters of an input word.(eg "kathmandu" =
"ktmnu") [ 3]
Ans. DECLARE FUNCTION ALTC$(w$)
INPUT "Enter a Word "; K$
PRINT "New word is"; ALTC$(K$)
END
FUNCTION ALTC$(W$)
L=LEN (W$)
FOR i= I TO L STEP 2
M$=MID$(W$, i, 1)
X$=X$+M$
NEXT i
ALTC$=X$
END FUNCTION

b) Write a program to test whether an input number is an Armstrong number or not, using SUB.---END SUB
statement. (Hint: If a number is equal to sum of the cube of it's digits, is called an Armstrong number, e.g. 153-)
I3+5'+33=153) (3)
Ans.
DECLARE SUB ARMS (N)
INPUT N
K=N
CALL ARMS (N)
IF C = K THEN PRINT "ARMSTRONG" ELSE PRINT "SORRY"
END

SUB ARMS (N)


SHARED C
DO WHILE N<>0
R=N MOD 10
C=C+R^3
N=INT (N/10)
LOOP
END SUB
c) Write a program which reads all the records from the file "RESULT.DAT" having the fields Name and Percentage,
and prints the name list of all the students in descending order by their percentage. (3)
Ans. OPEN "RESULT.DAT" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, K$, M
C=C+l
LOOP
CLOSE #1
DIM N$(1 TO C), P (1 TO C)
OPEN "RESULT.DAT" FOR INPUT AS #2
FOR I = 1 TO C
INPUT #2, N$(I), P (I)
NEXT I
CLOSE #2
FOR X = 1 TO C- 1
FORY=X+1 TO C
IF P(X) < P(Y) THEN
SWAP P(X), P(Y)
SWAP N$(X),N$(Y)
END IF
NEXT Y
NEXT X
FOR Z= 1 TO C
PRINT N$(Z), P(Z)
NEXT Z
Group 'A'
[Fundamentals -20 Marks]
1. Answer the following questions: [5X2=10]
a) What is WAN? Differentiate it with LAN.
WAN (Wide Area Network) is the computer network which extends beyond a city. In other word, a computer
network in which computers in different cities, counties or continents are called WAN. The main medium of
communication in WAN is artificial satellite and other public communication links. WAN can be private or
public. WAN installed and used by company solely for the use of their use is called private and WAN like the
Internet is called public.
WAN differs from LAN in terms of area covered and communication medium. A LAN is confined within a
premise whereas a WAN covers areas more than a city. LAN uses dedicated communication medium like
cables whereas WAN uses public communication links such as artificial satellite or telecommunication links.
b) Explain in brief the advantage of computer network in reducing cost.
A computer network helps to reduce initial and operation cost. A computer network allows sharing of
resources like hardware, software and services. For example, a printer or one Internet connection can be
shared by all users of a network. In this way it helps to save the cost of buying extra hardware or service.
Problems of the computers in a network can be solved by one or a few experts from one place. This saves the
cost of hiring experts for all the branches of an office and I or the cost of travel by the expert to different
branches.
c) What is cyber law? Write the necessity of formulating cyber law.
The set of rules (laws) formulate by the government of a country to control and regulate the happenings in the
cyberspace (the 'virtual-real' world created by the computer systems and the Internet). It includes laws defining
provisions of digital signature, intellectual property, privacy, freedom of expression, telecommunication laws,
etc. The development of technology has brought about many positive impacts but it has invited some
complications with it hacker being one example of it. To bring such crimes within the area of jurisdiction
cyber law is necessary.
d) Discuss any two negative impacts of the Internet.
In spite of many revolutionary changes brought about by the Internet there are some negative impacts of the
Internet in the society. Following are some of the negative impacts of the Internet.
Virus Transmission: Internet has become the fastest and easiest medium for virus transmission. It makes it
possible for the virus to transmit in the form of e-mail attachment, malicious scripts in the web sites, hidden in
the programs downloaded from unreliable websites, etc.
Privacy: Internet has connected many computer networks in the world. It provides a way for the hackers to get
unauthorized access to other computer systems with the intention of stealing or changing data. In this way the
Internet has created a threat for the privacy of information.
e) What is data security? Write its importance.
Protecting users data from loss or damage is called data security. File(s) being deleted or corrupted
results into loss of vital data. So, a computer user must adopt proper measure to protect data. Some people
think that data can be easily re-created without much cost and effort That is not a right thinking. In some
situation a data collected from a source may not be available again. For example, a photograph taken on a
particular occasion is deleted then we may not be able to organize the same occasion again. So, security of
data is very important.
2. Write full forms of the following, [4x0.5=2]
a) TCP/IP —Transmission Control Protocol r Internet Protocol.
'

b) USB- Universal Serial Bus


c) URL — Uniform Resource Locator
d) UTP — Unshielded Twisted Pair
3. Match the following.
a) Fiber Optics
b) FTP
c) UNIX
d) Cnn.com
i. domain name
ii. signal in the form of light
iii. copy files one computer to another
iv. Network Operating System
Ans: a)–ii b)-iii c)– iv (d)-i
4. Write technical terms for the following: [4x0.5=2]
a) A network topology in which all computers are connected to a single cable.
b) Software that detects and cleans computer virus.
c) Combination of text, picture, audio, animation, video, etc.
d) A time stamped website which is updated by its owner periodically.
Ans: a) Bus b) Anti-Virus c) Multimedia d) blog
5. Write True or False. [4x0.5=2]
a) A bridge connects network using same communication protocols.
b) Backup is a means of data security.
c) A computer does not work when disconnect from network.
d) W WW is a network protocol.
Ans: a) TRUE b) TRUE c) FALSE d) FALSE

6. Fill in the blanks. [4x0.5=2]


a) ...................is the arrangement or physical layout of computers in a network.
b) ...................is used to verify the authenticity of the electronically stored or transferred document.
c) ..........................is used to boost the strength of s i sa l and re-broadcast it.
d) ...................is a service of the Internet which allows one to logon to another computer in the Internet.
Ans: a) Network Topology b) Digital signature c) Repeater d) Telnet Group `B'
Database Management (10 Marks)
7. Answer the following questions. [3X2=6]
a) Define data and information.
Data: Data is a raw fact collected from a source. It may be any combination of alphabets or numbers. Now, in this
multimedia age, picture, audio, video, etc are also considered as valid data. A data itself may not give any useful
meaning. Examples, 15, Sub ash, street, temple, Kathmandu
Information: When data are organized or processed so as to give some sensible meaning then it's called information.
Information must carry meaning. Let's arrange the data given above. Subash lives at 15 temple street, Kathmandu. Now
it gives a sensible meaning so it is information.
b) Suggest appropriate data types for the following fields.
Phone number, Photo, Salary, Married
Ans: Phone number – text
We don't use phone number for any calculation but we may want to use symbols like -, ( ) etc
Photo – OLE object
Salary – Currency
Married – Yes/No
We would use Text type if the field is Marital Status to store values “married”, “unmarried”, etc.

c) Differentiate between Select and Update Query?

Select query Update Query

Select query is used to select required fields Update query is used to change data in one or more
and records from the table or another query fields of all or selected records of the table.
Opening a Select Query does not make any Opening an Update Query makes changes in the data
change in the data of the table of the table.

8.a)Fill in the blanks. [4x0.5=2]


i) Data that will be automatically entered in a field is-------
ii) ----------helps to do complex task, using step-by-step dialogs.
iii) Arranging records in certain order is called is---------
iv) A query which is used add data from one table to another table is called ------------
i)Default value ii) Wizard iii) Sorting iv) Append
b).State TRUE or FALSE [ 4x0.5=2]
i) Maximum field size of text field is 55 characters.
ii) In a primary key field same data may be entered twice.
iii)A query can be used to delete a form.
iv) We can not enter data in a report.
Ans i)False ii)False iii)False iv)True
Group 'C' [Programming -20 Marks]
9. a) Differentiate between LINE INPUT # and INPUT # with example.
LINE INPUT # INPUT#
LINE INPUT # reads a whole line of data from a INPUT# reads data from a sequential data file into
sequential data file into string variable one or more variables
Reads whole line of data not affected by the comma Reads each item separated by comma into separate
used to separate the data items variables
Only one string variable is used. One or more variables are used according to the
number and type of data it the file.
If a line in the data file is: "School", "Kathmandu", with the statement INPUT#2,A$, B$, C will
12 have the values A$= "School", B$= "Kathmandu”
with the statement LINE INPUT #2, A$ ; and C= 12
A$ will have value: "School", "Kathmandu", 12
. b) Mention the use of CHAIN and DECLARE SUB statements.
CHAIN transfers control to another program
DECLARE SUB is used at the beginning of the main module to declare the reference of a SUB
procedure defined and used in the program
10. a) Write output of the following program
DECLARE FUNCTION NEXTTERM (T)
CLS
X=7
FOR I = 1 TO 10
PRINT X;
X=NEXTTERM(X)
NEXT I
END

FUNCTION NEXTTERM (T)


IF T MOD 2 = 0 THEN
T = T /2
ELSE
T=T*3+1
END IF
NEXTTERM =T
END FUNCTION
Ans: 7 22 11 34 17 52 26 13 40 20

NEXTTERM function is used to generate the next term of the series. The next term will be half if the number is even
else it will be three times the number plus one. The main module will initialize the first valve of x =7 and call the
function ten times to generate the series. This series is called “hailstone numbers”.
b)Debug the following program.
CLS
REM PROGRAM TO DISPLAY DATA IN A TEXT FILE
OPEN "TEST.DAT" FOR INPUT AS $2

DO WHILE EOF(2)
LINE INPUT A$
PRINT A$
LOOP
CLOSE #2
END
Ans:
CLS
REM PROGRAM TO DISPLAY DATA IN A,TEXT FILE
OPEN "TEST.DAT" FOR INPUT AS #2
DO UNTIL EOF(2)
LINE INPUT #2, A$
PRINT A$
LOOP
CLOSE #2
END
REM is the keyword used for remarks which is spelt wrong; The file number is Written with # not $; ; The loop
should be UNTIL loop instead of WHILE as the loop should stop when 'End of File is reached i.e. E O F ( 1 ) is
TRUE; #file number must be used with the LINE INPUT statement to read from file otherwise it reads from keyboard
11.Study the following program and answer the question that follow.
A$ = DATE$
M$ = LEFTS (A$,2),
D$ = MID$(A$,4, 2)
F$ = "ATD" + M$ + D$+”.TXT”
OPEN F$ FOR OUTPUT AS #2
DO
INPUT "NAME OF THE STUDENT (EXIT TO STOP): "; N$
IF UCASE$(N$) = "EXIT" THEN EXIT DO
PRINT #2, N$
LOOP
CLOSE #2
END

a) What is the purpose of generating filename in this way?


Ans:- The filename is generated by using day and month number in it so that a different filename will be created on
different dates.
b) What will be the filename if the program is executed on 2nd January 2007?
Ans:- If the program is executed on 2nd January 2007 the filename will be ATDO102.TXT.
c) What is the condition to come out of the loop?
Ans:-The program control comes out of the loop when the user enters `EXIT' at the prompt.
d) Why is EXIT DO used in the program instead of using condition with DO or LOOP?.
Ans:- If the loop is controlled by using UCASE$(N$) = "EXIT" condition with DO or LOQP statement then the value
EXIT entered by the user with an intention of going out of loop will also be written to the data file. So, the value
is checked before writing to the file and comes out of the loop tithe value entered by the user is EXIT.
12. a) Write a program, using SUB ... END SUB, to print square and square root of a number 3 DECLARE SUB
SQ (N)
CLS
INPUT "ENTER A NUMBER: "; A
CALL SQ(A)
SUB SQ (N)
PRINT "SQUARE OF NUMBER: "; N"2
PRINT "SQUARE ROOT: "; SQR(N)
END SUB
b) Write a program, using FUNCTION ... END FUNCTION, to print the highest digit in a number.
DECLARE FUNCTION HIGH (N)
CLS
INPUT "ENTER NUMBER: "; A
PRINT "HIGHEST DIGIT IN THE NUMBER IS "; HIGH (A)
END
FUNCTION HIGH (N)
H = N MOD 10
DO WHILE N 0
N = N \ 10
R = N MOD 10
IF R > H THEN H = R
LOOP
HIGH = H
END FUNCTION
c) Write a program to ask name, sex and district of people and store the information of people from Kathmandu
district only in a sequential data file. "KATH.TXT".
CLS
OPEN "KATH.TXT" FOR OUTPUT AS #3
DO
INPUT "NAME: ";N$
INPUT "SEX (MALE/FEMALE): ";S$
INPUT "DISTRICT: ",D$
IF UCASE$(D$) = "KATHMANDU" THEN
WRITE #3, N$,S$,D$
END IF
INPUT "ENTER ANOTHER RECORD (Y/N)";C$
LOOP WHILE UCASE$(C$) = "Y"
CLOSE #3
_ END
Snbject: Optional II (Computer Science) 4
Group A (Fundamentals 20 Marks)
1. Answer the following questions: [5X2=10]
a) Why is it necessary to network computers?
Ans. The key purposes of computer networking are to provide services and to reduce equipment costs. Networks enable
computers to share their resources (hardware and software) by offering services to other computers. Some of the
primary reasons for networking computers are as follows:
 Sharing files
 Sharing printer and other devices
 Enabling common administration and security
 Supporting network applications such as electronic mail and database services
b) What is LAN topology? List the advantages of star topology.
Ans. ______________________________LAN topology refers to the physical layout or geometric arrangement of nodes
and cable links in a local network. Network topology fall into two categories: centralized and decentralized. In a
centralized topology, such as star network, a central computer controls access to the network. This design ensures data
security central management control over the network's contents and activities. In a decentralized topology, such as and
ring network, each workstation (node) can access the network independently and established its connections with
other nodes.
Advantages of star topology are:
 Easy to install and wire
 Easy to detect faults and to remove parts.
 No disruption to the network when adding and removing devices.
c) What is cyberspace? List any two moral principles of cyber ethics.
Ans. Space can be defined as a boundless three-dimensional extent in which objects and events occur and relative
position and direction. The word cyber refers t o computers, hence cyberspace refers to virtual space created by
computer systems and related technology in order to place multi-media objects and conducting i time activities.
 Do not use computer to harm other people
 Think about the social consequences of the program you are writing or the system you are design
c) What is an UPS? Explain in brief.
Ans. It is a power backup device that can supply continuous power to a computer system in the event of a power failure.
An UPS comprises of battery, which is charged while a computer is switched on. If the power failure provides power
for 10 minutes or more depending upon the system, during which time one can save files shut down the computer to
preserve the integrity of crucial data.
d) What is an anti-viral program? Prescribe any four preventive measures to stop virus infiltration ip computer.
Ans. A program/software that detects and removes the computer virus from an infected file, program or memory address
is called an anti-viral program.
Some preventative measures to stop virus infiltration are as follows:
 Buy software from proven source
 Check exchangeable storage medium periodically and scan cr remove infected files
 Do not use pirated software
 Prevent access to unauthorized users
2. Give fill forms of the following abbreviations: [4X0.5=2]
a)MIDI b)NIC c)WORM d)IRC
Ans. a) Musical Instrument Digital Interface b)Network Interface Card
c) Write Once Read Many d) Internet Relay Chat
3. Match the following: : [4X0.5=2]
a) Intellectual property i) Novel Netware
b) Program ii) DVD
c) Network OS iii) Virus
d) Mass storage iv) Copyright law
v) WAN
4. Fill in the blanks [4X0.5=2]
a) If a computer is not connected to a network, It is known as----------computer.
b) Ground stations that communicate with each other must be within -------------.
c) ---------virus usually does not destruct the computer files/programs but displays interesting information to
entertain the users.
d) MMX stands for ----------------------
Ans.a)Stand-alone b)Line of sight c)Message carrying virus d)Multi-media extension
5. State whether the following statements are true or false. [4X0.5=2]
a) If you connect your computer to an ISP through a regular telephone line, your bandwidth is limited to the
bandwidth of that telephone line.
b) In a ring topology, each computer is connected to the next computer, with the last one connected to a terminator.
c) Wide area network uses guided transmission media like microwave or radio wave.
d) Computer virus used to be developed unknowingly while developing computer program.
Ans. a) True b) False c) False d)False

6. Select the best possible alternative(s) out of following: [4X0.5=2]


a) Data transfer rate for LAN is normally:
i) 1 -100 Mbps ii) 1 - 2 Mbps iii) I — 10 Mbps iv) None of the above
b) Which of the following is used to connect two LANs using same LAN protocols?
i) Routers ii) Connectors iii) Gateways iv) Non of the above
c) What is the name given to the computer which send HTML and other files to user's PCs ?
i) PC ii) Network iii) Work station iv) Web server
d) Which of the following is/are not related with multi-media computer?
i) Graphics card ii) Sound card iii) LAN card iv) Display card
Ans:-(a)- (i) , (b) - (iv) , (c) — (iv) , (d)-(iii)
Group B (Database 10 Marks)
7. Answer the following questions: [3x2=6]
a) What is a database structure?
Ans. A database structure is noting but a definition of the data records according to which information is stored in a
particular database, including the number of data fields; a set of field definition that specify the type, length and
other characteristics of the data that can be entered in each field.
b) What is meant by table formatting?
Ans. A MS-Access table has many attributes such as font, row height, column width, datasheet, hide/unhide column,
freeze column, rename column etc. Changing these attributes of a table is known as formatting a table.
c) What is criteria? Can we insert criteria of two tables in a single query?
Ans. A set of conditions or limits that we use to match entries in a field in order to category a group of records is called
criteria. Yes, we can enter criteria of two tables in a single query.
8. a) Select the best possible alternative(s). [4x0.5=2]
i) What is the default primary key field name in MS-Access table structure?
1. MBD 2. Primary 3. S. NO 4. ID
ii) Which of the following can you do to add the field to a query?
1. Double-click the field name in the field list.
2. Use the drop-down list in the query design grid.
3. Drag the field name from the field list to the query design grid.
4. All of the above.
iii) Which of the following data type is most appropriate to store long description or paragraph in a
database?
1. Text 2. Date and time 3. Memo 4. Yes/no
iv) What is the extension of MS-Access database file?
I. BD 2. MBD 3. DBT 4. DBF
Ans. i)—4, ii)—4, iii) - 3 , iv)—2
b) State whether the following statements are true or false. [4x0.5=2]
i) We can undo the deleted records from action query.
ii) An input mask controls the value of a record and sets it in a specific format.
iii) Record is also known as tuple.
iv) We must include at least one field in a query.
Ans. i) False ii) True iii) True iv) True
Group C (Programming 20 Marks)
9. Answer the following questions in short: [3x1=3]
a) What is a subroutine?
Ans. It is a section of a computer program that is designed to perform a specific task. Unlike the function it does not
have return value but can be called (used) from the main program as many times as it needed.
b)What is a sequential data file?
Ans. A sequential data file is one where records are stored in a sequential order of the data fields and, can only be
accessed in the same order as it was stored before.
c)Write down the function and syntax of KILL and FILES statements.
Ans. The KILL statement is used to delete files from a disk.
Syntax: KILL " [Drive][path]<filename>"
The FILES statement is used to display the names of files from a disk.
Syntax: FILES "[Drive][path][filename expression]"
10. a) Write down the output of the following program: [2]
DECLARE SUB SSS (A, B, C)
DECLARE FUNCTION PPP (X, Y)
CALL SSS (2, 2, 5)
SUB SSS (A, B, C)
FOR I = I TO C
PRINT A
A = PPP (A, B)
NEXT I
END SUB

FUNCTION PPP(X, Y)
PPP = X*Y
END FUNCTION
Ans. 2, 4, 8, 16, 32

b) Debug the following program: [2]


REM Program to update the file STD.DAT having the fields Name and Score by adding 5% in Score
OPEN "STD.DAT" FOR INPUT AS #1
OPEN "XYZ.DAT" FOR INPUT AS #2
DO WHILE NOT EOF(I)
INPUT #1, NAME$, SCORE
NSCORE=SCORE + SCORE*5/100
WRITE #2, NAMES, SCORE
LOOP
CLOSE #1
KILL " STD.DAT"
RENAME "XYZ.DAT" AS "STD.DAT"
END
Ans. REM Program to update.tlie file STD.DAT having the fields Name and Score by adding 5% in Score
lOPEN "STD.DAT" FOR INPUT AS #1
OPEN "XYZ.DAT" FOR OUTPUT AS #2
DO WHILE NOT EOF(l)
INPUT #1, NAME.$, SCORE
NSCORE=SCORE + SCORE*5/100
WRITE #2. NAME$, NSCORE
LOOP
CLOSE #1
CLOSE #2
KILL " STD.DAT"
NAME "XYZ.DAT" AS "STD.DAT"
END
11. Analyze the program given below and answer the questions that follow. [4x1=4]
DECLARE FUNCTION TEST$(N)
INPUT "Enter a number"; NUM
PRINT TEST$(NUM)
END
FUNCTION TEST$(N)
K=0
FORC=ITON
IF N MOD C = 0 THEN
K=K+1
END IF
NEXT C
IF K= 2 THEN
TEST$ = “ COMPOSITE"
ELSE
TEST$ = “PRIME"
END IF
END FUNCTION
a) Why is the $ sign followed in function name?
Ans. Because the function name TEST returns string value (i.e. "PRIME" or "COMPOSITE") after processing
b)What modification should we make in the program to get the correct result if the FOR loop is changed as FOR C=2 to
N?
Ans:-We should change the IF condition as K = 1 since the division by 1, which increases the value of K by 1 is
excluded while processing.
c)What will be the value of K when you input the value of NUM as 16?
Ans:-The value of K will be 5 since C will perfectly divide N for five times.
d)Name the actual parameter and formal parameters used in the program.
Ans:-In the above program the numeric variable N is formal parameter and NUM is actual parameter.

12. a)Write a program which asks to enter any five numbers in main module and prints the greatest number among five
using SUB............................END SUB [3]
Ans:
DECLARE SUB GREAT (N( ))
DIM NUM (1 TO 5)
FOR X = 1 TO 5
INPUT NUM(X)
NEXT X
CALL GREAT (NUM( ))
END

SUB GREAT (NO)


LET G=N(l)
FOR Y=2 T0 5
IF N(Y) > G THEN G = N(Y)
NEXT Y
PRINT "Greatest No is " ; G
END SUB

b) Write a program to create a user defined WCOUNT to return the number of words used in a given sentence.[3]
Ans.
DECLARE FUNCTION WCOUNT (S$)
INPUT "Enter a Sentence" ; ST$
PRINT WCOUNT (ST$)
END
FUNCTION WCOUNT(S$)
CNT=0
FOR X = I TO LEN(S$)
M$ = MID$(S$. X, 1)
IF M$ = " " THEN CNT = CNT + 1
NEXT
NW=CNT+1
WCOUNT = NW
END FUNCTION
c) A sequential data file EMPLOYEE.DBT of XYZ employees on Name, Service-yrs and Age. Write a program to print
the name list of employees having the Age greater than 60 and Service=yrs more than 20 under the title Out Dated
Employee and also count the number of such employees. [3]
Ans:-
OPEN "EMPLOYEE.DAT" FOR INPUT AS #1
PRINT TAB(20); "Out Dated Employee"
DO UNTIL EOF(1)
INPUT # 1, N$, SY, A
IF A > 60 AND SY > 20 THEN
PRINT TAB(20) ;N$
CNT = CNT + 1
END IF
LOOP
PRINT TAB(20) ; "Number of out dated employees " ; CNT
CLOSE #1
END
Subject: Computer Science (Optional II).............6
Group "A" (Fundamentals — 20 marks)
1. Answer the following questions: [5X2=10]
a) What is meant by network media? Point out it's types.
Ans. Network media refers to the means used to link a network's nodes together. There are two basic categories of
network media; guided and unguided. There are many different types of guide transmission media, the most
popular being twisted-pair cable, coaxial cable and fiber optic cable Unguided media used in wireless
technology. In wireless networks, the atmosphere itself acts as the medium. Wireless networks use radio or
infrared signals that travel through the air (called ether) for transmitting data.
b) What is a web browser? Name any three web browsers.
Ans. A web browser (or browser) is a software application designed to find hypertext documents on the web and
then open the document on the user's computer. Most of the browsers provide a graphical interface that enables
the user to click hyperlinked text and images to jump to other documents or view other data. Three common web
browsers are Internet Explorer, Netscape Navigator, and Mosaic etc.
c) What is data security? List any two security measures to secure data.
Ans. Data security refers to the protection of data from different types of threats such as natural disasters, hardware
failure, criminal acts, malicious code, cyber terrorism etc. Two data security measures are:
• Valuable data files should be encrypted (converted into codes)
• Access privileges to the database should be limited and closely monitored.
d) Write any three application of computer in education field.
Ans. Education field is one of the most important field, where the computer can assist in many ways. Some of them
are:
• Computer can be used to teach/learn different subjects like science, geography, mathematics etc. using
related courseware based on CAI (Computer Aided Instruction)/CAL (Computer Assisted Learning) technique.
• Computers can be used to conduct educational training based on CBT (Computer Based Training)
technique.
• Computers can be used to evaluate the student's answer sheet (objective types) based on OMR
(Optical Mark Recognition) or related technology,
e) Why do people make virus program? Name any two antivirus programs.
Ans. There may be three basic reasons behind the development of computer virus.
• Programmers or software developers may develop and inject computer virus in order to stop or
minimize piracy of their original software.
• Destructive minds may develop and inject computer virus intentionally to harm others computer. This
category of people may have the tendency of breaching cyber law and ethic,
• Joyful minds may develop computer virus to entertain others.
Two anti-virus programs are; NAV, MacAfee.
2. Fill in the blanks with suitable word(s): [4x0.5=2]
a) ..................means two-way communication system.
b) The treatment of computer crime and abuse is defined in ------ -------------
c) Numbers of connected computers in client/server network architecture are called -----------
d) ---------------are used to detect and remove computer virus from infected file or memory.
Ans. a) Duplex b) Cyber Law c) Nodes d) Anti-virus Programs
3. Write the full form of the following:-
a)UTP b)POP c)DVD d)NAV
ANS:-Unshielded Twisted Pair b) POST Office Protocol c) Digital Versatile Disk e) Norton Antivirus
4. Give the appropriate technical term for the following [4x0.5=2]
a) A network architecture in which each computer can provide as well as receive network services.
b) Online digital postal services
c) A device used at the end user’s computer of a network which convert digital signals into analog signal and vice
versa
d) Factual information in the form of text, numbers, sounds or images that can be processed by a computer.
Ans. a) Peer-to-peer Architecture b) E-mail c) MODEM d) Data
5. State whether true or false: [4x0.5=2]
a) MODEMs are not needed in wireless network communication.
b) The most common type of network cable used for bus topology is coaxial cable.
c) Usually system injectors enter to the system as a device driver and get loaded into memory.
d) Sound card captures movies or pictures from external devices.
Ans. a) false b) True c) True d) False

6. Match the following [4x0.5=2]


a) FTP i) interactive
b) Fiber optic cable ii) Software
c) Multimedia iii) Protocol
d) Anti-virus iv) Guided media
Ans. a) - iii) b) – iv) c) – i) d) – ii)
GROUP "B" (Database Management-10 marks)
7. Answer the following questions: [3X2=6]
a) What is flat file database management system?
Ans. Database application software that stores, organizes and retrieves all its data in a single table. This approach is
suitable for small and simple database. The complex database relating several tables can be built with relational
database application.
b) Write down the components (objects) of MS-Access 2000.
Ans. Tables, Forms, Queries, Reports, Pages, Macros arid Modules.
c) What is meant by the term query in the context of database management?
Ans. In database management, a query is a search question that tells the program what kind of data should be retrieve
from the database. A query specifies the characteristics (criteria) used to guide the computer to the required information
or expected change in the database.
8. a) State whether true or false: [4x0.5=2]
i) MS-Access 2000 is a relational database management system.
ii) The primary key field is an optional field in MS-Access table.
iii) Select query can retrieve data from one or more tables using criteria you specify.
iv) Text expression must be kept inside single quote while defining query criteria.
Ans. i) True ii) False iii) True iv) False
b) Match the following: [4x0.5=2]
i) Data 1) Rows and columns
ii) Field 2) Collection of records
iii) Table 3) Facts and figures
iv) Database 4) Column on datasheet
Ans. i) — 3) ii)—4) iii)—l) iv) — 2)
GROUP "C" (Programming-20marks)
9. Answer the following questions: [3x 1=3]
a) What is a program module?
Ans. A program module is a section of program or program unit that is set aside and differentiated from other sections
so that its procedural code can be called any time in the program where ever it is needed.
b) What happens when you open a file containing some records in output mode?
Ans. When we open a file containing some records in output mode, ail the records in the file will be deleted and file
pointer will point to the first record position in order to write new one.
c)Write down the syntax and application of INPUT$ function.
Ans. INPUT$ function reads specified number of characters from a sequential file or keyboard.
Syntax: INPUT$ ( n [ [#] filenumber%] )

10. a) Debug the following program: [2]


REM Program to print the square root of even numbers read from data line
DECLARE FUNCTION SQU(N)
FOR I =1 T0 6
READ NUM
K = NUM MOD 2
IF K = 1 THEN PRINT SQU(NUM)
NEXT I
DATA 3. 4, 13, 16, 23,36,48
END
FUNCTION SQU(N)
A=N^(1/2)
A = SQU
END FUNCTION

Ans:-
REM Program to print the square root of even numbers read from data line
DECLARE FUNCTION SQU(N)
FOR I =1 T0 7
READ NUM
K = NUM MOD 2
IF K = 0 THEN PRINT SQU(NUM)
NEXT I
DATA 3, 4, 13, 16, 23, 36 48
END
FUNCTION SQU(N)
A=N^(1/2)
SQU=A
END FUNCTION
b) Write down the output of the following program:
[2]
DECLARE SUB PEACE(W$)
A$ = "LOKTANTRA"
CALL PEACE(A$)
END
SUB PEACE(W$)
C=5 : N= 1 : T=39
FORI=1TO5
PRINT TAB(T); MIDS(W$, C, N)
T=.T-1
C= C-1
N=N+ 2
NEXT I
END SUB
Ans.:-
A
TAN
KTANT
OKTANTR
LOKTANTRA
11. Analyze the following program and answer the questions that follow: [4X1=4]
DECLARE SUB SSS(N)
CLS
INPUT”ENTER A NUMBER”;A
CALL SSS(A)
END
SUB SSS(N)
FOR I =1 TO N
PRINT N;
IF N MOD 2=0 THEN
N=N/2
ELSE
N = N*3+1
END IF
IF N = I THEN EXIT FOR
NEXT I
END SUB
a) What will be the output of the program when you provide the value 3 for the variable A?
Ans. The output will be 3, 10, 5
b) How many times the FOR loop will be executed when you input 8 for the variable A?
Ans. The FOR loop will be executed for 3 times when we input 8 as the value of A. In third loop, after printing 2
the value of N will be 1 so it will conditionally exit from the FOR loop
c) What is the data type of the variables A and N?
Ans:- Since no type declaration character are followed after the variable name, the data type of the variables A and
N will be taken as Single precision by default.
d) Will there any change in output if FOR statement is changed as FOR I=N TO 1 step-1
Ans: No, there will not be any change in the output since the value of 1 is not used within the loop for calculation
and is used simply for looping purpose.

12.a) Write a program to create a user-defined function 'RCOUNT' to count and print the number of records present in
any sequential data file.
[3]
DECLARE FUNCTION RCOUNT(F$)
CLS
INPUT "ENTER A FILE NAME": FL$
PRINT "NUMBER OF RECORDS";RCOUNT(FL$)
END

FUNCTION RCOUNT(F$)
OPEN F$ FOR INPUT AS #1
DO UNTIL EOF(l)
LINE INPUT #1, REC$
CNT = CNT + 1
LOOP
CLOSE #1
RCOUNT = CNT
END FUNCTION
b) Write a program which asks to enter a full name of a person at the main module and prints the abbreviated form of it
using the sub routine ABBV. (e.g. Mohan Bikram Nepali-- MBN) [3]
Ans:-
DECLARE SUB ABBV(N$)
CLS
INPUT "ENTER A FULL NAME";NAME$
CALL ABBV(NAME$)
END
SUB ABBV(N$)
K$ = MID$(N$,1.1)
L = LEN(N$)
FOR X =2 TO L
M$ = MID$(N$, X, 1)
IF M$="" THEN KS = K$ + MID$(N$, X+1, 1)
NEXT X
PRINT K$
END SUB
c) Write a program which updates the file SALES.DAT having the fields SNO, ITEMS, RATE and QUANTITY
by calculating AMOUNT for each record (Where AMOUNT=RATE*QUANTITY) and prints all the records from
the file having the AMOUNT more than 5000. [3]
OPEN "SAL '.S.DAT" FOR INPUT AS #1 OPEN "TEMP.DAT" FOR
OUTPUT AS #2 DO WHILE NOT EOF(1)
INPUT #1, SN, ITM$, R, Q LET AMT = R*Q
WRITE #2, SN, ITM$, R, Q, AMT LOOP
CLOSE #1, #2
KILL "SALES.DAT"
NAME "TEMP.DAT" AS "SALES.DAT"
OPEN "SALES.DAT" FOR INPUT AS #3
PRINT "S. No.", "Item Name", "Rate", "Quantity", "Amount"
DO
INPUT #3, S, N$, RT, QTY, AMT
IF AMT > 5000 THEN
PRINT S, N$, RT, QTY, AMT
END IF
LOOP UNTIL EOF(3)
CLOSE #3
END
Subject: Optional 11 (Computer Science) .....7
Full Marks: 50.
Group `A'
Computer Fundamentals (20 Marks)
1. Answer the following questions. [5x2=10]
a) What is transmission media? Mention its types of transmission media used in computer network.
Ans.: The material or means used to carry signals from one end (node) to another end in a network is called transmission
media. There are two major types of transmission media used in computer network.
(i) Guided media:— The media which physically connects the computers in network are guided media. In
other words they are cables. Optical Fibre, Twisted pair, Coaxial cable are different examples of guided media.
(ii) Unguided media: — In this type there is no physical connection with cable between the nodes. It is also
called wireless media. Examples of unguided media are:- Microwave, radio wave, satellite, etc
b) Define “System Infector Virus” and “Application Infector Virus”.
Ans. System Infector Virus:- A computer virus which infects the main files of the operating system are called
system infector virus. They infect files like COMMAND.COM, IO.SYS, etc in MS-DOS and files like
`
WIN.COM in windows. This type of virus is more dangerous as it is activated at the time of booting computer.
Application Infector Virus:- A computer virus which infects application programs such as Word, Paint, Power
Point, Internet Explorer, etc. This type of virus is less dangerous than a system infector virus or startup.
infector virus because we can easily detect and clean them by using anti-virus program just after booting and
before using any application program.
c) Write the advantages of using multimedia presentation.
Ans.: Multimedia presentations use text, picture, audio, video, etc. in sharp contrast to only text based presentation
multimedia presentation can depict the idea and information more effectively. The proverb `A picture speaks a
thousand words' explains the usefulness of multimedia presentation. Following are some of the advantages of
multimedia presentation.
i) Effective
ii) Attractive
iii) Informative
iv) Accessible to physically disabled persons (For example, a presentation with sound can be useful for a blind
person)
d) Mention any four services of the Internet and discuss any one of them.
Ans.: Given below are some services of the Internet.
i) World Wide Web (WWW)
ii) E-mail
iii) Telnet
iv) File Transfer Protocol (FTP)
World Wide Web (WWW):
The World Wide Web ("WWW" or simply the "Web') is a system of interlinked, hypertext documents
that runs over the Internet. With a Web browser, a user views Web pages that may contain text, images, and
other multimedia and navigates between them using hyperlinks. The Web was created around 1990 by the
Englishman Tim Berners-Lee and the Belgian Robert Cailliau working at CERN in Geneva, Switzerland. As its
inventor, Berners-Lee conceived the Web to be the Semantic Web where all its contents should be
descriptively marked-up.
Extracted from: wikipedia.org
In World Wide Web many web pages made using HTML (Hypertext Markup Language are stored in many web
servers around the world. A user can access any document in the Web using proper URI.
e) What is data back up? Write its importance?
Making additional copy of data to another medium(usually a removable medium) for safe keeping purpose is called
data backup. The data in backup can be restored incase of the original data is lost or damaged. This is preventive measures for
data security. We can backup system data such as File Allocation Table, Partition Table, etc. so that it can be restored in case
of System disaster. Besides that we backup user files so that some or all of them can be restored in case they have been
accidentally deleted or corrupted.Data backup is very important because there are numerous reasons which can result into
data loss, it may not be always possible to regenerate the lost data. Keeping one or more backup copies of data is very wise
idea. Data backup should be done at regular intervals daily, weekly, fort nightly, etc. depending on the nature of work and the
data itself.
2. Choose the best alternative. [4x0.5=2]
a) Which of the following is not the device necessary to make a multimedia - - - - - - - - - -
a. Sound Card
b. Microphone
c. UPS
d. Speaker

b) Nepal information Technology Policy was introduced in:


i. 2061 BS
i. 2057 BS
ii. 2063 BS
iii. 2047 BS
d) Which medium is not affected by electromagnetic interference?
ii. Microwave
iii. Optical fibre cable
iv. Coaxial cable
v. STP cable
c) An ISP
i) Hardware supplier
ii) Software company
iii) Provides printing service
iv) Provides Internet access
Ans.
a) -iii) UPS b)-ii) 2057BS
c) -iv) Provides Internet access d)-ii) optical fibre cable
3. Match the following. [4x0.5=2]

a) LAN i. Internet Service


b) NAV ii. Confined within a premises
c) WWW iii. Connect network cable to computer
d) NIC` iv. Detect and remove virus

Ans.: a) - i i ) . b) - iv) c) - i) d) - iii)


4. Write technical terms for the following. [4x0.5=2]
a) Global network of network that runs on TCP/IP.
b) Simultaneous two way communication system.
c) Operating System that can handle network.
d) Device used to connect PC with telephone line,
ANS:-
a) Internet b) Duplex (or Full Duplex)
c) Network Operating System (NOS) d) MODEM
5. Write whether the following statements are TRUE or FALSE. [4x0.5=2]
a) Cyber law regulates and controls use of computer and the Internet.
b) Volt Guard provides power backup.
c) Intranet is the group of users using same ISP.
d) A computer virus can not infect a picture filet
Ans.: a) - TRUE b) - FALSE c) - FALSE d) - TRUE
6. Write full forms of the following abbreviations. [4x0.5=2]
a) N ITC
b) MODEM
c) POP
d) DVD
Ans:-
a. National Information Technology Center
b. Modulator Demodulator
c. Post Office Protocol
d. Digital Versatile Disk
7. .Answer the following question. [3X2=6]
a) What is a query? Mention any four types of queries used in MS-Access.
A query is a database object used to extract information from database. A query i s used to extract desired fields and records
from a database table. A query is also used to add , modify or delete records in the table. Following are some of the query
types used in MS –Access database.
Select Query: This type of query is used to select desired fields or records from a table
Action Query: Used to modify records in database table. Types of action queries are:
a) Delete Query: Delete one or more records from the table.
b) Update Query: Change values in one or more fields of the selected records in the table.
c) Append Query: Add records from one table to another table
b) What are field size and caption in table design window?
Ans.: Field Size: Field size defines the maximum size for data stored in a field. Field size can be defined for Text,
Number, or AutoNumber data types only.
Caption: Caption is defined as the descriptive name of the field which appears as the heading of the field in the
datasheet view of table and query, a form or a report.

c) Write a short note on indexing in MS-Access table.


Ans.: We can index one or more field in access table. Indexing options are defined in the table design view. Indexing a
field makes the searching and sorting in the field faster. There are three indexing options available in Access
table.
i) No: Do not create index for this field
ii)Yes (Duplicates OK): Create index for this field and allow duplicate data.
iii) Yes (No Duplicates): Create index for this field and do not allow duplicate data in this field.
8. a) Match the following. [4x0.5=2]
i) DBMS A) text more than 255 characters
ii) Memo B) Final result of database
iii) Unique data C) Software to manage information
iv) Report D) primary key
Ans.: i)-C) ii) - A) iii) - D) iv) - B)
b) Fill in the blanks. [4x0.5=2]
i)----------is the extension of MS-Access database file.
ii)......................field type is used to store company logo.
iii)..............is a piece of information about an item or object.
iv).......................is the appropriate field type for Established Date'
Ans.: i) MDB ii) OLE Object iii) Field iv) Date/Time

Group `C'
(Programming -20 Marks)

9. a) What is a user defined function? Mention different components of a user defined function. [2 ]
A procedure defined and used by the programmer is called User Defined Function (UDF). It differs from a library
function in the sense that a library function is included with the language processor and the user (the programmer)
only uses it whereas the programmer creates and uses a user defined function. Unlike a sub procedure a function
directly returns a value. There are three components to be defined while using a user defined function.
i) Declaration: DECLARE statement is used to declare reference to the function. The syntax is
DECLARE function name (parameter list) [use empty parentheses if there is not parameter]
ii) Function Definition: The block of statements enclosed within FUNCTION .. END FUNCTION.
The statements in this block define the exact work of the function.
iii) Implementation: This is the use of the function to get the desired work done. A function is used as an
expression with other statements.
b) Write functions of INPUT # and RMDIR statements. [1]
INPUT #: This statement is used to read data from the specified file into the given variable or variables.
RMDIR: This statement is used to remove a directory.

10. a) Write output of the following program. [2]


DECLARE FUNCTION AA (N)
CLS
M = 214517
PRINT AA(M)
END
FUNCTION AA(X)
DO UNTIL X=0
R=X MOD 2
X=X\10
IF R MOD 2<>0 THEN C=C+1
LOOP
AA = C
END FUNCTION

Ans.: 4

The function extracts the digits of the given number and counts the number of digits which do not leave zero
remainder when divided by 2 (i.e. odd digits) and the main module prints that number. As there are four odd
digits in the given number the output of the program is 4.

b) Debug the following program. [2]


REM PROGRAM TO READ DATA FROM FILE CONTAINING NAME AND AGE AND
REM PRINT THE AVERAGE AGE
OPEN "NOTE.TXT" FOR APPEND AS #1
DO WHILE EOF (1)
INPUT NS, A
PRINT , N$. A
S=S+A
C=C+1
WEND
PRINT "AVERAGE AGE: " ; S / C
CLOSE #1
END

Ans.: REM PROGRAM TO READ DATA FROM FILE CONTAINING NAME AND AGE AND
REM PRINT THE AVERAGE AGE
OPEN "NOTE.TXT" FOR INPUT AS #1
DO UNTIL EOF (I)
INPUT #l, N$, A
PRINT , N$, A
S=S+A
C=C+1
LOOP
PRINT "AVERAGE AGE: " ; S / C
CLOSE #1
END
We open the file in INPUT mode to read from the file; UNTIL condition should be used in place of WHILE as we
go out of the loop when we reach the end of file (condition is TRUE); File number must be used with INPUT
statement to read from file and DO is closed with LOOP not WEND.
11. Study the program given below and answer the questions that follow. [4x1=4 ]
DECLARE SUB TEST(T$)
CLS
A$ = "SCHOOL"
END

SUB TEST(T$)
L = LEN(T$)
FOR X = L TO 1 STEP -1
PRINT MID$(T$, X, 1);
NEXT X
END SUB

a) What statement should be added in the main module for the program to give output?
Ans.: CALL TEST(A$)
b) What will be the output after adding that statement?
Ans.: LOOHCS
The program prints the reverse of the string
c) Modify the FOR statement so that the statement L = LEN(T$) could be removed?
Ans.: FOR X = LEN(T$) TO 1 STEP -l.
d) Which variables are local to the TEST sub procedure?
Ans: L and X

12 a) Write a program using SUB ... END SUB to print the given string at line 10 column 20 of the screen.[3]
Ans:-
DECLARE SUB PRINTAT(N$)
CLS
INPUT "ENTER A STRING:”; A$
CALL PRINTAT (A$)
END

SUB PRINTAT (N$)


LOCATE 10, 20
PRINT N$
END SUB

b) Write a program using FUNCTION ... END FUNCTION to print the given series up to 10 terms.
[3]
7 22 11 34 17 52 26 -- ----------
Ans:-
DECLARE FUNCTION NEXTTERM (N)
X=7
FOR C = 1 TO 10
PRINT X
X = NEXTTERM (X)
NEXT C
END

FUNCTION NEXTTERM (N)


IF N MOD 2 = 0 THEN
NEXTTERM = N / 2
ELSE
NEXTTERM = N * 3 + 1
END IF
END FUNCTION

c) A sequential data file `STUDENT.DAT' contains name, class, roll number and section of the
students.Write a program to display the list of students studying in class 10 section `A'. (3)

CLS
OPEN "STUDENT.DAT" FOR INPUT AS #1
PRINT "NAME", "CLASS", "ROLL NUMBER", "SECTION"
DO UNTIL EOF(1) ' READ FROM FILE UNTIL ITS END IS REACHED
INPUT #1, N$, C, R, S$
IF C = 10 AND UCASE$(S$) = "A" THEN
PRINT N$, C, R, S$
END IF
LOOP
CLOSE #1
END
Subject: Optional II (Computer Science) ....9
SEND[2063]
SEDIPS
Group `A'
Fundamentals (20 Marks)
1. Answer the following questions: [5x2=10]
a) What is the Internet? Discuss its role in information dissemination.
The Internet is the global network of networks which operates on TCP/IP protocol. The Internet started in the US
in 1972 with four host computers connected with each other. Now it has grown to cover the whole globe. There
many heterogeneous networks connected with each other.
The Internet plays a vital role in information dissemination. The services of the Internet like e-mail, World Wide
Web, New Group, Bulletin Board, etc. work to transmit information from person to person or to the mass.
b) What is LAN topology? Illustrate star topology.
The layout of physical connection of computers in LAN is called topology. Topology defines how different
nodes and devices are connected with the cables.
Star Topology:

Mac II Star Network


c) Discuss the use of computer in health sector.
Computers can be used in the health sector for the following purposes:
- Storing Medical History of the patients which helps the doctors know about the past medical history of the
patient which, in turn, helps them to diagnose the disease.
- Used in diagnostic machines – Different diagnostic machines used in the hospital like ECG, Video
X-ray, etc are computer controlled.
- Telemedicine: Doctor living in a far away place can assist another doctor with the patient to check up and
diagnose the disease of the patient using computer technology.,
d) What is hardware security? Discuss the role of power protection devices in hardware security .
Protecting computer parts and its accessories against loss or damage is called hardware security. Problems in the
electricity supply system can damage the hardware parts very easily. Computer parts work on fixed low voltage.
Excessive voltage can cause harm to them. So, proper type of power protection device is necessary for computer
system. There are many types of power protection devices such as Volt Guard, Stabilizer, CVT (Constant
Voltage Transformer), Spike Guard, UPS, etc. UPS is considered to be the best among them because besides
regulating the voltage it also provides power backup.
e) Mention any four preventive measures against virus infection
• Protect computer by unauthorized people
• Use Virus guard
• Don’t open unknown e-mail attachment
• Scan files brought from other sources before using ,etc.
2. Fill in the blanks. [4x0.5 =2]
a) ............is the network protocol used by the Internet.
b) .................is used to arrange files scattered in different sectors of hard disk.
c) ----------accesses others' computer system without authorization with an intention of stealing or
changing information.
d) ------------is secret code used to protect files or other resources of computer from unauthorized
access.
Ans: a) TCP/IP b) Defragment (defragmentation) c) Hacker d) Password
3.Match the following. [4x0.5=2]
a) HTML i. login to another computer in the Internet
b) Coaxial cable ii. improves strength of signal
c) Telnet iii. Language
d) Repeater iv. guided medium

a) HTML
b) Coaxial cable
c) Telnet
d) Repeater

iii) language
iv) guided medium
i) login to another computer in the Internet
ii) improves strength of signal
4. Write technical terms for the following: [4x0.5=2]
a) Device used to connect networks using different protocols.
b) Plan formulated by the government for the development of Information Technology sector.
c) Data transmission rate in computer network.
d) Crime committed using computer technology and the Internet.
Ans: a) Gateway b) IT Policy c) Bandwidth d) Cyber Crime

5. Write TRUE or FALSE. [4x0.5=2]


a) A computer virus hides in other files.
b) Video is a component of multimedia.
c) Protocol defines the rules of data transmission in network.
d) A computer virus can damage hardware.
Ans: a) TRUE b) TRUE c) TRUE d) FALSE

6. Give full forms of the following abbreviations. [4x0.5=2]


a) UPS
b) NITDC
c) NIC
d) SMTP
Ans: a) UPS — Uninterruptible Power Supply
b) NITDC — National Information Technology Development Council
c) NIC — Network Interface Card
d) SMTP — Simple Mail Transfer Protocol

Group “B”
Database Management (10 Marks)

7. Answer the following questions. [3X2=6]


a) What is Database Management System?
A DBMS (Database Management System) is a set of technology and/or software programs that controls the
organization, storage and retrieval of data. Examples of DBMS are Oracle, FoxPro, MySQL, MS-Access, etc.
b)What is indexing? Mention the types of index that can be defined in table design.
Indexing is a field option in Access table design which when enabled makes the sorting and searching in the field
fast. Three types of indexing options can be defined in the table design:
— No (do not index)
— indexed (duplicate OK)
— Indexed (No duplicates)
c) What is default value? Why is it used in Access table?
The value which is automatically inserted in a field of a new record is default value. A default value for a field is
defined in the table design view. It is used to save the effort and time of retyping a value again and again which is
common in many records.
8. a) Fill in the blanks.
i)..........................----------is customized data entry object in MS-Access.
ii)----------defines data acceptance rule for a field of MS-Access table.
iii)----------field type automatically enters number in a field which increases by one for every new record.
iv)-----------query is used to delete record(s) from the table.
Ans:-:i) Form ii) Validation Rule iii) AutoNumber iv) Delete Query

b) Choose the best alternative. [4x0.5=2]


i). A piece of information about an object or individual is called------------------
A) form
B) field
C) record
D) report

ii)-------------is the suitable data type for salary field.


A) text
B) OLE/Object
C) current)
D) memo
iii)-------------is a row in MS-Access table.
A) database
B) field
C) query
D) record
iv)------------------view is used to see output before printing.
A) Form
B) Datasheet
C) Design
D) Print preview
Ans: i) - B) field ii) — C) currency iii) — D) record iv) -- D) Print preview

GROUP 'C'
Programming (20 Marks.)
9. a) Differentiate between OUTPUT and APPEND IN open statement

OUTPUT APPEND
Used to write data to new file. Used to add data to the end of the file
Always creates a new file Writes data to the end of existing file or creates
a

c) Write the use of LINE INPUT# AND KILL statements


LINE INPUT # - read a whole line from a data file into a string variable
KILL — delete the specified file
10. a) Write output of the following program [2]
DECLARE FUNCTION VOWELS (T$)
A$ = "COMPUTER SCIENCE"
PRINT LEN (VOWEL$ (A$))
FUNCTION VOWEL$ (T$)
FOR X = 1. TO LEN(T$)
C$ = UCASE$(MID$(T$, X, 1)
IF C$= "A" OR C$=”E” OR C$= "I" ORC$= “O” OR C$=”U” THEN
B$ =B$ +. C$
END IF
NEXT X
VOWEL$ =B$
END FUNCTION.
Ans: 6
The function returns (OUEIEE ) all the vowels in the string after collecting them in variables B$ and the main
program prints the length of the returned string LEN(VOWEL$(A$))

b. Debug the following program

DECLARE SUB HIGHARAAY (A( ) )


CLS
DIM N(10)
FOR X = 1 TO 10
INPUT "NUMBER'. ", N(X)
NEXT X
PRINT "HIGHEST NUMBER IS:"; CALL HIGHARRAY(A())
END
FUNCTION HIGHARRAY (A)
H=A(1)
FOR I= 2 TO 10
IF A ( i ) > H THEN H = A(I)
NEXT I
HIGHARRAY = H
END FUNCTION
Ans: DECLARE FUNCTION HIGHARAAY (A( ) )
CLS
DIM N(10)
FOR X = 1 TO 10
INPUT "NUMBER: "; N(X)
NEXT X
PRINT "HIGHEST NUMBER IS:"; CALL HICHARRAY (N())
END -T--
FUNCTION HIGHARRAY (A())
H=A(1)
FOR I = 2 TO 10
IF A(I) > H THEN H = A(I)
NEXT I
HIGHARRAY = H
END FUNCTION
The declare statement declares a SUB procedure whereas we are using a function in our program so the keyword
SUB should be replaces by FUNCTI ON. C A L L statement is not used to call a function but a function, is
used as an expression or a formula with other statements. The actual parameter, which is an array, is N( ) defined
in the main procedure but the function is Called wit h array A( ) so A( )should be replaced by N() while calling
the function. As we are pas s i ng the array as parameter the parameter in the function definition should be A()
instead of only A.
11. Study the following program and answer the questions that follow. (4x1=4)
DECLARE SUB ABC (A)
CLS
DO
INPUT "ENTER A POSITIVE NUMBER: "; N
LOOP UNTIL N>=0
CALL ABC(N)
SUB ABC (A)
PRINT A^2
PRINT SQR(A)
END SUB
a) What will be the output of the program i f the user inputs 9?
81
3
Square and Square-root of the given number
b) Is it possible to change the sub procedure's name from ABC to SQR? Justify.
No. SQR cannot be used as the name of sub procedure because it is a BASIC keyword.
c) What will happen if the user inputs -4?
It will ask for the input again until user inputs a number which is greater than or equal to 0.
d) Write the statement to call the sub procedure without using the keyword CALL.
ABC N
The keyword CALL is optional but the parameter is enclosed in parenthesis when CALL is used and the parameter is not
enclosed in parenthesis which the keyword CALL is not used. (Yes CALL —Yes brackets; No CALL — No brackets)

12. a) Write a program using FUNCTION...END FUNCTION to convert length entered. in meter into inch.
(HINT: 1 meter = 39.37 inches) [3]
Ans:
DECLARE FUNCTION MET2INCH(M)
CLS
INPUT "ENTER LENGTH IN METER: " ; A
PRINT "LENGTH IN INCH IS: "; MET2INCH(A)
END
FUNCTION MET2INCH(M)
I = M* 39.37
MET2INCH = I
END FUNCTION

b) Write a program using FUNCTION ... END FUNCTION to ask a string from the user and print its
reverse. [3]
Ans:-
DECLARE FUNCTION REVERSE$(ST$)
CLS
INPUT"ENTER STRING: "; X$
PRINT "REVERSE OF THE STRING IS:”;REVERSES (X$)
END

FUNCTION REVERSE$(ST$)
L = LEN(ST$)
FOR C = 1 TO L
B$ = MID$(ST$, C , 1)
R$ = B$ + R$
NEXT C
REVERSE$ = R$
END FUNCTION
The FOR loop can also be written as:
FOR C = L TO 1 STEP -1
B$ = MID$(ST$, C, 1)
R$ = R$ + B$
NEXT C
Either gets the characters from the first and prints the next character before the previous character or extracts the
characters from the last and joint the previous character after it.

c) A sequential data file "RECORD.TXT" contains peoples' name, age and marital status Write a program
to display the list of people who are married and having age below 20 years (3)
CLS
OPEN "RECORD.TXT" FOR INPUT AS #5
PRINT "NAME", "AGE", "MARITAL STATUS"
DO NOT WHILE EOF(5) ' NOT WHILE is equivalent to UNTIL
INPUT #5, N$, A, M$
IF M$ = "MARRIED" AND A<20 THEN
PRINT N$, A, M$
END IF
LOOP
END

l
Subject: Computer Science (Optional II) 10
Group "A" (Fundamentals — 20 marks)
1. Answer the following questions: [5x2=10]
a) List out any four disadvantages of computer network.
Ans. Some of the disadvantages of computer network are as follow:
• It is difficult to make network system secured from threats such as hackers, viruses, novices
or industrial espionage.
• As traffic increases on the network the performance degrades unless it is properly designed.
• The efficiency of a network is very dependent on the skill of the system manager. A badly
managed network may operate less efficiently than stand-alone machine.
• If the network stops operating then it may not be possible to access various hardware and
software resources, and affects large number of users.
b) What is a star network?
Ans. In local area network, a centralized network topology with a physical layout that resembles a star.
It comprises of central network processor or wiring concentrator; the nodes are arranged around
and connected directly to the central point. Mostly hubs are used to provide central point for
connecting cables. Star network's wiring cost is considerably higher than other topology because
each node is directly connected to the central point.
c) How can you say that computer technology has enhanced the globalization process?
Ans. Computer technology has not only brought the world closer together, but it has allowed the
world's economy to become a single interdependent system. Computer technology enables not only
sharing of information quickly and efficiently, but also helps to bring down the barriers of
linguistic and geographical boundaries. The world has developed into a global village due to the
help of information technology allowing the countries which are not only separated by distance but
also by language and culture to share ideas and information each other.
d) List out any four common routes for virus infiltration.
Ans. There are different routes through which computer viruses are passed to the computer systems. Some
of them are:
(a) Exchangeable media such as floppy disk, USB portable memory devices.
(b) Shareware used in network systems.
(c) E-mail attachments.
(d) Pirated software etc.
e) What do you mean by encryption?
Ant It is process of converting or scrambling a message/data into unreadable form (called cipher text) by
using a key so that it can not be read by anyone other than its intended recipient. The intended recipient
can apply the key to decrypt (rearrange into original form) and read the message/data.
2. Fill in the blanks with suitable word(s):[4x0.5=2]
a) Cable media are called ............transmission media
b) ..................coordinates the activities of multiple computers across a network.
c) Bandwidth of analog device is measured in .............................................................................
d) Computers need ..........to ...........Volt constant power supply.
Ans. a) Guided b) NOS (Network Operating System) c) Hertz (Hz) d) 220 to 240
3. Write full forms of the following: [4X0.5=2]
a) STP b) MCGA c) DNS d) SIMM
Ans. a) Shielded Twisted Pair b) Multi Color Graphics Array
c) Domain Name Service d) Single Inline Memory Module
4. Give the appropriate technical terms-for the following: [4X0.5=2]
a) Directly connected with and accessible to a computer or a network, and ready for use.
b) A program or software that detects and removes computer virus from the infected file or memory.
c) To transfer data from a network location to user's computer.
d) A character (such as an asterisk or question mark) that stands for any other character, or series of
any other characters.
Ans. a) Online b) Anti-viral program c) Download d) Wildcard character
5. State whether true or false: [4X0.5=2]
a) Optical fiber is immune to electromagnetic interference.
b) Digital signatures are used for authentication purpose.
c) Volt guard can supply continuous power to the computer even in case of power failure.
d) We can not send graphics files in emails.
Ans:- a. True b. True c)False d) False
5. Match the following: [4X0.5=2]
a) Microwave i. Multi-media
b) Sound card ii. Unguided media
c) UPS iii. Power protection device
d) TCP/IP iv. Internet protocol

Ans a) - ii) b)- i) c) — iii) d) — iv)

GROUP "B" (Database Management — 10 Marks)


7. Answer the following questions:
a) What is relational database?
Ans. It is a type of database constructed of multiple tables of data that are inter-related on the basis of common field,
unlike the flat file database. Complex searches can be performed to view the data in many different ways.
b) What is the application of OLE object data type?
Ans. An OLE (object linking and embedding) object can be sound, picture, or other object created in another
program. OLE data type enables to use such objects in our database.
c) What is meant by updating a database?
In database management, it is a process of adding, modifying and/or deleting data records in order to
to make the database up to date.
8. a. Write TRUE or FALSE. [4X0.5=2]
a) A computer virus hides in other files.
b) Video is a component of multimedia.
c) Protocol defines the rules of data transmission in network.
d) A computer virus can damage hardware.
Ans: a) TRUE b) TRUE c) TRUE d) FALSE

b. Match the following: [4X0.5=2]i)


i)OLE 1) Easy search
ii) Input mask 2) Field type
iii) Indexing 3) Printing data
iv) Auto Number 4) Entry format
5) Excel chart

Ans:-
i)—5) ii)—4) iii)-1) iv)-2)
GROUP "C" Programming [20]
9. Answer the following questions: [3X1=3]
a.)What is a library function?
Ans:-It is a well-tested built-in function procedure in a given programming language that has return value.
Programmers can use these functions in a program to reduce time and effort of writing separate procedure for the
particular task.
b) What happens when we open a new file in append mode?
Ans:- When we open a new file in append mode, file pointer will point to the first record position and allows the
programmer to write/store records from first record onwards. If the same program is executed again, it allows to add
new records from end of file position onwards.
c. Write down the syntax and application of CHDIR statement.
This statement is used to change the current directory.
Syntax: CHDIR "DRIVE : PATHNAME"
e.g. CHDIR "C:AQBASIC\TEMP"
10 a) Debug the following program: [2]

REM Program to print the sum of even digits of an input number


DECLARE FUNCTION SOE(N)
INPUT A
PRINT SOE(N)
END
FUNCTION SOE(N)
WHILE N< 0
D = N MOD 10
IF D MOD 2=1 THEN E=E+D
N=N\ 10
WEND
E=SOE
END FUNCTION

Ans. REM Program to print the sum of even digits of an input number DECLARE
FUNCTION SOE(N)
INPUT A
PRINT SOE(A)
END

FUNCTION SOE(N)
WHILE N<>0
D=N MOD 10
IF D MOD 2 = 0 THEN E = E + D
N=N\ 10
WEND
SOE = E
END FUNCTION

b) Write down the output of the following program: [2]


DECLARE SUB ABC(W$)
A$ = “CPU"
CALL ABC(A$)
END

SUB ABC(W$)
L = LEN(W$)
FOR I =1 TO L
M$ = MIDS(WS, I .1)
P = ASC(M$)
K=K +P
NEXT I
PRINT K
END SUB
Ans.
This program prints the sum of ASCII codes of each character of the string A$ i. e. 67+80+85 =232.

11. Analyze the following program and answer the questions that follow: [4X1=4]
DECLARE FUNCTION XYZS(W$)
W$ = "PROGRAM"
R$= XYZ$(W$)
PRINT R$
END
FUNCTION XYZ$(W$)
K = LEN(W$)
FOR I = K TO I STEP -2
M$ = M$ + MID$(W$. I, 1)
NEXT I
XYZ$ -= M$
END FUNCTION
i) What will be the return data type of the function XYZ?
Ans. The function will return the string value.
ii) What will be the output of the program when it is executed?
Ans. It will print a reverse string comprises of alternate characters of the word PROGRAM i.e "MROP"
iii) What will be the output of the program when FOR loop is changed as FOR = 0 K?
Ans. The output of the program will be "PORM"
iv) What is the name of the operator "+" used in the program?
Ans. + operator used in the program is called string operator and the operation is called string.

12.a) Write a program to create a user-defined function using FUNCTIONEND FUNCTION


Statement to count and return the number of records present in a given data f i l e . [ 3 ]
DECLARE FUNCTION RECNT(FLNAME$ )
INPUT "Enter Data File Name": FL$
PRINT "Number of Records are : "; RECNT(FL$)
END
FUNCTION RECNT(FLNAME$)
OPEN FLNAME$ FOR INPUT AS #1
DO WHILE NOT EOF(1)
LINE INPUT #1, REC$
COUNT = COUNT + 1
LOOP
RECNT = COUNT
END FUNCTION
b) Write a program to print the following output using a sub procedure.
HTTP
HTT
HT
H
Ans:-
DECLARE SUB FORMAT(A$)
CLS
B$ = "HTTP"
CALL FORMAT(B$)
END
SUB FORMAT(A$)
L = LEN(A$)
T=38
FOR I = L TO 1 STEP -1
R$ = LEFT$ (A$, I)
PRINT TAB (T); R$
T=T+1
NEXT I
END SUB

c) Write a program which reads data from the f i l e " RESUL.DAT ” having the fields Name, Science, Maths and
Computer, and copies all the records having the percentage more than or equal to 80 to a
new file "DISTINCT.DAT" (HINT: Consider full marks is 100) [3]
Ans:-
OPEN "RESULT.DAT' FOR INPUT AS #1
OPEN "DISTINCT.DAT' FOR OUTPUT AS #2
DO UNTIL EOF(1)
INPUT #1, NAMES, SCI, MTH, CMP
TOT = SCI + MTH + CMP
PER = TOT/300
IF PER > = 80 THEN
WRITE #2, NAMES, SCI, MTH, CMP, TOT, PER
END IF
LOOP
CLOSE #1
CLOSE #2
END
Subject : optional computer--11
Group “ A”
Computer Fundamentals (20 Marks)
1. Answer the following questions.

[5x2=10] a) What is computer network? Write two advantages of network.


A computer network is the interconnection of autonomous computers and other devices with or without cable
with the purpose of sharing resources and communication. The computers or other devices between which the
communication takes place are called nodes. The cables or wireless devices which carry signal from one node
to another are called media and other equipments like hub, router, etc. which are used to increase the speed
and reliability of the network are called networking devices.
Advantages of commuter network:
Following are some of the advantages of computer network:-
i) Communication: Computer network is the fast, easy and cheap means of communication.
Services like e-mail, Internet-phone. a-fax, etc. have made the communication fast and easy.
ii) Sharing of resources: Using computer network we can share recourses like hardware (hard disk,
printer, etc.), software and services (Internet connection) which saves the cost of buying many
pieces of same device or software.
iii) Sharing of data: Many people can use the same data without having to copy it in different
departments and updating it frequently when it is changed in one place. For example, we can share
the same database of student information between account, evaluation and other departments.
When a new student is admitted and his/her data entered in the account department it will instantly
be available in all other departments without having to copy it manually.
b) What is password? Write its importance.
The secret code used to protect a document (file) or other resources from unauthorized user is called password.
If we don't want our file, folder, computer, printer or any other resource to be used by other people then we
can protect them by using password. Password provides authority to use any resource. If it was not for the
password then everyone would be able to use the Internet facility provided by the ISP’S without paying them.
Thus password helps you to protect your resource.
c) Write any four symptoms of virus infected computer.
Four symptoms of virus infected computer are:
i) Computer becomes slow.
ii) Programs do not work as expected. They start giving strange messages.
iii) Internet becomes slower than before.
iv) Strange messages appear on the screen without any proper reason.
d) Discuss any two negative impacts of computer on society.
Two negative impacts of computer on society are as follows:
i) Dependency: Once we are in a habit of doing our works with the help of computer
then it becomes very difficult to do the same without computer. We store all our
information and data (like telephone directory, income/expense records, official and
personal letters, etc.) in the computer and incase the computer does not work for some
reason then we will be unable to access those information.
ii) Digital Divide: Digital divide means the gap between those using computer and IT
facility and those not using computer and IT facility. The computer technology is
increasing the gap between them those people, society or country using computer facility
are becoming more advanced, informed and rich then dominating those not having proper
access to computer facilities.
e) What is the Internet? Mention any two services of the Internet.
The Internet is the global `network of networks The Internet runs on TCP/IP protocol and it is a public
network; i.e. anyone interested can use the Internet by fulfilling the set requirements. The Internet should not
be confused with any other network which is spread globally. All networks extend globally are not the Internet
but the Internet is the largest Wide Area Network.
Two services of the Internet are:
a) Email:-used to send and receive messages between users(Email subscribers)
b) WWW:-World Wide Web is the system of interlinked hypertext documents that are stored in many web
servers in the internet and can be accessed by any internet users.
2. Match the following. [4x0.5=2]
a) Microwave i) Detect and clean virus
b) Download ii) Copying data to removable media for save keeping
c) Anti-virus iii) unguided transmission medium
d) Backup iv) Copy from Internet server to client computer
Ans. a) Microwave iii) unguided transmission medium
b) Download iv) Copy from Internet server to client computer
c) Anti-virus i) Detect and clean virus
d) Backup ii) Copying data to removable media for save keeping

3. Choose the best alternative. [4x0.5=2]


a) Virus which infects application programs.
i) Boot Sector virus
ii) Start-up infector virus
iii) Application infector virus
iv) System infector virus
b) Internet service which is used to send message from one user to another user.
i) WWW
ii) FTP
iii) Browser
iv) E-mail
c) Provides compensation for hardware loss due to incidents like fire, theft, etc.
i) UPS
ii) Insurance
iii) Backup
iv) Password
d) MODEM converts signals:
i) Digital to analog
ii)Analog to digital
iii) Both i) and ii)
iv) None of the above.
Ans:-
a)iii) Application infector virus
b)iv)E-mail
c)ii) Insurance
d) Both i) and ii)
4. Write full form of the following abbreviations. [4x0.5=2]
a) HTML b) NITC c) WAN d) ISP
Ans:-
a. HTML — Hyper Text Markup Language
b. NITC —National Information Technology Center
c. WAN — Wide Area Network
d. ISP — Internet Service Provider
5.Write whether .the following statements are 'TRUE FALSE. [4x0.5=2]
a) Hub is used to boost the strength of signal and retransmit it.
b) Frequency power cut can be a cause for virus infection in a computer.
c) WWW is the service of the internet to copy file from one computer to another.
d) Digital Signature is used to verify the originality and ownership of electronically stored or transferred
document
Ans:-. a)FASE ) b)FALSE c) FALSE d) TRUE
6. Write technical terms for the following. [4x0.5=2]
a) Law formulated by the government for the computer and Internet users,
b) Media used to transmit data In toe forma of light..
c) Device to which all the computers connected in star topology.
d) The internet service in which hyperlinked documents are stored and transferred.
Ans, a) Cyber Law b) Optical Fibre Cable c) Hub or Switch d) WWW
Group “B” Database (10 Marks)
7. Answer the following question. [3X2=6]
a), Define field and report .
Field:-A field is a piece of .information about an item or object t. In MS Access table a field is a column.
Name, Age, Sex, Salary, post, etc- are examples of field.
Report:- A report is a database object which is created as the output for printing as required. We can - create
many reports containing different information in a database.
b) What is validation text? Why do we define validation text?
The text that appears in a alter box when the data entered by the user does not satisfy the validation
rule set for the field is called validation text. Validation text for a field is defined in the table design
view. Validation text is used to give clear message to the user that the entered data is not acceptable
and also inform the user what type of data will be accepted.
c) What is datasheet view? Write any two operations we can perform in datasheet view,
The tabular view of table, query or form id which fields are placed in column and records in rows is
called datasheet view. Two operations that can be performed in datasheet view are:
i) Add record
ii) Delete record

8. a)
Match the following. iv. Index
i.
[4x0.5= 2]Form a) Add data from one table to another
i. Form b) A column in Access table
ii. Append Query c) Make searching of records faster
iii. Field d) A customized data entry screen

Ans:- i )-d) ii)-a) iii)-b) iv)-c)

b) Fill in the blanks. [4x0.5=2]


i) -----------creates a field that allows you to choose a value from another table or from a list of values.
ii) Arranging records in given order is called----------------
iii) The default field size for text field is---------------
iv) --------is used to see what the output will look like when printed.
Ans:- i) Lookup Wizard ii) Sorting iii) 50 iv) Print Preview
Group “C” Programming (20 Marks)
9.a)Differentiate between SUB and FUNCTION procedure. [2]
SUB FUNCTION
1. SUB procedure does not return a 1. FUNCTION returns a single value (string
value or numeric)
2. SUB procedure is called using CALL 2. FUNCTION is used in the calling
statement procedure as a formula or as an expression.

b)Write functions of INPUT # and RMDIR statements


INPUT # - It is used to read one or more data from data file in the given variables.
RMDIR -- It is used to remove directory.
10. a) Write output of the following program.
DECLARE FUNCTION TEST$(A$)
CLS
C$ = "NATIONAL"
PRINT TEST$(C$)

FUNCTION TEST$(A$)
FOR X = 1 TO LEN (A$)
M$ = MID$(A$, X, I)
B$=M$+B$
NEXT X
TESTS = B$
END FUNCTION
Output:-
LANOITAN
The test$ function extracts each character from the given string from the first to the last and joins each
character before the previous character (B$=M$+B$) thus generating the reverse of string which is printed in
the main program
b) Debug the following program.
DECCLARE EVENDIG(N)
CLS
D=345265
CALL EVENDIG D
SUB EVENDIG (N)
DO WHILE N>0
R=N MOD 10
N=N\10
IF R MOD 2 =0 THEN S=S+R
WEND
PRINT” SUM OF EVEN DIGITS:”; S

SUB keyword is missing in DECLARE Statement. When a SUB procedure is called using CALL keyword then
parameter must be enclosed within parentheses; the closing statements for DO WHILE is LOOP not WEND;
SUB procedure defined must be closed by END SUB

Ans:-
DECCLARE SUB EVENDIG (N)
CLS
D=345265
CALL EVENDIG (D)
SUB EVENDIG (N)
DO WHILE N>0
R=N MOD 10
IF R MOD 2 =0 THEN S=S+R
LOOP
PRINT” SUM OF EVEN DIGITS:”;S
END SUB

11. Study the program below and answer the question that follows. [4X1=4]
OPEN “PETROL.TXT” FOR APPEND AS #1
OPEN “DIESEL.TXT” FOR APPEND AS #2
DO
INPUT “FUEL TYPE”( PETROL, DIESEL:”;T$
INPUT “QUANTIY:”;Q
INPUT “RATE:”;R
IF T$=”PETROL” THEN
WRITE#1,Q, R, DATE$
ELSE
WRITE#2 Q, R, DATE$
END IF
INPUT “ENTER ANOTHER”;A$
LOOP WHILE UCASE$(A$)=”Y”
CLOSE#1
CLOSE#2
END
a) The program opens two files .Why?
Two data files are opened to two different types of fuels (DIELES and PETROL) in separate files.
b) What are the information stored in each file?
The information stored in each file are: quantity, rate, and the current system date (DATE$ returns current system date)
c) Write only one CLOSE statement to close both the files.
CLOSE#1,#2
d) What will happen if APPEND in OPEN statements are replaced by OUTPUT?
When the program is executed for the next time all the data stored previously will be deleted as OUTPUT mode
always creates a new file and overwrite the previous file if it is already exists.

12. a) Write a program using FUNCTION... END FUNCTION to print all the vowels in the given string. [3]
Ans:-
DECLARE FUNCTION VOWEL$(A$)
CLS
INPUT "ENTER A STRING: "; W$
PRINT "VOWELS IN THE STRING: “ ; VOWEL$(W$)
END
FUNCTION VOWEL$(A$)
L = LEN(A$)
FOR X =1 TO L
C$ = MID$(A$, X, 1)
C$ = UCASE$(C$) 'CONVERT THE CHARACTER INTO UPPER CASE
IF C$="A" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN
V$ = V$ + C$
END IF
NEXT X
VOWEL$ = V$
END FUNCTION
b) Write a program using FUNCTION ... END FUNCTION to print the alternate characters of the given
string. (Hint: First. third, fifth, ... characters)
[3]
Ans:-
DECLARE FUNCTION ALTCHAR$(W$)
CLS
INPUT "ENTER A STRING: "; N$
PRINT "ALTERNATE CHARACTERS OF THE STRING ARE "; ALTCHAR$(N$)
END
FUNCTION ALTCHAR$(N$)
L = LEN (N$)
FOR X = 1 TO L STEP 2 'VALUE OF X WILL BE 1, 3, 5-----
C$ = MID$(N$, X, 1)
ST$ = ST$ + C$
NEXT X
ALTCHAR$ = ST$
END FUNCTION
c) A sequential data file "TRAVEL.TXT" contains name of passenger, number, destination and rate of
ticket. Write a program to calculate the total amount collected from the passengers going to “POKHARA”.
[3]
Ans:
OPEN "TRAVEL.TXT" FOR INPUT AS #3
DO UNTIL EOF(3)
INPUT N$, C, D$, R
IF UCASE$(D$) = "POKHARA" THEN
AMT = C * R
S = S + AMT
END IF
LOOP
PRINT "TOTAL AMOUNT COLLECTED: "; S
END
Subject: Computer Science (Optional II) 14
Group "A" (Fundamentals — 20 marks)
1. Answer the following questions: [5X2=10]
a) What is a network server?
Ans:- In client/server network, a computer that is dedicated to providing information or services in response to
external requests is called network server. In other words, it is a central computer of a network; used for shared
storage. A server may store software applications, databases, and data files for the network users. Depending on
the way a server is used, it also may be called a file sever, application server or server.
b)What is LAN topology? List the advantages of star topology.
Ans:- LAN topology refers to the physical layout or geometric arrangement of nodes and cable links in a local area
network. Network topology fall into two categories: centralized and decentralized. In a centralized topology,
such as star network, a central computer controls access to the network. This design ensures data security and
central management control over the network's contents and activities. In a decentralized topology, such as bus
and ring network, each workstation (node) can access the network independently and established its own
connections with other nodes.
Advantages of star topology are: -
• Easy to install and wire
• Easy to detect faults and to remove parts.
• No disruption to the network when adding and removing devices.

c) What is data security? List any two security measures to secure data.
Ans. Data security refers to the protection of data from different types of threats such as natural disasters, hardware
failure, criminal acts, malicious code, cyber terrorism etc. Two data security measures are:
• Valuable data files should be encrypted (converted into codes)
• Access privileges to the database should be limited and closely monitored etc.

d) Write any four symptoms that you may notice while working with the computer which is infected by
a computer virus.
Ans. We may notice the following symptoms:
• Programs in the computer may take longer time to load than normal.
• Drive light may keep flashing when we are not working with the drive.
• We may notice a list of unnecessary files with strange filename, which we have never created and
used before.
• Clicking noise may keep coming from the keyboard even if we do not press the wrong key.
• File/program size may keep changing etc.

e) What do you mean by encryption?


Ans. It is the process of converting or scrambling a message/data into unreadable form (called cipher text) by using
a key so that it can not be read by anyone other than its intended recipient. The intended recipient can apply the
key to decrypt (rearrange into original form) and read the message/data.

2. Fill in the blanks with suitable word(s): [4x0.5=2]


a) In a bus topology network, a special device called .......is placed on each end of the cable.
b) is the process of transferring data/file from a network location to the user's computer.
c) Government of Nepal introduced cyber law in the year . B.S.
d) The capability of generating/reproducing the copies of itself is called .................................
Ans. a) Terminator b) downloading c) 2061 d) replication

3. Write full form of the following: [4x0.5=2]


a) a) WORM b) FAQ c) CAD d)PCI
a) Write Once Read Many
b) Frequently Asked Question
c) Computer Aided Designing
d)Peripheral Connection Interface
4. Give the appropriate technical terms for the followings [4X0.5]
a) A banking terminal that provides customer with 24-hours deposit and withdrawal services.
b) A program or application that enables a person to search for information on the internet
c) To make a duplicate or archival copy of one or more files on a computer system
d) A standard communications protocol for the exchange of information between computer and musical
synthesizers.
Ans. a) Automated Teller Machine (ATM) b) Search engine c) Back up (I) MIDI (Musical
Instrument Digital Interface)

5. State whether true or false: [4X0.5]


a) Optical fibers are not immune to electromagnetic interference.
b) Digital signatures are used for authentication purpose.
c) Volt guard can not supply continuous power to the computer in case of power failure.
d) We can not send graphic files in emails.
Ans. a) False b) True c) True d) False

6. Select the best possible alternatives of the following: [4x0.5=2]


a) Which is the hardware component of a network
i) Device driver ii) Volt guard iii) Hub iv) None of them
b) Which is the connector of coaxial cable?
i) RJ-45 ii) BNC iii) ST iv) None of them
c)WWW is a..............
i) Protocol of Internet ii) Service of Internet iii) Language of Internet iv) Internet Browser
d) Which of the following is related with the computer ethics?
i) Not to use computer for playing games ii) Not to use computer to send e-mail
iii) Not to use software for which you haven't paid. iv) None of them
Ans.
a) — iii) b) — ii) c) - ii) d) — iii)

GROUP "B"(Database Management — 10 Marks)


7. Answer the following questions: [3X2=6]
a) What is primary key? Write any two characteristics of primary key.
Ans. A primary key is r field that is selected by the database structure designer which stores unique value in the
database. Characteristics of primary key are:
• It stores unique data so that duplication is avoided.
• It does not accept null value.

b) Why do we need to query a database?


• To allow the DBMS to locate records.
• To establish relationships or links between tables to update records. To list a subset of
records.
• To perform calculations.
• To delete obsolete records.
• To perform other data management tasks.

c) What is meant by updating a database?


Ans:In database management, it is a process of adding, modifying and/or deleting data records in order to
make the database up-to-date.
8. a) Select the best possible alternatives of the following: [4X0.5=2]
i) Default data type of Number data of MS-Access
1) Integer 2) Long Integer 3) Single 4) Double
ii)Primary Key does not accept
1) Text 2) Number 3) Null value 4) None of them
iii) Storage size of Date/Time data type is
1) 4 bytes 2) 10 bytes 3) 6 bytes 4) 8 bytes
iv) Which component allows user to edit, view and enter, data.
1) Form 2) Report 3) Query 4 ) Non of them
Ans:- i)-2 ii)-3 iii)-4 iv)-1
b) State whether true or false. [4X0.5=2]
i) Maximum field size of memo field is 255 characters.
ii) Primary key field does not contain duplicate data.
iii) * is a wildcard character that represents any one character in expression.
iv) A query can be used to modify database structure.
Ans. i)False ii) True iii) False iv) False
GROUP "C" [Programming 20 Marks]
9. Answer the following questions: [3X1=3]
a) What is a subroutine?
Ans. It is a section of a computer program that is designed to perform a specific task. Unlike the function i does not
have return value but can be called (used) from the main program as many times as i needed.
b) What happens when we open a new file in append mode?
Ans. When we open a new file in append mode, file pointer will point to the first record position and allows the
programmer to write/store records from first record onwards. If the same program is executed again, it allows to
add new records from end of file position onwards.
c) Write down the functions of KILL statement and EOFO function.
KILL statement is used to delete an existing file in a disk.
Syntax: KILL "Drive Path <filename>"
EOF( ) function is used to check the end of file position. It returns 0 if there are more records below the current
file pointer position and returns 1 if the end of file has been reached.
Syntax: EOF(file number)

10. a) Debug the following program: [2]


‘Program to read names and ages of 7 students from data line & print the name & age of youngest student.
DECLARE SUB YOUNG$(N$( ), A( ))
DIM N$(7)
DIM A(7)
FOR I =1 TO 7
READ N$(I), A(I)
NEXT I
PRINT YOUNG(N$( ), A( ))
END

SUB YOUNG(N$ ( ), A( ))
LET Y = A(l) : NAMES = N$(1)
FOR M = 2 TO 7
IF A(M) < Y THEN
Y=A(M) NAME$ = N$(M)
NEXT M
PRINT NAME$ , Y
DATA Ram,Sita,John,Shriya,Rabi,Kapil,Kamal,16,18,12,13,21,17, 19
END SUB

Ans. DECLARE SUB YOUNG(N$ ( ), A( ))


DIM N$(7)
DIM A(7)
FOR 1 = 1 TO 7
READ N$(I), A(I)
NEXT I
CALL YOUNG(N$( ), A( ))
DATA Ram,16,Sita,18,John,12,Shriya,13,Rabi,21,Kapil,17,Kamal,19
END
SUB YOUNG(N$( ), A( ))
LET Y = A(1) : NAMES = N$(1)
FOR M = 2 To 7
IF A(M) < Y T H E N
Y = A(M)
NAME$ = N$(M)
END IF
NEXT M
PRINT NAME$ , Y
END SUB
b) Write down the output of the following program:
DECLARE SUB SSS (A, B, C)
DECLARE FUNCTION PPP (X, Y)
CALL SSS (1, 2, 4)
END
SUB SSS (A, B, C)
FOR I = 1 TO C
PRINT A,
A = PPP (A, B)
NEXT I
END SUB

FUNCTION PPP(X, Y)
PPP = X*Y
END FUNCTION
Ans. 1, 2, 4, 8
11. Analyze the following program and answer the questions that follow: [4x I =4]
DECLARE SUB SSSS(A$)
DECLARE FUNCTION ZZZZ(K)
B$ = "ABCDE"
CALL SSSS(B$)
END
SUB SSSS(A$)
FOR J = I TO LEN(A$) STEP 2
M$ = MID$(A$, J, 1)
B = B +ASC(M$)
NEXT I
PRINT ZZZZ(B)
END SUB

FUNCTION ZZZZ(K)
DO WHILE K>0 '
R = K MOD 10
C=C+R
K=K\10
LOOP
ZZZZ=C
END FUNCTION
a) List the formal parameter and actual parameter of the function procedure ZZZZ.
Ans. Formal parameter : K Actual parameters: B
b) What will be the output of the program when executed?
Ans. Output will be: 3
c) What will be the output of the program if we exclude the function procedure and write PRINT B at the place of
PRINT ZZZZ(B)?
Ans. Output will be : 201
d) Will there be any change in output if we use the function ZZZZ in main module after CALL SSSS(B$) and
use SHARED B statement at the beginning of sub procedure SSSS?
Ans. No, there will not be any change in output of the program since the function will get the value of the same
variable B as actual parameter.
12. a) Write a program using FUNCTION ... END FUNCTION to count the numbers of even digits
in the given number. [3]
Ans:
DECLARE FUNCTION ISEVEN(N)
CLS
INPUT "ENTER A NUMBER"; A
DO WHILE A>0
R = A MOD 10
A =A \ 10
IF ISEVEN(R) THEN C = C + 1
LOOP
PRINT "NUMBER OF EVEN DIGITS:";C
END
FUNCTION ISEVEN(N)
IF N MOD 2 = 0 THEN
ISEVEN = -1
ELSE
ISEVEN = 0
END IF
END FUNCTION
b) Write a program to ask caller's name and telephone number and store them in a sequential data file
'MESSAGE.TXT' along with current system date and time. (No need to ask to enter another record) [3]
Ans:
CLS
OPEN "MESSAGE.TXT" FOR APPEND AS #2
INPUT "ENTER NAME:",N$
INPUT "ENTER TELEPHONE NUMBER:",PH$
LET D$ = DATE$
LET T$ = TIME$
WRITE #2, D$,T$,N$,PH$
CLOSE #2
END
c)Write a program to ask name and marks secured in English. Science and Computer, by the students and
store them in a data file 'MARK.DATA”. Make provision to ask user for another record. [3]
Ans:-
CLS
OPEN "A", #4, "MARK.DAT"
DO
INPUT "ENGLISH:", E
INPUT "SCIENCE:", S
INPUT "COMPUTER:"; C
WRITE #4, N$, E, S, C
INPUT "ENTER ANOTHER RECORD:";CH$
LOOP WHILE UCASE$(CH$) = "Y"
CLOSE #4
END
COMPUTER FOR SLC
Group 'A' Fundamentals (20 Mark)

1. Answer the following questions: [5x2=10]


a) What is Client-Serer architecture of network?
The architecture of computer network with one or more servers and other client computers and/or devices is called
client server architecture. A server provides services to the clients and the clients use the services provided by the
server .A server is more powerful and resourceful machine than the clients. There can be different types of servers
according to the service provided. For example. a server used by the clients to store and retrieve files is called file
server; server through which the clients print their documents is a print server and the sever in which web pages are
stored is called such server.
b) What is network protocol? Mention any two network protocols.
A computer network is interconnection of autonomous computers. All the computers in a network must follow same
technology to be able to properly communicate with each other. If different computers in a network follow different
system to send and receive data then communication between them will not be possible. So there are predefined set
of rules followed by all computers and devices in a network for successful communication. Those predefined set of
rules that govern the transmission in network is called protocol. Examples –TCP/IP, IPX /SPX
c) What is multimedia? Write any two hardware requirements of a multimedia system.
In the early days of computing data meant only text. Now-a-days a computer can handle different types of data such
as text, Picture, audio and video. The combination of all mentioned types of data is called multimedia. A computer
system which can handle all those types of data is called a multimedia system. To make a computer multimedia
capable some hardware need to be added in a basic computer system. They include Sound Card. Speakers.
Microphones more RAM, more Storage capacity in hard disk and CD drive to transfer data froth one computer to
another.
d) What is disk fragmentation? What should be done for a fragmented disk?
We store files in disk. As we go on saving, updating and deleting files it is not possible for the Operating System to
store a complete file in one place of the disk. So, portions of a single file are stored at different location in a disk.
This phenomenon is called disk fragmentation. The consequence of a fragmented disk is slow data access. In other
words reading and writing data becomes slow in a fragmented disk. The solution is disk de-fragmentation. There are
tools in Operating System or we can use third party utility to Defragment a disk.
In a windows system open 'My Computer | right click the disk to be defragmented and select properties| click tools
tab in the dialog box |click “Defragment Now...”button to begin defragmentation.
e) Define the terms 'Trojan' and 'Worm'.
Trojan: A computer program which hides in other files but cannot transmit or replicate itself is called a Trojan. For
a Trojan to transmit from one computer to another the host program (containing the hidden Trojan) must be copied
be user intentionally. Like computer virus most of the Trojans cause harm to the computer programs and, or data.
Worm: A worm is computer programs which can self replicate and does not hide in other files but exists at separate
file. Most of the malicious programs transmitted as e-mail attachment are worms. Most of the worms also are
harmful.
2. Fill in the blank. [4x0.5=2]
a) ------ software is used to display HTML document.
b) -------- is the protocol used in the Internet.
c) Moral values to be followed by. computer users is called-----------
d) The type of computer network confined to limited area and having physical connection is.------
Ans:-
a) Web browser b) TCP/IP c) Cyber Ethics d) LAN
3) Match the following. [4x0.5=2]
a) NIC i) Power Protection
b) KBPS ii)Network Adapter
c) UPS iii) Protocol
d) NetBEUI v) Bandwidth
Ans:- a) ii b)iv c ) i) d)iii

4) Write technical terms for the following: [4x0.5=2]


a) Method of communication that uses radio Waves. to transmit information instead of cables.
b) Message sent electronically through computer network
c) A model of network having, one or more servers and other clients,
d) A self-replicating computer program which does not need to attach itself to an existing program.

5)Write True or False. [4x0.5=2]


a) Password is a means of hardware security.
b) A sound card converts analog audio into digital signal and vice versa.
c) In star topology all the nodes are connected to a central modem.
d) Copying and using software without permission of the copyright holder is called piracy.
Ans :-
a) FALSE b)'IRUE c) FALSE d) TRUE
6)Give full forms of the following abbreviations. [4x0.5=2]
a) SMTP - Simple Mall Transfer Protocol
b) TCP/IP - Transmission Control Protocol Internet Protocol
c) FTP -- File Transfer Protocol
d) TLD - Top Level Domain
Group “B”
Database Management (10 Marks)
7. Answer the following questions [3X2=6]
a) What is database?
A database is a systematic (structured) collection of records. A database can be electronic (stored in computer) or
non-electronic (stored in paper). But the term database commonly refers to electronic database. If the collection
of information is not in structure that that is not considered as a database. Database systems have their own ways
of organizing data in structures. A common example of database structure can be in the form.
DATABASE - TABLES - RECORDS - FIELDS -- VALUES.
b) Mention any four field types used in MS-Access Table.
Text, Number, Currency, Date/Time are the four field types used in MS-Access table.
c) What is default value? Why is a default value defined in table design?
The value which will be automatically entered in a field of access table when it new record is created is called
default value. A default value is defined for a field to save time of the data entry operator if there is any common
value for a field. For example the default value for CITY field can be defined as KATIIMANDU if many records
have KATHMANDU as CITY.
8. a) Fill in the blanks. [4x0.5=2]
i.) Maximum length of text filed in Access table is------
ii.) Field used to uniquely identify records in Access table is called -------- .
iii.) A customized database object that is used to enter data is called ------- .
iv.) A query which retrieves required records from table is called -------- .
Ans
i) 255 ii) Primary Key iii) Form iv) Select Query
b) Match the following [4x0.5=2]
i.) show final result ,- (1) design view
ii.) data entry (2) report
iii.) change the table structure (3) field
iv.) each column in a table (4) form
Ans:-
i) (2) ii)(4) iii)(1) iv)-(3)
Group “C” (Programming -20 Marks)
9. Answer the following questions [3X1=3]
a) Define the terms 'Local Variable' anti 'Global Variable'
Local Variable: A variable created in procedure is not visible or accessible to any other procedure. Such type of
variable is called a Local Variable. A Local Variable can only be accessed within the module it is created in. If a
programmer wants to use the value of a Local Variable in other procedure then it has to be passed as a parameter.
Global Variable: A variable in program which does not belong to any function or subroutine is called Local
Variable. A global variable can be accessed, used and changed by any procedure in a program.
b) Mention the use of CAI.L and EXIT FUNCTION STATEMENT.
CALL statement is used to call a subroutine
EXIT FUNCTION statement is used to exit from a function without reaching END FUNCTION statement
Commonly EXIT FUNCTION is used inside select statement to come out of a function procedure when certain
condition satisfied
10.a)Write output of the following program [2]
DECLARE FUNCTION VCOUNT (A$)
X$ = "SCHOOL"
Y$ = "INSTITUTE"
IF VCOUNT (X$) >VCOUNT (Y$) THEN PRINT X$ ELSE PRINT Y$

FUNCTION VCOUNT (A$)


N$= UCASE$ (A$ )
FOR X = 1 TO LEN (N$)
C$ = MID$(N$, X, 1)
IF C$="A" OR C$="E" OR C$="I" OR C$="O” OR C$="U" THEN
V=V+1
END IF
NEXT X
VCOUNT = V
END FUNCTION
Ans:-INSTITUTE
VCOUNT function counts number of vowels of the given strung. VCOUNI' function is used in the main program to
compare number of vowels in two strings and print the string with the greater number of vowels.
b)Debug the following program. [2]
CLS
REM program to store data in file
OPEN "top10.dat" FOR INPUT AS #1
FOR i% = 1 TO 10
playername$ = "Player" + STR$( I %)
playerscore% = 1000 - (I % * 100)
WRITE playername$, playerscore%
CLOSE #2
NEXT i%
PRINT "Data written to file"
END
Ans:-
CLS
REM program to store data in file
OPEN "top10.dat" FOR OUTPUT AS #1
FOR i% = 1 TO 10
playername$ = "Player" + STR$ (i%)
playerscore% = 1000 - (i% * 100)
WRITE #1, playername$, playerscore%
NEXT i%
CLOSE #1
PRINT "Data written to file"
END
File must be opened in OUTPUT or APPE ND mode to write data. The file number must be mentioned in write statement
to write to the file otherwise data will be printed on the screen.. the file number used on CLOSE statements is not same
as the one defined in OPEN statement. CLOSE statement should not be inside loop otherwise file will be used after the
first record only.

11.Study the following program and answer the question that fallow. [4X1=4]
DECLARE SUB SHOW( ST$)
CLS
A$= “COMPUTER SCIENCE"
CALL SHOW (B$)
SUB SHOW (ST$)
L= LEN (ST$)
POST = (80 - L) /2
PRINT TAB (POST); ST$
ST$ = “EXAMNATION"
END SUB
a) What is the purpose of making SHOW sub procedure?
Ans:The purpose of subroutine SHOW is to print the given string at the centre of the screen
b) Separate formal parameter and actual parameters among A$, B$ and ST$
Ans:. B$ and A$ are actual parameters and ST$ is formal parameter.
c) Write the last statement of the main module without using the keyword CALL.
Ans:-SHOW B$
d) What will the 'PRINT A$' statement in the main module print?
Ans:-EXAMINATION
The value of formal parameter ST$ is changed to "EXAMINATIONN' in the subroutine which will change, the value
of the actual parameter A$ in the main procedure. (Example of pass by reference)
12.a)Write a program using SUB ... END SUB, to print reverse of a number. [3]
DECLARE SUB REV (N)
CLS
INPUT "ENTER A NUMBER:”;A
CALL REV(A)
SUB REV (N)
DO WHILE N> 0
R = N MOD 10
N = N \10
RV = RV * 10 + R
LOOP
PRINT "REVERSED OF NUMBER:”RV
ENDD SUB
b)Write a program, using FUNCTION ... END FUNCTION, to count vowels in the given string.[3]
DECLARE FUNCTION VOWEL (S$)
CLS
INPUT "ENTER A STRING”;P$
PRINT "NUMBER OF VOWELS IN THE STRING:” VOWEL(P$)
FUNCTION VOWEL (S$)
S$= UCASE$(S$)
FOR M = 1 TO LEN(S$)
C$ = MID$ (S$, M, 1)
IF C$="A" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN V = V + 1
NEXT M
VOWEL = V
FUNCTION
c) Sequential data file “STUDENT.TXT' contains students' name and marks secured in English.
Write program to print the name of the student securing 32 marks or more. [3]
OPEN “STUDENT.TXT" FOR INPUT AS #3
PRINT "LIST OF STUDENTS SECURING 32 OR MORE"
UNTIL EOF(3)
INPUT #3, N$, E
IF E>=32 THEN
PRINT N$
END IF
LOOP
ClOSE#3
END

Subject: Computer Science


Time: l hr 30 min
Group "A" (Fundamentals -20 Marks)
)
1. Answer the following questions: [5x2 =10]
a) Define network topology. Write any two advantages and disadvantages of computer network.
Ans: The connection pattern or arrangement of computers and other devices of the network is known as network
topology.
Advantages of computer network:-
i)Computers in a network can access network-connected hardware devices like printers, disk drives etc.
ii)Computers in a, network system share different software packages.
Disadvantages of computer network:-
i Highly efficient personnel are required to solve the problems of network.
ii.. Due to the problems in network large numbers of computers are becomes invalid.
b) What is an Internet? Write any three services of Internet.
Ans: Internet is global connection of thousands of computers of different types belonging to various networks.
Three different services of Internet are:
i. World Wide Web (WWW)
ii. Electronic Mail (E-mail)
iii. E-commerce.
c) Define cyber ethics. Write any three commandments of cyber ethics.
Ans: Computer ethics refers to kind of international law that gives awareness to the user regarding the immoral
activities in - the computing field. So, computer ethic is defined as "to follow the rules and regulation of computer
technology and not to harm other computer users knowingly.
Three instructions of cyber ethics are:
i. You should not use a computer to harm other people.
ii. You should not destroy, steal and use the computer password of other people.
iii. You should not spread false and illegal information using computers.
d) How does a virus spread from one computer to another? How do you protect computer from virus?
Ans: Computer virus is usually passed through infected files of a disk and the Internet. Some virus only transfers if you
boot your computer with an infected disk. Virus may be transferred to another computer when you copy a file from
an infected disk. Virus can be passed to the computer when you browse Internet and download files.
Computer can be protected from virus by adopting some practices. Some important ways for safe computing are
given below:
(i) Never use pirated software; it may copy virus to the computer.
(ii) Scan the mail or unknown files of Internet before using it in your computer.
(iii) Use powerful anti-virus software.
e) What is multimedia? Write the role of multimedia in classroom.
Ans: Multimedia is a technology which allows combining text, graphics, video, sound, animations and computer
programs to give the information. Multimedia plays a very important role in class room because it can play the role
of a good teacher. Students understands subject matter in a better way using this technology because it can present
subject matter with the combination of texts, sounds, graphics, animation etc.

2. Fill in the blanks with suitable words: [4X0.5 =2]


a) Bandwidth is measured in ------------- .
b) MODEM is short form of -------------------- ..
c) A computer virus is a type of program that --------------itself.
d) IT policy of Nepal was introduced in
Ans:-a) bits per second (bps). b) Modulating Demodulating c) replicates d) 2057 B.S.

3. Write the full forms of the following: [4x0.5 =2]


a) MAN b) UTP c) FTP d) HTML
Ans:
MAN - Metropolitan Area Network.
UTP - Unshielded Twisted Pair
FTP - File Transfer Protocol
HTML - Hyper Text Markup Language
4. Match the following pairs: [4x0.5 =2]
a) Multimedia i) Word document
b) Boot sector virus ii) Graphics + Text + Sound
c) Macro virus iii) Internet
d) Network iv) Software
v) Master boot record
Ans:
a) Multimedia i) Graphics + Text + Sound
b) Boot sector virus ii) Master boot record
c) Macro virus iii) Word document
d) Network iv) Internet
5.Give the appropriate technical terms of the following: [4x0.5 =2]
a) A network within a room or building.
Ans: Local Area Network
b) A program that corrupts useful data and programs.
Ans: Virus
c) A device that connects two different networks.
Ans: Gateway
d) A business through Internet.
Ans: e-commerce
6.Select the best answer: [4x0.5 =2]
a) It allows user to make communication with each other in real time.
i) Browsing ii) Chat
iii) E-mail iv) None of them.
b) Cyber law of Nepal was introduced in the year ................
i) 2057 ii) 2059 iii) 2060 iv) 2061
c) An example of anti-virus is -------------
i) PC-tool ii) McAfee
iii) Smart editor iv) Joshi virrt5 tool
d) Main component of multi-media
i) Floppy disk ii) Floppy drive
iii) Sound card iv) Magnetic tape
Ans a) Chat: b)2061 c)McAfee d)Sound card
Group "B"( Database -10 Marks)
7.Answer the following questions: [3x2 = 6]
a) Define database. Write any four data types of MS-Access.
Ans: Database is organized collection of related data which can be accessed, manipulated and updated easily .Four data
types of MS-Access are as follows: .
i. Text ii. Number iii. Currency iv. Date/Time
b) What is data sorting? Write its advantage.
Ans: Arrangement of data in ascending or descending order is called data sorting. It is easy to search required data from the
sorted data base.
c) Define query? Write any two types of query use in Access?
Ans: Query is one of the most important objects of MS-Access processing raw data to get meaningful information. We
queries to view, change and analyze data in different ways. Two different types of query are: Select queries and Action
queries.
8. a). Choose the correct answer:
i) OLE field stores
a) Number b) Text
c) Sound d) None of them
ii) Extension of database file in MS-Access
a) .MDA b) .MDB
c) .MDF d) .ADB
iii) Default sub-data type of Number data type of MS-Access
a) Integer b) Long Integer c) Single iv)Double
iv) Primary key does not accept
a) Text b) Null Value
c) Number d) None of than
Ans:- i-c) ii)-b) iii)-b) iv-b)

b) Match the following:


i) Query ( ) Printed format
ii) Form ( ) Stores data
ii )Table ( ) Extracts selected record for view
iv) Report ( ) Allows view, edit, input data ( ) Allows filtering data d) Double
Ans:
i) Query ( ) Extracts selected record for view
ii) Form ( ) Allows view, edit, input data
iii) Table ( ) Stores data
iv) Report ( ) Printed format
Group "C" ( Programming -20 Marks)
9.Answer the following questions: [3x1 = 3]
a) What do you mean by procedures? Write its types.
Ans: Procedures are sub-modules which are written under main-module or main program. A main-module may have one or
more procedures. Different types of procedures used in QBASIC are Sub procedure and Function procedure.
Differentiate between local and global variable.
Ans:
Local Variable:-
Variable which is only accessible within a particular module is called local variable or it is not accessible from another
module. Value of local variable is destroyed when execution of module is over.
Global Variable:-
The variable which can be accessed from any module or procedure is called global variable. Value of global variable is
not destroyed during the execution of program.
c) Write the function of "Name" and "Kill" statements.
Ans: NAME Statement is used to rename a file or directory.
KILL Statement is used to delete files from a disk.
9. a) Debug the following program:
REM To find sum of 10 numbers
DECLARE FUNCTION SUM (N( ))
DIM N(10)
CLS
FOR j = 1 TO 10
INPUT "Enter Any Number"; X(j)
NEXT j
PRINT "Sum of even numbers:"; SUM(X(10))
END
FUNCTION SUM (N( ))
S=0
FOR K = I TO 10
IF N(K) MOD 2 = 0 THEN S$=S$+N(K)
END IF
NEXT K
S=SUM
END FUNCTION
Ans:-
DECLARE FUNCTION SUM (N( ))
DIM N(I0)
CLS
FOR j=1 TO 10
INPUT "Enter Any Number"; X(j)
NEXT j
PRINT "Sum of even numbers:"; SUM(X( ))
END

FUNCTION SUM (N( ))


S=0
FOR K = I TO 10
IF N(K) MOD 2 = 0 THEN S = S + N(K)
END IF
NEXT K
SUM = S
END FUNCTION

b) Write the output of the following program:


DECLARE SUB TEST(N)
CLS
FOR J = 1 TO 5
READ X
CALL TEST(X)
NEXT J
DATA 2,3,4,5,6
END
SUB TEST (N)
PRINT N A 3,
END SUB
.Ans: Output:- 8 27 64 125 216
11.Read the following program and answer the questions given below: [4x1 =4]
DECLARE SUB series (A, B)
CALL series(2, 3)
END
SUB series (A, B)
CLS
C=0
FOR J=1 TO 5
PRINT A,
C=A+B
A=B
B=C
NEXT J
END SUB
a) List the variables used in SUB procedure
Ans: Variables of SUB procedure are A, B, C and J.
b) Write the output of the program when executed.
Ans: Output: 2 3 5 8 13
c) What will be the value of variable "C " when loop completes third time.
Ans: The value of variable C= 13.
d) What will be the output if SUB procedure is called with "CALL series(l, 1)"
Ans: Output:- 1 1 2 3 5
12. a) Write a program to declare sub-procedure module to display area of rectangle where user inputs data in the main
module. [3]
Ans:-
DECLARE SUB AREAREC (L, B)
INPUT "Enter Length::"; X
INPUT "Enter Breadth::"; Y
CALL AREAREC(X, Y)
END
SUB AREAREC (L, B)
A=L*B
PRINT "Area of Rectangle''; A
END SUB

b. Write a program to declare function-procedure to print t supplied string in alternate capital letters. Suppose user inpu
"NEPAL" then output should be "NePaL". [3 ]
Ans:-
DECLARE FUNCTION ALTCAPS$ (N$)
CLS
INPUT "Enter String”; A$
AC$ = ALTCAPS$(A$)
PRINT "ALTERNATIVE CAPS ="; AC$
END
FUNCTION ALTCAPS$ (N$)
FOR I = I TO LEN(N$)
C$ = MID$(N$, I, 1)
IF I MOD 2= 1 THEN
W$ =W$ + UCASE$(C$)
ELSE
W$ = W$ + LCASE$(C$)
END IF
NEXT I
ALTCAPS$ = W$
END FUNCTION
c. A data file named "Employee.Dat" contains Name, Post an Salary for number of employees. Write a program to display data for the
employees whose salary is between 8000 to 12000. [3 ]
Ans:
OPEN "EMPLOYEE.DAT" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, N$, PS, S
IF S >= 8000 AND S <= 12000 THEN
PRINT N$, P$, S
END IF
LOOP
CLOSE #1
END
Subject: Computer Science F.M. 50
Time: 1hr 30 min P.M. 16
Group "A"
Fundamental (20 marks
1.Answer the following questions: [5X 2 = 10]
a)What are protocols? Write the names of common protocols of network?
Ans: Protocols are the set of rules that the computers in the network must follow to communicate and to exchange data with each other.
They are used to make a logical connection between different computers and transfer data from one computer to another. The names of
common protocols of network are as follows-:
i. TCP/IP
ii. ARP
iii. HTTP
iv. FTP
v. SMTP
vi. POP
b)What is e-mail? Write the advantages of e-mail?
Ans: E-mail is the world's largest electronic mailing system which is a most popular service of the Internet. It is an easy medium to
exchange of messages between the computers. More than 25 million people are directly connected to the Internet and can send receive
electronic mail.
The main advantages of e-mail are, it is very fast, easy and cheaper than any other means of communication.
c)What do you mean by multimedia? Name any five types o used in multimedia technology?
Ans: Multimedia is the combination of different media. The multimedia is made up of two separate words: 'multi' `and ` which means
many and materials, through which informed** transmitted.
i. Text
ii. Graphics
iii. Video
iv. Sound
v. Animation
d)What is computer virus? How does a virus spread from one computer to the another?
Ans: Computer virus is a computer program, which replicates itself by making copies of itself without the user's
knowledge. The programmer with the intent of destroying or damaging the data and programs residing in the
computer system writes it. It interferes the normal functioning of the computer.
Virus spread from one computer to another in various ways. It is usually passed through the infected files of the disk.
Some viruses transfer if you boot your computer with an infected disk while other can infect your system when you
copy a file from an infected disk. Ii is also passed when you download a file from the Internet or access data or
programs in a network.
e)What is computer security? Write any three measures to protect data and software from virus.
Ans: Computer security means security provided to protect hardware, software and data from intentional, accidental
and natural disaster.
Four different measures to protect data and software from virus are a,. follows:
i. Do-not use pirated software.
ii. Use anti-virus software to early detect the virus.
iii. Scan the mail or unknown' files of Internet before opening in your computer.
iv. Back up all important data and software.

2) Fill in the blanks: [4x0.5 =2]


a) Sever is a main computer which provides services to the clients,
b) E-commerce is buying and selling products and services online using Internet.
c) Multimedia is combination of text, graphics, audio, animation, and video.
d) Cyber law of Nepal was introduced in 2061
5.Match the following: [4x0.5 =2]
a. FTP i) Internet explorer
b. Web browser ii) Protocol
c. CD-ROM iii) Power regulator device
d. UPS iv) Storage device
v) Primary memory
Ans:
a)-ii) b)-i) c)-iv) d)-iii)
4.Write the full forms of the following: [4x0.5 =2]
a) HTTP b) FTP c) NIC d) LAN
Ans:
a. HTTP Hypertext Transfer Protocol
b. FTP Files Transfer Protocol
c. NIC Network Interface Card
d. LAN Local Area Network.
5.Give the appropriate terms of the following: [4x0.5=2]

a. A device that forwards


signals between networks in network traffic.
Ans: Router
b. A physical layout of
network through which network devices are connected.
Ans: Network Topology
c. A device that connects two
dissimilar networks.
Ans: Gateway ,
d. The moving graphic
images.
Ans: Animation
6.Select the best answer: [4x0.5=2]

a)The device which is used to convert analog signal into digital signal and vice-versa.
i) Processor
ii) MODEM
iii) Data cable
iv) Memory .
Ans: MODEM
b)Cyber law refers to the laws regarding the
i) Hardware and software
ii) Computer System
iii) Internet and cyberspace
iv) Computer programmer
Ans: Internet and cyberspace
Which is not computer virus?

i) Boot sector virus


ii) File virus
iii) Micro virus
iv) Macro virus
Ans: Micro virus
Network with a city which is control by single organization
i) Wide Area Network
ii) Local Area Network
iii) Metropolitan Area Network
iv) Campus Area Network
Ans: Metropolitan Area Network,

Group "B"
MS-Access (10 marks)
7. Answer the following questions.

a. What is database? Give an example of manual database.


Ans: Database is defined as collection of related and organized information that can be used for different purposes. It
arranges the information in such a way that any specific piece of information can be easily accessed. An example of
manual database is dictionary.
b. What is primary key? Write any two. characteristics of primary key.
Ans: A primary key is a field that is chosen by the database designer which stores unique value in the database.
Characteristics of primary key are:
i. It stores unique data, so, it controls duplication of data.
ii. It does not accept null value.

c. Differentiate between field and record.


Ans-: Field is a place where one types of information is stored. It is the smallest unit of a database. For example, in a
table student's name, address, and telephone are called field names.
Whereas a record is defined as a collection of multiple related fields, which may give complete information about a .
person or thing. For example name, address, post, salary and telephone of a person is a record.
.
8.a) Choose the correct answer:
i)Storage size of date/time data type.
a. 8 bytes b. 4 bytes c. 3 bytes d. 32 bytes
ii) Which component allows user to edit, view and enter data.
a. Form b. Report c. Query d. None of them.
Ans: Form
iii)Extension of database file of MS-Access is ....
a. .MSD b. .MDBc. . DBF d. None of them
Ans:MDB
iv)Which of the following is database software?
a. MS-DOS b. MS-Accessc. MS-WORD d. MS-EXCEL
Ans: MS-Access
b)State whether the following statements are true or false: 4x0.5 =2
a) Memo field accepts maximum 32767 characters. (T)
b) DBMS is a of word processing software. (F)
c) OLE data type stores picture. (T)
d) A row is called field name. (F)
Group "C"
Programming (20 marks)
9) . a. Define main module and sub module? 1

Ans: In QBASIC, program entry point is called main-module. It is located at the top of other modules. The main-
module is the controlling section of a modular programming.
b.What is function procedure? Write the types of function procedure. 1
Ans: Function procedure is a module which is written under main module. Function procedure accepts data as
parameter/parameters and returns value after manipulating the data.
Differentiate between Append and Output mode. 1
Ans: Append mode adds data to the existing data file. If specified file is not located it creates new data file.
Output mode creates new data file. If specified file is located then it erases the existing file and creates new one.

10) a. Debug the following program:


REM TO PRINT MULTIPLES
CLS
DECLARE MUL (N)
INPUT "Enter no"; A
CALL MUL ( )
END

SUB MUL (N)


1=1
WHILE I >= 10
PRINT N*I
1=1+1
LOOP
SUB END
Ans:
REM TO PRINT MULTIPLES
DECLARE SUB MUL (N)
CLS
INPUT "Enter no"; A
CALL MUL ( A)
END
SUB MUL (N)
I=1
WHILE I <= 10
PRINT N*I
I=I+ 1
WEND
END SUB

b)Find the output of the following program.


DECLARE FUNCTION XYZ(N)
LET V= 435
LET RV= XYZ (V)
PRINT RV
END

FUNCTION XYZ (N)


S=0
WHILE N< >0
R=N MOD 10
S=S+R
N=N\10
WEND
XYZ=S
END FUNCTION
Ans:- Output is 12.
11 Read the following program and answer the questions given below:
DECLARE SUB XYZ (N$)
INPUT "Enter word:"; M$
CALL XYZ (M$)
END SUB
SUB XYZ (N$)
FOR 1=1 TO LEN(N$) PRINT LEFTS (N$, I) NEXT I
END SUB
a) How many times loop executes if input string is "PATAN"?
Ans: Loop executes five times, if input string is "PATAN".
b) Which type of data is assigned in the variable name N$?
Ans: String type of data is assigned in the variable name N$.
c) What will be the output if input string is "KATHMANDU"?
Output is:
K
KA
KAT
KATH
KATHM
KATHMA
KATHMAN
KATHMAND
KATHMANDU
d)What will be the output if you change RICHTS(NS, I) in place of LEFTS(NS, I ), if input string is "KATHMANDU".
Output:
U"
DU
NDU
ANDU
MANDU
HMANDU
THMANDU
ATHMANDU
KATHMANDU

12.a. Write a sub-program to check whether input number is Even or Odd. User inputs data in the main program.
Ans:
DECLARE SUB MUL(N)
INPUT "ENTER A NUMBER:";X
CALL MUL(X)
END

SUB MUL(N)
R = N MOD 2
IF R=0 THEN
PRINT N; "is even"
ELSE
PRINT N; "is odd"
END IF
END SUB
b. Write a program to define a user defined function to find HCF of, two numbers. User should input numbers in the main
module and pass to the function as parameters. [3]
Ans:
DECLARE FUNCTION HCF (A, B)
CLS
INPUT "Enter first number:"; X
INPUT "Enter second number:"; Y
H = HCF(X, Y)
PRINT "HCF= "; H
END
FUNCTION HCF (A, B)
WHILE B 0
C = A MOD B A=B
B.=C
WEND

HCF =_A END FUNCTION


c. Write a program to create a sequential file ITEM.DAT and store item code, item name and rate. The program should
prompt user to enter more data or to terminate program. 3 Ans:
OPEN "0", #1, "ITEM.DAT"
DO
INPUT "Enter item cede:"; IC
INPUT "Enter item name:"; IN$
INPUT "Enter item rate:"; IR
WRITE #1, IC, INS, IR
PRINT
INPUT "Wants to supply more YIN:"; C$
LOOP WHILE UCASE$(C$) = "Y"
CLOSE #1
END

S-ar putea să vă placă și