Top Banner
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
80

Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Nov 16, 2014

Download

Documents

nilshankar12

Solution of all question answers of computer of class 10 suitable for slc students
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Subject: Computer science (Optional II) 2Group 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) replication3. 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 networkc. 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

Page 2: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

b ) Callback ii) Virusc) Hacking iii) Dr. Berners-Leed) Malicious Program iv) Computer Security

Ans. a —iii b— iv c— i d- ii5. Write full forms of the following: [4x0.5=2]

a) ARPANET b) VAT c) JPEG d) MSAVAns. 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 cyberspacec) 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) crosstalkGroup 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)Falseb. Suggest the appropriate field types for the following fields. [4x0.5=2]

i)Item Name ii) Item Photograph iii)Item Description iv)Item PriceAns. 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$)

Page 3: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 TWELVEREAD MTH$IF M = N THEN PRINT "CURRENT MONTH IS ";MTH$NEXT MDATA 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 DATEDT$= 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 MDATA JAN, FEB, MAR, APRL, MAY, JUNE, JULY, AUG, SEPT, OCT, NOV, DECEND SUBb. Write the output of the following program. [2]DECLARE FUNCTION RESULT (N)PRINT RESULT (16)ENDFUNCTION RESULT (N)WHILE N<>0A=N MOD 2N=N \2 E$=STR$(A)F$=ES+F$.WENDRT=VAL (F$) RESULT=RT END FUNCTIONAns. 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 variableb)00001c)000d)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$)ENDFUNCTION ALTC$(W$) L=LEN (W$)

Page 4: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

FOR i= I TO L STEP 2M$=MID$(W$, i, 1)X$=X$+M$NEXT iALTC$=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 NK=NCALL ARMS (N)IF C = K THEN PRINT "ARMSTRONG" ELSE PRINT "SORRY"END

SUB ARMS (N)SHARED CDO WHILE N<>0R=N MOD 10C=C+R^3N=INT (N/10)LOOPEND 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 #1DO WHILE NOT EOF(1)

INPUT #1, K$, MC=C+l

LOOPCLOSE #1DIM N$(1 TO C), P (1 TO C)OPEN "RESULT.DAT" FOR INPUT AS #2FOR I = 1 TO C

INPUT #2, N$(I), P (I)NEXT ICLOSE #2FOR X = 1 TO C- 1

FORY=X+1 TO CIF P(X) < P(Y) THENSWAP P(X), P(Y)SWAP N$(X),N$(Y)END IF

NEXT YNEXT XFOR Z= 1 TO CPRINT N$(Z), P(Z)NEXT Z

Page 5: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 corruptedresults 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 Busc) URL — Uniform Resource Locatord) UTP — Unshielded Twisted Pair

3. Match the following.a) Fiber Opticsb) FTPc) UNIXd) Cnn.com

i. domain nameii. signal in the form of light

iii. copy files one computer to anotheriv. Network Operating System

Ans: a)–ii b)-iii c)– iv (d)-i4. 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

Page 6: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 isal 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, KathmanduInformation: 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, MarriedAns: Phone number – text

We don't use phone number for any calculation but we may want to use symbols like -, ( ) etc Photo – OLE objectSalary – CurrencyMarried – 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 and records from the table or another query

Update query is used to change data in one or more fields of all or selected records of the table.

Opening a Select Query does not make any change in the data of the table

Opening an Update Query makes changes in the data 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)TrueGroup '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 sequential data file into string variable

INPUT# reads data from a sequential data file into one or more variables

Page 7: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Reads whole line of data not affected by the comma used to separate the data items

Reads each item separated by comma into separate 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", 12with the statement LINE INPUT #2, A$ ;A$ will have value: "School", "Kathmandu", 12

with the statement INPUT#2, A$, B$, C willhave the values A$= "School", B$= "Kathmandu”and C= 12

. b) Mention the use of CHAIN and DECLARE SUB statements.CHAIN transfers control to another programDECLARE 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 programDECLARE FUNCTION NEXTTERM (T)CLSX = 7FOR I = 1 TO 10 PRINT X;X=NEXTTERM(X)NEXT IEND

FUNCTION NEXTTERM (T)IF T MOD 2 = 0 THENT = T /2 ELSET = T * 3 + 1END IFNEXTTERM =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.

CLSREM PROGRAM TO DISPLAY DATA IN A TEXT FILEOPEN "TEST.DAT" FOR INPUT AS $2

DO WHILE EOF(2)LINE INPUT A$ PRINT A$LOOPCLOSE #2END

Ans:CLSREM PROGRAM TO DISPLAY DATA IN A,TEXT FILEOPEN "TEST.DAT" FOR INPUT AS #2DO UNTIL EOF(2)

LINE INPUT #2 , A$PRINT A$

LOOPCLOSE #2END

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),

Page 8: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

D$ = MID$(A$,4, 2)F$ = "ATD" + M$ + D$+”.TXT”OPEN F$ FOR OUTPUT AS #2DO INPUT "NAME OF THE STUDENT (EXIT TO STOP): "; N$IF UCASE$(N$) = "EXIT" THEN EXIT DOPRINT #2, N$LOOPCLOSE #2END

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)CLSINPUT "ENTER A NUMBER: "; ACALL SQ(A)SUB SQ (N)

PRINT "SQUARE OF NUMBER: "; N"2PRINT "SQUARE ROOT: "; SQR(N)

END SUBb) Write a program, using FUNCTION ... END FUNCTION, to print the highest digit in a number.

DECLARE FUNCTION HIGH (N)CLSINPUT "ENTER NUMBER: "; APRINT "HIGHEST DIGIT IN THE NUMBER IS "; HIGH (A)ENDFUNCTION HIGH (N)H = N MOD 10DO WHILE N 0

N = N \ 10R = N MOD 10IF R > H THEN H = R

LOOPHIGH = HEND 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".

CLSOPEN "KATH.TXT" FOR OUTPUT AS #3DO

INPUT "NAME: ";N$INPUT "SEX (MALE/FEMALE): ";S$INPUT "DISTRICT: ",D$IF UCASE$(D$) = "KATHMANDU" THEN

WRITE #3, N$,S$,D$END IFINPUT "ENTER ANOTHER RECORD (Y/N)";C$

LOOP WHILE UCASE$(C$) = "Y"CLOSE #3

_ END

Page 9: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 Cardc) Write Once Read Many d) Internet Relay Chat

3. Match the following: : [4X0.5=2]a) Intellectual property i) Novel Netwareb) Program ii) DVDc) Network OS iii) Virusd) Mass storage iv) Copyright law

v) WAN4. 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 extension5. 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.

Page 10: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 aboveb) Which of the following is used to connect two LANs using same LAN protocols? i) Routers ii) Connectors iii) Gateways iv) Non of the abovec) 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 serverd) Which of the following is/are not related with multi-media computer?i) Graphics card ii) Sound card iii) LAN card iv) Display cardAns:-(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. IDii) 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/noiv) 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)—2b) 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) TrueGroup 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:

DECLARE SUB SSS (A, B, C)DECLARE FUNCTION PPP (X, Y)

[2]

Page 11: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

CALL SSS (2, 2, 5)SUB SSS (A, B, C)FOR I = I TO C PRINT AA = PPP (A, B)NEXT IEND SUB

FUNCTION PPP(X, Y)PPP = X*YEND 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 #1OPEN "XYZ.DAT" FOR INPUT AS #2DO WHILE NOT EOF(I)INPUT #1, NAME$, SCORENSCORE=SCORE + SCORE*5/100WRITE #2, NAMES, SCORELOOPCLOSE #1KILL " 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 ScorelOPEN "STD.DAT" FOR INPUT AS #1OPEN "XYZ.DAT" FOR OUTPUT AS #2DO WHILE NOT EOF(l)INPUT #1, NAME.$, SCORENSCORE=SCORE + SCORE*5/100WRITE #2. NAME$, NSCORELOOPCLOSE #1 CLOSE #2 KILL " STD.DAT"NAME "XYZ.DAT" AS "STD.DAT"

END11. Analyze the program given below and answer the questions that follow. [4x1=4]

DECLARE FUNCTION TEST$(N)INPUT "Enter a number"; NUMPRINT TEST$(NUM)ENDFUNCTION TEST$(N)K=0FORC=ITONIF N MOD C = 0 THENK = K + 1END IF NEXT CIF K= 2 THENTEST$ = “ COMPOSITE" ELSETEST$ = “PRIME" END IFEND FUNCTIONa) Why is the $ sign followed in function name?Ans. Because the function name TEST returns string value (i.e. "PRIME" or "COMPOSITE") after processingb)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

Page 12: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 5INPUT NUM(X)NEXT XCALL 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 " ; GEND 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$)ENDFUNCTION WCOUNT(S$)CNT=0FOR X = I TO LEN(S$)M$ = MID$(S$. X, 1)IF M$ = " " THEN CNT = CNT + 1NEXT NW=CNT+1WCOUNT = NWEND 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 #1PRINT TAB(20); "Out Dated Employee"DO UNTIL EOF(1)INPUT # 1, N$, SY, A

IF A > 60 AND SY > 20 THENPRINT TAB(20) ;N$CNT = CNT + 1END IF

LOOPPRINT TAB(20) ; "Number of out dated employees " ; CNTCLOSE #1END

Page 13: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Subject: Computer Science (Optional II).............6Group "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 Programs3. Write the full form of the following:-

a)UTP b)POP c)DVD d)NAVANS:-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 servicesc) A device used at the end user’s computer of a network which convert digital signals into analog signal and vice

versad) 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.

Page 14: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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) interactiveb) Fiber optic cable ii) Softwarec) Multimedia iii) Protocold) Anti-virus iv) Guided mediaAns. 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 columnsii) Field 2) Collection of recordsiii) Table 3) Facts and figuresiv) 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 lineDECLARE FUNCTION SQU(N) FOR I =1 T0 6READ NUMK = NUM MOD 2IF K = 1 THEN PRINT SQU(NUM)

Page 15: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

NEXT IDATA 3. 4, 13, 16, 23,36,48ENDFUNCTION SQU(N)A=N^(1/2)A = SQUEND FUNCTION

Ans:-REM Program to print the square root of even numbers read from data lineDECLARE FUNCTION SQU(N) FOR I =1 T0 7READ NUMK = NUM MOD 2IF K = 0 THEN PRINT SQU(NUM)NEXT IDATA 3, 4, 13, 16, 23, 36 48ENDFUNCTION SQU(N)A=N^(1/2)SQU=AEND FUNCTION

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

DECLARE SUB PEACE(W$)A$ = "LOKTANTRA" CALL PEACE(A$)ENDSUB PEACE(W$) C=5 : N= 1 : T=39FORI=1TO5PRINT TAB(T); MIDS(W$, C, N)T=.T-1C= C-1 N=N+ 2 NEXT IEND SUB

Ans.:-A

TANKTANT

OKTANTRLOKTANTRA

11. Analyze the following program and answer the questions that follow: [4X1=4]DECLARE SUB SSS(N)CLSINPUT”ENTER A NUMBER”;ACALL SSS(A)ENDSUB SSS(N)FOR I =1 TO NPRINT N;IF N MOD 2=0 THENN=N/2 ELSEN = N*3+1END IFIF N = I THEN EXIT FOR

Page 16: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

NEXT IEND 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-1Ans: 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$)CLSINPUT "ENTER A FILE NAME": FL$PRINT "NUMBER OF RECORDS";RCOUNT(FL$)END

FUNCTION RCOUNT(F$)OPEN F$ FOR INPUT AS #1DO UNTIL EOF(l)LINE INPUT #1, REC$CNT = CNT + 1LOOPCLOSE #1RCOUNT = CNTEND 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$)CLSINPUT "ENTER A FULL NAME";NAME$CALL ABBV(NAME$)ENDSUB ABBV(N$)K$ = MID$(N$,1.1)L = LEN(N$)FOR X =2 TO LM$ = MID$(N$, X, 1)IF M$="" THEN KS = K$ + MID$(N$, X+1, 1)NEXT XPRINT 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

Page 17: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

CLOSE #1, #2KILL "SALES.DAT"NAME "TEMP.DAT" AS "SALES.DAT"OPEN "SALES.DAT" FOR INPUT AS #3PRINT "S. No.", "Item Name", "Rate", "Quantity", "Amount"DOINPUT #3, S, N$, RT, QTY, AMTIF AMT > 5000 THEN

PRINT S, N$, RT, QTY, AMT END IF

LOOP UNTIL EOF(3)CLOSE #3END

Page 18: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Subject: Optional 11 (Computer Science) .....7Full 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) Effectiveii) Attractiveiii) Informativeiv) 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-maili i i) Telnetiv) 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.orgIn 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.

Page 19: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

2. Choose the best alternative. [4x0.5=2]a) Which of the following is not the device necessary to make a multimedia - - - - - - - - - -

a. Sound Cardb. Microphonec. UPSd. Speaker

b) Nepal information Technology Policy was introduced in:i. 2061 BSi. 2057 BSii. 2063 BSiii. 2047 BS

d) Which medium is not affected by electromagnetic interference?ii. Microwaveiii. Optical fibre cableiv. Coaxial cablev. STP cable

c) An ISPi) Hardware supplierii) Software companyiii) Provides printing serviceiv) Provides Internet access

Ans.a) -iii) UPS b)-ii) 2057BSc) -iv) Provides Internet access d)-ii) optical fibre cable

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

a) LANb) NAVc) WWWd) N I C `

i. Internet Serviceii. Confined within a premisesiii. Connect network cable to computeriv. 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) MODEM5. 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) - TRUE6. Write full forms of the following abbreviations. [4x0.5=2]

a) N ITCb) MODEMc) POPd) DVD Ans:-

a. National Information Technology Centerb. Modulator Demodulatorc. Post Office Protocold. Digital Versatile Disk

Page 20: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 tableAction 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 fieldii)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 charactersii) Memo B) Final result of databaseiii) Unique data C) Software to manage informationiv) 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)CLSM = 214517PRINT AA(M)ENDFUNCTION AA(X)DO UNTIL X=0

Page 21: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

R=X MOD 2

X=X\10

IF R MOD 2<>0 THEN C=C+1

LOOPAA = 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 AGEOPEN "NOTE.TXT" FOR APPEND AS #1DO WHILE EOF (1)

INPUT NS, APRINT , N$. AS = S + AC=C+1

WENDPRINT "AVERAGE AGE: " ; S / CCLOSE #1END

Ans.: REM PROGRAM TO READ DATA FROM FILE CONTAINING NAME AND AGE ANDREM PRINT THE AVERAGE AGEOPEN "NOTE.TXT" FOR INPUT AS #1DO UNTIL EOF (I)

INPUT #l, N$, APRINT , N$, AS=S+AC=C+1

LOOPPRINT "AVERAGE AGE: " ; S / CCLOSE #1END

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$)CLSA$ = "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.: LOOHCSThe program prints the reverse of the string

Page 22: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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$)CLSINPUT "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 = 7FOR C = 1 TO 10

PRINT XX = NEXTTERM (X)

NEXT CEND

FUNCTION NEXTTERM (N)IF N MOD 2 = 0 THEN

NEXTTERM = N / 2ELSE

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)

CLSOPEN "STUDENT.DAT" FOR INPUT AS #1PRINT "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" THENPRINT N$, C, R, S$

END IFLOOP CLOSE #1END

Page 23: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Subject: Optional II (Computer Science) ....9 SEND[2063]

SEDIPSGroup `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 Networkc) 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

Page 24: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

3.Match the following. [4x0.5=2]a) HTMLb) Coaxial cable c) Telnetd) Repeater

i. login to another computer in the Internet ii. improves strength of signal

iii. Languageiv. guided medium

a) HTML b) Coaxial cable c) Telnetd) Repeater

iii) languageiv) guided mediumi) login to another computer in the Internet ii) improves strength of signal

Page 25: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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) UPSb) NITDCc) NICd) SMTPAns: a) UPS — Uninterruptible Power Supply

b) NITDC — National Information Technology Development Councilc) NIC — Network Interface Cardd) 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) formB) fieldC) recordD) report

ii)-------------is the suitable data type for salary field.A) textB) OLE/ObjectC) current)

Page 26: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

D) memoiii)-------------is a row in MS-Access table.

A) databaseB) fieldC) queryD) record

iv)------------------view is used to see output before printing.A) FormB) DatasheetC) DesignD) 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

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 IFNEXT XVOWEL$ =B$END FUNCTION.

Ans: 6The 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( ) )CLSDIM N(10)FOR X = 1 TO 10

INPUT "NUMBER'. ", N(X)NEXT XPRINT "HIGHEST NUMBER IS:"; CALL HIGHARRAY(A())END

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

a

Page 27: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

FUNCTION HIGHARRAY (A)H=A(1)FOR I= 2 TO 10

IF A ( i ) > H THEN H = A(I)NEXT IHIGHARRAY = HEND FUNCTION

Ans: DECLARE FUNCTION HIGHARAAY (A( ) )CLSDIM N(10)FOR X = 1 TO 10

INPUT "NUMBER: "; N(X)NEXT XPRINT "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 IHIGHARRAY = HEND FUNCTIONThe declare statement declares a SUB procedure whereas we are using a function in our program so the keyword SUB should be replaces by FUNCTION. 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 with array A( ) so A( )should be replaced by N() while calling the function. As we are passing 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)CLSDO INPUT "ENTER A POSITIVE NUMBER: "; NLOOP UNTIL N>=0CALL ABC(N) SUB ABC (A) PRINT A^2

PRINT SQR(A)END SUBa) What will be the output of the program i f the user inputs 9?

813

Square and Square-root of the given numberb) 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 i f 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 NThe 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)CLSINPUT "ENTER LENGTH IN METER: " ; APRINT "LENGTH IN INCH IS: "; MET2INCH(A)END

Page 28: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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$)CLSINPUT"ENTER STRING: "; X$PRINT "REVERSE OF THE STRING IS:”;REVERSES (X$)END

FUNCTION REVERSE$(ST$)L = LEN(ST$)FOR C = 1 TO LB$ = MID$(ST$, C , 1) R$ = B$ + R$NEXT CREVERSE$ = R$END FUNCTION

The FOR loop can also be written as:FOR C = L TO 1 STEP -1B$ = MID$(ST$, C, 1)R$ = R$ + B$NEXT CEither 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)

CLSOPEN "RECORD.TXT" FOR INPUT AS #5PRINT "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 THENPRINT N$, A, M$

END IFLOOPEND

l

Page 29: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Subject: Computer Science (Optional II) 10Group "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 mediab) ..................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 2403. Write full forms of the following: [4X0.5=2]

a) STP b) MCGA c) DNS d) SIMMAns. a) Shielded Twisted Pair b) Multi Color Graphics Array

c) Domain Name Service d) Single Inline Memory Module4. 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 character5. 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]

Page 30: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

a) Microwaveb) Sound cardc) UPSd) TCP/IP

i. Multi-mediaii. Unguided media

iii. Power protection deviceiv. 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)OLEii) Input maskiii) Indexingiv) Auto Number

1) Easy search2) Field type3) Printing data4) Entry format5) Excel chart

Page 31: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 APRINT SOE(N)ENDFUNCTION SOE(N)WHILE N< 0D = N MOD 10IF D MOD 2=1 THEN E=E+D N=N\ 10WENDE=SOEEND FUNCTION

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

FUNCTION SOE(N)WHILE N<>0D=N MOD 10IF D MOD 2 = 0 THEN E = E + D N=N\ 10WENDSOE = 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$)

Page 32: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

K=K +PNEXT IPRINT KEND 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$ENDFUNCTION XYZ$(W$)K = LEN(W$)FOR I = K TO I STEP -2

M$ = M$ + MID$(W$. I, 1)NEXT IXYZ$ -= M$END FUNCTIONi) 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 FUNCTIONStatement 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$)ENDFUNCTION RECNT(FLNAME$)OPEN FLNAME$ FOR INPUT AS #1DO WHILE NOT EOF(1)LINE INPUT #1, REC$COUNT = COUNT + 1LOOPRECNT = COUNT END FUNCTION

b) Write a program to print the following output using a sub procedure. HTTP HTT H T H

Ans:-DECLARE SUB FORMAT(A$)CLSB$ = "HTTP"CALL FORMAT(B$)ENDSUB FORMAT(A$)L = LEN(A$)T=38FOR I = L TO 1 STEP -1

Page 33: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

R$ = LEFT$ (A$, I)PRINT TAB (T); R$T=T+1NEXT IEND 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 #1OPEN "DISTINCT.DAT' FOR OUTPUT AS #2DO UNTIL EOF(1)

INPUT #1, NAMES, SCI, MTH, CMP TOT = SCI + MTH + CMPPER = TOT/300IF PER > = 80 THEN

WRITE #2, NAMES, SCI, MTH, CMP, TOT, PEREND IF

LOOPCLOSE #1CLOSE #2END

Page 34: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Subject : optional computer--11Group “ 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 virusb) Download ii) Copying data to removable media for save keepingc) Anti-virus iii) unguided transmission mediumd) Backup iv) Copy from Internet server to client computer

Page 35: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Ans. a) Microwave iii) unguided transmission medium

b) Download iv) Copy from Internet server to client computerc) Anti-virus i) Detect and clean virusd) 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 virusii) Start-up infector virusiii) Application infector virusiv) System infector virusb) Internet service which is used to send message from one user to another user.i) WWWii) FTPiii) Browseriv) E-mailc) Provides compensation for hardware loss due to incidents like fire, theft, etc.

i) UPSii) Insuranceiii) Backupiv) Password

d) MODEM converts signals:i) Digital to analogii)Analog to digitaliii) Both i) and ii)iv) None of the above.

Ans:-a)iii) Application infector virusb)iv)E-mailc)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 Languageb. 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

documentAns:-. 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) WWWGroup “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

Page 36: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 recordii) Delete record

8. a)

Page 37: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Match the following. [4x0.5= 2]Formi. Form

ii. Append Queryiii. Fieldiv. Index

i.a) Add data from one table to anotherb) A column in Access tablec) Make searching of records fasterd) A customized data entry screen

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

Page 38: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 PreviewGroup “C” Programming (20 Marks)

9.a)Differentiate between SUB and FUNCTION procedure. [2]SUB FUNCTION

1. SUB procedure does not return a value2. SUB procedure is called using CALLstatement

1. FUNCTION returns a single value (string or numeric)2. FUNCTION is used in the calling procedure as a formula or as an expression.

b)Write functions of INPUT # and RMDIR statementsINPUT # - 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$) CLSC$ = "NATIONAL"PRINT TEST$(C$)

FUNCTION TEST$(A$)FOR X = 1 TO LEN (A$) M$ = MID$(A$, X, I)B$=M$+B$NEXT XTESTS = B$END FUNCTION

Output:- LANOITANThe 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 programb) Debug the following program.DECCLARE EVENDIG(N)CLSD=345265CALL EVENDIG DSUB EVENDIG (N)DO WHILE N>0R=N MOD 10N=N\10IF R MOD 2 =0 THEN S=S+RWENDPRINT” 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)CLSD=345265CALL EVENDIG (D)SUB EVENDIG (N)DO WHILE N>0R=N MOD 10

Page 39: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

IF R MOD 2 =0 THEN S=S+RLOOPPRINT” SUM OF EVEN DIGITS:”;SEND SUB

11. Study the program below and answer the question that follows. [4X1=4]OPEN “PETROL.TXT” FOR APPEND AS #1OPEN “DIESEL.TXT” FOR APPEND AS #2DO INPUT “FUEL TYPE”( PETROL, DIESEL:”;T$INPUT “QUANTIY:”;QINPUT “RATE:”;RIF T$=”PETROL” THENWRITE#1,Q, R, DATE$ELSEWRITE#2 Q, R, DATE$END IFINPUT “ENTER ANOTHER”;A$LOOP WHILE UCASE$(A$)=”Y”CLOSE#1CLOSE#2END

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$)CLSINPUT "ENTER A STRING: "; W$PRINT "VOWELS IN THE STRING: “ ; VOWEL$(W$)ENDFUNCTION VOWEL$(A$)L = LEN(A$)FOR X =1 TO L

C$ = MID$(A$, X, 1)C$ = UCASE$(C$) 'CONVERT THE CHARACTER INTO UPPER CASEIF C$="A" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN V$ = V$ + C$END IF

NEXT XVOWEL$ = 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$)CLSINPUT "ENTER A STRING: "; N$PRINT "ALTERNATE CHARACTERS OF THE STRING ARE "; ALTCHAR$(N$) ENDFUNCTION ALTCHAR$(N$)L = LEN (N$)

Page 40: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

FOR X = 1 TO L STEP 2 'VALUE OF X WILL BE 1, 3, 5----- C$ = MID$(N$, X, 1)ST$ = ST$ + C$

NEXT XALTCHAR$ = 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 #3DO UNTIL EOF(3)INPUT N$, C, D$, RIF UCASE$(D$) = "POKHARA" THENAMT = C * R S = S + AMTEND IFLOOPPRINT "TOTAL AMOUNT COLLECTED: "; SEND

Page 41: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Subject: Computer Science (Optional II) 14Group "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)PCIa) Write Once Read Many b) Frequently Asked Questionc) 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 internetc) To make a duplicate or archival copy of one or more files on a computer systemd) A standard communications protocol for the exchange of information between computer and musical synthesizers.

Page 42: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 themb) Which is the connector of coaxial cable?

i) RJ-45 ii) BNC iii) ST iv) None of themc)WWW is a..............

i) Protocol of Internet ii) Service of Internet iii) Language of Internet iv) Internet Browserd) 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-mailiii) 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-Access1) Integer 2) Long Integer 3) Single 4) Double

ii)Primary Key does not accept1) Text 2) Number 3) Null value 4) None of them

iii) Storage size of Date/Time data type is1) 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)-1b) 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

Page 43: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 7READ N$(I), A(I)NEXT IPRINT YOUNG(N$( ), A( ))END

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

Ans. DECLARE SUB YOUNG (N$ ( ), A( ))DIM N$(7)DIM A(7)FOR 1 = 1 TO 7READ N$(I), A(I)NEXT ICALL YOUNG(N$( ), A( ))DATA Ram,16,Sita,18,John,12,Shriya,13,Rabi,21,Kapil,17,Kamal,19 ENDSUB YOUNG(N$( ), A( ))LET Y = A(1) : NAMES = N$(1)FOR M = 2 To 7I F A ( M ) < Y T H E NY = A(M) NAME$ = N$(M)END IF NEXT MPRINT NAME$ , YEND SUB

b) Write down the output of the following program: DECLARE SUB SSS (A, B, C) DECLARE FUNCTION PPP (X, Y)

Page 44: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

CALL SSS (1, 2, 4)ENDSUB SSS (A, B, C)FOR I = 1 TO CPRINT A,A = PPP (A, B) NEXT IEND SUB

FUNCTION PPP(X, Y) PPP = X*YEND FUNCTION

Ans. 1, 2, 4, 811. 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$)ENDSUB SSSS(A$)FOR J = I TO LEN(A$) STEP 2 M$ = MID$(A$, J, 1)B = B +ASC(M$)NEXT IPRINT ZZZZ(B)END SUB

FUNCTION ZZZZ(K)DO WHILE K>0 'R = K MOD 10C = C + RK=K\10LOOPZZZZ=CEND 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 : 201d) 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)CLSINPUT "ENTER A NUMBER"; ADO WHILE A>0R = A MOD 10A =A \ 10IF ISEVEN(R) THEN C = C + 1 LOOPPRINT "NUMBER OF EVEN DIGITS:";CENDFUNCTION ISEVEN(N)

Page 45: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

IF N MOD 2 = 0 THEN ISEVEN = -1ELSEISEVEN = 0END IFEND 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:

CLSOPEN "MESSAGE.TXT" FOR APPEND AS #2INPUT "ENTER NAME:",N$INPUT "ENTER TELEPHONE NUMBER:",PH$ LET D$ = DATE$ LET T$ = TIME$WRITE #2, D$,T$,N$,PH$CLOSE #2END

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:-

CLSOPEN "A", #4, "MARK.DAT"DOINPUT "ENGLISH:", E INPUT "SCIENCE:", S INPUT "COMPUTER:"; C WRITE #4, N$, E, S, CINPUT "ENTER ANOTHER RECORD:";CH$LOOP WHILE UCASE$(CH$) = "Y"CLOSE #4END

COMPUTER FOR SLCGroup '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

Page 46: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 Protectionb) KBPS ii)Network Adapterc) UPS iii) Protocold) 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 networkc) 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) TRUE6)Give full forms of the following abbreviations. [4x0.5=2]

a) SMTP - Simple Mall Transfer Protocolb) TCP/IP - Transmission Control Protocol Internet Protocolc) FTP -- File Transfer Protocold) 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.

Page 47: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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) reportiii.) change the table structure (3) fieldiv.) each column in a table (4) formAns:-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 subroutineEXIT FUNCTION statement is used to exit from a function without reaching END FUNCTION statementCommonly 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 + 1END IF

NEXT XVCOUNT = VEND FUNCTIONAns:-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]

CLSREM program to store data in fileOPEN "top10.dat" FOR INPUT AS #1FOR i% = 1 TO 10playername$ = "Player" + STR$( I %)playerscore% = 1000 - (I % * 100)WRITE playername$, playerscore%CLOSE #2NEXT i%PRINT "Data written to file"END

Page 48: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Ans:-CLSREM program to store data in fileOPEN "top10.dat" FOR OUTPUT AS #1FOR i% = 1 TO 10playername$ = "Player" + STR$ (i%)playerscore% = 1000 - (i% * 100)WRITE #1, playername$, playerscore%NEXT i%CLOSE #1PRINT "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$)CLSA$= “COMPUTER SCIENCE"CALL SHOW (B$)SUB SHOW (ST$)L= LEN (ST$)POST = (80 - L) /2PRINT 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 screenb) 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:-EXAMINATIONThe 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)CLSINPUT "ENTER A NUMBER:”;A CALL REV(A)SUB REV (N)DO WHILE N> 0R = N MOD 10N = N \10RV = RV * 10 + RLOOPPRINT "REVERSED OF NUMBER:”RVENDD SUB

b)Write a program, using FUNCTION ... END FUNCTION, to count vowels in the given string.[3]DECLARE FUNCTION VOWEL (S$)CLSINPUT "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$)

Page 49: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

C$ = MID$ (S$, M, 1)IF C$="A" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN V = V + 1NEXT MVOWEL = VFUNCTION

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 #3PRINT "LIST OF STUDENTS SECURING 32 OR MORE"UNTIL EOF(3)INPUT #3, N$, EIF E>=32 THENPRINT N$END IFLOOPClOSE#3END

Subject: Computer ScienceTime: 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

Page 50: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 PairFTP - File Transfer ProtocolHTML - Hyper Text Markup Language

4. Match the following pairs: [4x0.5 =2]a) Multimedia i) Word documentb) Boot sector virus ii) Graphics + Text + Soundc) Macro virus iii) Internetd) Network iv) Software

v) Master boot recordAns:

a) Multimedia i) Graphics + Text + Soundb) Boot sector virus ii) Master boot recordc) Macro virus iii) Word documentd) 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) Chatiii) 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) McAfeeiii) Smart editor iv) Joshi virrt5 tool

d) Main component of multi-mediai) Floppy disk ii) Floppy driveiii) Sound card iv) Magnetic tape

Ans a) Chat: b)2061 c)McAfee d)Sound cardGroup "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/Timeb) 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.

Page 51: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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 storesa) Number b) Textc) Sound d) None of them ii) Extension of database file in MS-Accessa) .MDA b) .MDBc) .MDF d) .ADBiii) Default sub-data type of Number data type of MS-Access a) Integer b) Long Integer c) Single iv)Doubleiv) Primary key does not accepta) Text b) Null Valuec) Number d) None of than

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

b) Match the following:i) Query ( ) Printed formatii) 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 viewii) Form ( ) Allows view, edit, input dataiii) Table ( ) Stores dataiv) 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 numbersDECLARE FUNCTION SUM (N( ))DIM N(10)CLSFOR j = 1 TO 10INPUT "Enter Any Number"; X(j) NEXT jPRINT "Sum of even numbers:"; SUM(X(10)) ENDFUNCTION SUM (N( ))

Page 52: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

S = 0FOR K = I TO 10IF N(K) MOD 2 = 0 THEN S$=S$+N(K)END IFNEXT KS=SUMEND FUNCTIONAns:-DECLARE FUNCTION SUM (N( ))DIM N(I0)CLSFOR j=1 TO 10INPUT "Enter Any Number"; X(j) NEXT jPRINT "Sum of even numbers:"; SUM(X( )) END

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

b) Write the output of the following program: DECLARE SUB TEST(N)CLSFOR J = 1 TO 5READ XCALL TEST(X)NEXT JDATA 2,3,4,5,6ENDSUB 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)ENDSUB series (A, B) CLSC=0FOR J=1 TO 5PRINT A,C=A+BA=B B=C NEXT JEND SUBa) List the variables used in SUB procedureAns: 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 13c) 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)"

Page 53: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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) ENDSUB AREAREC (L, B) A=L*BPRINT "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$)CLSINPUT "Enter String”; A$AC$ = ALTCAPS$(A$)PRINT "ALTERNATIVE CAPS ="; AC$ENDFUNCTION ALTCAPS$ (N$)FOR I = I TO LEN(N$)C$ = MID$(N$, I, 1)IF I MOD 2= 1 THENW$ =W$ + UCASE$(C$) ELSEW$ = W$ + LCASE$(C$)END IFNEXT IALTCAPS$ = 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, SIF S >= 8000 AND S <= 12000 THENPRINT N$, P$, SEND IFLOOPCLOSE #1END

Page 54: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

Subject: Computer Science F.M. 50Time: 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/IPii. ARPiii. HTTPiv. FTPv. SMTPvi. 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. Textii. Graphicsiii. Videoiv. Soundv. 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 explorerb. Web browser ii) Protocolc. CD-ROM iii) Power regulator device

d. UPS iv) Storage device v) Primary memory

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

Page 55: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

4.Write the full forms of the following: [4x0.5 =2]a) HTTP b) FTP c) NIC d) LAN Ans:a. HTTP Hypertext Transfer Protocolb. FTP Files Transfer Protocolc. NIC Network Interface Cardd. 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: Routerb. 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: Animation6.Select the best answer: [4x0.5=2]

a)The device which is used to convert analog signal into digital signal and vice-versa.i) Processorii) MODEMiii) Data cableiv) Memory .

Ans: MODEM

b)Cyber law refers to the laws regarding thei) Hardware and softwareii) Computer Systemiii) Internet and cyberspaceiv) Computer programmerAns: Internet and cyberspace

Which is not computer virus?

i) Boot sector virusii) File virusiii) Micro virusiv) Macro virus

Ans: Micro virusNetwork with a city which is control by single organization

i) Wide Area Networkii) Local Area Networkiii) Metropolitan Area Networkiv) 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.

Page 56: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

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: Formiii)Extension of database file of MS-Access is ....a. .MSD b. .MDBc. . DBF d. None of themAns: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 =2a) 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. 1Ans: 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. 1Ans: 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 MULTIPLESCLSDECLARE MUL (N) INPUT "Enter no"; A CALL MUL ( )END

SUB MUL (N)1=1WHILE I >= 10PRINT N*I1=1+1LOOP

SUB ENDAns:

REM TO PRINT MULTIPLESDECLARE SUB MUL (N) CLSINPUT "Enter no"; A

Page 57: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

CALL MUL ( A) ENDSUB MUL (N)I=1

WHILE I <= 10PRINT N*I I=I+ 1

WENDEND SUB

b)Find the output of the following program. DECLARE FUNCTION XYZ(N)LET V= 435LET RV= XYZ (V)PRINT RVEND

FUNCTION XYZ (N)S=0WHILE N< >0R=N MOD 10S=S+RN=N\10WENDXYZ=SEND 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 SUBSUB XYZ (N$)FOR 1=1 TO LEN(N$) PRINT LEFTS (N$, I) NEXT IEND 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:KKAKATKATHKATHMKATHMAKATHMANKATHMANDKATHMANDU

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

Page 58: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20

NDUANDUMANDUHMANDUTHMANDUATHMANDUKATHMANDU

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:";XCALL 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)CLSINPUT "Enter first number:"; XINPUT "Enter second number:"; YH = HCF(X, Y)PRINT "HCF= "; HENDFUNCTION HCF (A, B)WHILE B 0C = A MOD B A=BB.=CWEND

HCF =_A END FUNCTIONc. 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"DOINPUT "Enter item cede:"; ICINPUT "Enter item name:"; IN$INPUT "Enter item rate:"; IRWRITE #1, IC, INS, IRPRINTINPUT "Wants to supply more YIN:"; C$LOOP WHILE UCASE$(C$) = "Y"CLOSE #1END

Page 59: Subject: Computer Science (Optional II) 2 Group a(Fundamentals — 20