Professional Documents
Culture Documents
As data travel in the form of light signal in fiber-optic cable, no electromagnetic interference is experienced in data
transmission because light signals are not affected by electromagnetic wave. Fiber-optic cable not only is extremely
fast and can carry large number of messages simultaneously, but it is very secure transmission medium.
c. List out the three main objectives of IT policy, 2057 of Nepal.
The government of Nepal introduced the Information Technology Policy, 2057(2000) with a view to placing
Nepal in global IT map within five years through the fulfillment of following three objectives.
• To make information technology accessible to the general public and increase employment
through this means.
• To built a knowledge-based society.
• To establish knowledge-based industries.
d. What is computer security? Point out any two computer software security measures:
Computer security refers to the protection of computer's resources both hardware and software from accidental,
intentional and natural disasters. In other words, it is a general term that encompass all aspects of the measures taken
to safeguard computer system and the data they contain from to attributable to any kind of attack, whether initiated
by people or natural elements.
Two common software security measures could be:
1. To use password to avoid accessing by unauthorized users.
2. To keep backup copies of important data and software.
e. What is a boot sector virus? Point .out the common routes for virus infiltration.
A computer virus that infects the crucial boot sector of a disk, so that it is loaded into the computer's memory at the
beginning of every operating session. These viruses mostly infect boot record, master boot, FAT and partition table.
Some common routes for virus infiltration are:
• Exchangeable storage medium like floppy disk, flash memory card etc.
• E-mail attachments
• Shareware
• Pirated software.
2. Fill in the blanks given below: [4x0.5=2]
a) In a bus topology network, a special device called................is placed on each end of the cable.
b) ...............is the process of transferring data./file from a network location to the user's computer. .
c) Government of Nepal introduced cyber law in the year ...…..B.S.
d) The capability of generating reproducing the copies of itself is called . .…..
Ans:- a) Terminator b) downloading c) 2061 d) replication
3. Select the best possible alternative. [4x0.5=2]
a. A - - - - - - - is an agreed-upon format for transmitting data between two devices.
i) proctology ii) protoplasm prototype iv) protocol
b An arrangement where user accounts ,are centralized on a -server and PCs gain access to network resources by
accessing this server is called a ----------------
i)peer to peer network ii)server to server network iii) client-server network iv) file server network
c. Which of the following is not related with computer hardware security?
i) Insurance ii) UPS iii) Password lock iv) Room lock
EOF( ) function is used to check the end of file position. It returns 0 if there are more records below the current
file pointer position and returns 1 if the end of tile has been reached.
Syntax: EOF(file number)
10. a) Re-write the following program correcting the bugs. (2)
DECLARE SUB CURRMTH (D$)
REM PROGRAM TO PRINT CURRENT MONTH FROM THE SYSTEM DATE
DT= DATE$
DISPLAY CURRMONTH (DT$)
END
b) Write a program to test whether an input number is an Armstrong number or not, using SUB.---END SUB
statement. (Hint: If a number is equal to sum of the cube of it's digits, is called an Armstrong number, e.g. 153-)
I3+5'+33=153) (3)
Ans.
DECLARE SUB ARMS (N)
INPUT N
K=N
CALL ARMS (N)
IF C = K THEN PRINT "ARMSTRONG" ELSE PRINT "SORRY"
END
Select query is used to select required fields Update query is used to change data in one or more
and records from the table or another query fields of all or selected records of the table.
Opening a Select Query does not make any Opening an Update Query makes changes in the data
change in the data of the table of the table.
NEXTTERM function is used to generate the next term of the series. The next term will be half if the number is even
else it will be three times the number plus one. The main module will initialize the first valve of x =7 and call the
function ten times to generate the series. This series is called “hailstone numbers”.
b)Debug the following program.
CLS
REM PROGRAM TO DISPLAY DATA IN A TEXT FILE
OPEN "TEST.DAT" FOR INPUT AS $2
DO WHILE EOF(2)
LINE INPUT A$
PRINT A$
LOOP
CLOSE #2
END
Ans:
CLS
REM PROGRAM TO DISPLAY DATA IN A,TEXT FILE
OPEN "TEST.DAT" FOR INPUT AS #2
DO UNTIL EOF(2)
LINE INPUT #2, A$
PRINT A$
LOOP
CLOSE #2
END
REM is the keyword used for remarks which is spelt wrong; The file number is Written with # not $; ; The loop
should be UNTIL loop instead of WHILE as the loop should stop when 'End of File is reached i.e. E O F ( 1 ) is
TRUE; #file number must be used with the LINE INPUT statement to read from file otherwise it reads from keyboard
11.Study the following program and answer the question that follow.
A$ = DATE$
M$ = LEFTS (A$,2),
D$ = MID$(A$,4, 2)
F$ = "ATD" + M$ + D$+”.TXT”
OPEN F$ FOR OUTPUT AS #2
DO
INPUT "NAME OF THE STUDENT (EXIT TO STOP): "; N$
IF UCASE$(N$) = "EXIT" THEN EXIT DO
PRINT #2, N$
LOOP
CLOSE #2
END
FUNCTION PPP(X, Y)
PPP = X*Y
END FUNCTION
Ans. 2, 4, 8, 16, 32
12. a)Write a program which asks to enter any five numbers in main module and prints the greatest number among five
using SUB............................END SUB [3]
Ans:
DECLARE SUB GREAT (N( ))
DIM NUM (1 TO 5)
FOR X = 1 TO 5
INPUT NUM(X)
NEXT X
CALL GREAT (NUM( ))
END
b) Write a program to create a user defined WCOUNT to return the number of words used in a given sentence.[3]
Ans.
DECLARE FUNCTION WCOUNT (S$)
INPUT "Enter a Sentence" ; ST$
PRINT WCOUNT (ST$)
END
FUNCTION WCOUNT(S$)
CNT=0
FOR X = I TO LEN(S$)
M$ = MID$(S$. X, 1)
IF M$ = " " THEN CNT = CNT + 1
NEXT
NW=CNT+1
WCOUNT = NW
END FUNCTION
c) A sequential data file EMPLOYEE.DBT of XYZ employees on Name, Service-yrs and Age. Write a program to print
the name list of employees having the Age greater than 60 and Service=yrs more than 20 under the title Out Dated
Employee and also count the number of such employees. [3]
Ans:-
OPEN "EMPLOYEE.DAT" FOR INPUT AS #1
PRINT TAB(20); "Out Dated Employee"
DO UNTIL EOF(1)
INPUT # 1, N$, SY, A
IF A > 60 AND SY > 20 THEN
PRINT TAB(20) ;N$
CNT = CNT + 1
END IF
LOOP
PRINT TAB(20) ; "Number of out dated employees " ; CNT
CLOSE #1
END
Subject: Computer Science (Optional II).............6
Group "A" (Fundamentals — 20 marks)
1. Answer the following questions: [5X2=10]
a) What is meant by network media? Point out it's types.
Ans. Network media refers to the means used to link a network's nodes together. There are two basic categories of
network media; guided and unguided. There are many different types of guide transmission media, the most
popular being twisted-pair cable, coaxial cable and fiber optic cable Unguided media used in wireless
technology. In wireless networks, the atmosphere itself acts as the medium. Wireless networks use radio or
infrared signals that travel through the air (called ether) for transmitting data.
b) What is a web browser? Name any three web browsers.
Ans. A web browser (or browser) is a software application designed to find hypertext documents on the web and
then open the document on the user's computer. Most of the browsers provide a graphical interface that enables
the user to click hyperlinked text and images to jump to other documents or view other data. Three common web
browsers are Internet Explorer, Netscape Navigator, and Mosaic etc.
c) What is data security? List any two security measures to secure data.
Ans. Data security refers to the protection of data from different types of threats such as natural disasters, hardware
failure, criminal acts, malicious code, cyber terrorism etc. Two data security measures are:
• Valuable data files should be encrypted (converted into codes)
• Access privileges to the database should be limited and closely monitored.
d) Write any three application of computer in education field.
Ans. Education field is one of the most important field, where the computer can assist in many ways. Some of them
are:
• Computer can be used to teach/learn different subjects like science, geography, mathematics etc. using
related courseware based on CAI (Computer Aided Instruction)/CAL (Computer Assisted Learning) technique.
• Computers can be used to conduct educational training based on CBT (Computer Based Training)
technique.
• Computers can be used to evaluate the student's answer sheet (objective types) based on OMR
(Optical Mark Recognition) or related technology,
e) Why do people make virus program? Name any two antivirus programs.
Ans. There may be three basic reasons behind the development of computer virus.
• Programmers or software developers may develop and inject computer virus in order to stop or
minimize piracy of their original software.
• Destructive minds may develop and inject computer virus intentionally to harm others computer. This
category of people may have the tendency of breaching cyber law and ethic,
• Joyful minds may develop computer virus to entertain others.
Two anti-virus programs are; NAV, MacAfee.
2. Fill in the blanks with suitable word(s): [4x0.5=2]
a) ..................means two-way communication system.
b) The treatment of computer crime and abuse is defined in ------ -------------
c) Numbers of connected computers in client/server network architecture are called -----------
d) ---------------are used to detect and remove computer virus from infected file or memory.
Ans. a) Duplex b) Cyber Law c) Nodes d) Anti-virus Programs
3. Write the full form of the following:-
a)UTP b)POP c)DVD d)NAV
ANS:-Unshielded Twisted Pair b) POST Office Protocol c) Digital Versatile Disk e) Norton Antivirus
4. Give the appropriate technical term for the following [4x0.5=2]
a) A network architecture in which each computer can provide as well as receive network services.
b) Online digital postal services
c) A device used at the end user’s computer of a network which convert digital signals into analog signal and vice
versa
d) Factual information in the form of text, numbers, sounds or images that can be processed by a computer.
Ans. a) Peer-to-peer Architecture b) E-mail c) MODEM d) Data
5. State whether true or false: [4x0.5=2]
a) MODEMs are not needed in wireless network communication.
b) The most common type of network cable used for bus topology is coaxial cable.
c) Usually system injectors enter to the system as a device driver and get loaded into memory.
d) Sound card captures movies or pictures from external devices.
Ans. a) false b) True c) True d) False
Ans:-
REM Program to print the square root of even numbers read from data line
DECLARE FUNCTION SQU(N)
FOR I =1 T0 7
READ NUM
K = NUM MOD 2
IF K = 0 THEN PRINT SQU(NUM)
NEXT I
DATA 3, 4, 13, 16, 23, 36 48
END
FUNCTION SQU(N)
A=N^(1/2)
SQU=A
END FUNCTION
b) Write down the output of the following program:
[2]
DECLARE SUB PEACE(W$)
A$ = "LOKTANTRA"
CALL PEACE(A$)
END
SUB PEACE(W$)
C=5 : N= 1 : T=39
FORI=1TO5
PRINT TAB(T); MIDS(W$, C, N)
T=.T-1
C= C-1
N=N+ 2
NEXT I
END SUB
Ans.:-
A
TAN
KTANT
OKTANTR
LOKTANTRA
11. Analyze the following program and answer the questions that follow: [4X1=4]
DECLARE SUB SSS(N)
CLS
INPUT”ENTER A NUMBER”;A
CALL SSS(A)
END
SUB SSS(N)
FOR I =1 TO N
PRINT N;
IF N MOD 2=0 THEN
N=N/2
ELSE
N = N*3+1
END IF
IF N = I THEN EXIT FOR
NEXT I
END SUB
a) What will be the output of the program when you provide the value 3 for the variable A?
Ans. The output will be 3, 10, 5
b) How many times the FOR loop will be executed when you input 8 for the variable A?
Ans. The FOR loop will be executed for 3 times when we input 8 as the value of A. In third loop, after printing 2
the value of N will be 1 so it will conditionally exit from the FOR loop
c) What is the data type of the variables A and N?
Ans:- Since no type declaration character are followed after the variable name, the data type of the variables A and
N will be taken as Single precision by default.
d) Will there any change in output if FOR statement is changed as FOR I=N TO 1 step-1
Ans: No, there will not be any change in the output since the value of 1 is not used within the loop for calculation
and is used simply for looping purpose.
12.a) Write a program to create a user-defined function 'RCOUNT' to count and print the number of records present in
any sequential data file.
[3]
DECLARE FUNCTION RCOUNT(F$)
CLS
INPUT "ENTER A FILE NAME": FL$
PRINT "NUMBER OF RECORDS";RCOUNT(FL$)
END
FUNCTION RCOUNT(F$)
OPEN F$ FOR INPUT AS #1
DO UNTIL EOF(l)
LINE INPUT #1, REC$
CNT = CNT + 1
LOOP
CLOSE #1
RCOUNT = CNT
END FUNCTION
b) Write a program which asks to enter a full name of a person at the main module and prints the abbreviated form of it
using the sub routine ABBV. (e.g. Mohan Bikram Nepali-- MBN) [3]
Ans:-
DECLARE SUB ABBV(N$)
CLS
INPUT "ENTER A FULL NAME";NAME$
CALL ABBV(NAME$)
END
SUB ABBV(N$)
K$ = MID$(N$,1.1)
L = LEN(N$)
FOR X =2 TO L
M$ = MID$(N$, X, 1)
IF M$="" THEN KS = K$ + MID$(N$, X+1, 1)
NEXT X
PRINT K$
END SUB
c) Write a program which updates the file SALES.DAT having the fields SNO, ITEMS, RATE and QUANTITY
by calculating AMOUNT for each record (Where AMOUNT=RATE*QUANTITY) and prints all the records from
the file having the AMOUNT more than 5000. [3]
OPEN "SAL '.S.DAT" FOR INPUT AS #1 OPEN "TEMP.DAT" FOR
OUTPUT AS #2 DO WHILE NOT EOF(1)
INPUT #1, SN, ITM$, R, Q LET AMT = R*Q
WRITE #2, SN, ITM$, R, Q, AMT LOOP
CLOSE #1, #2
KILL "SALES.DAT"
NAME "TEMP.DAT" AS "SALES.DAT"
OPEN "SALES.DAT" FOR INPUT AS #3
PRINT "S. No.", "Item Name", "Rate", "Quantity", "Amount"
DO
INPUT #3, S, N$, RT, QTY, AMT
IF AMT > 5000 THEN
PRINT S, N$, RT, QTY, AMT
END IF
LOOP UNTIL EOF(3)
CLOSE #3
END
Subject: Optional 11 (Computer Science) .....7
Full Marks: 50.
Group `A'
Computer Fundamentals (20 Marks)
1. Answer the following questions. [5x2=10]
a) What is transmission media? Mention its types of transmission media used in computer network.
Ans.: The material or means used to carry signals from one end (node) to another end in a network is called transmission
media. There are two major types of transmission media used in computer network.
(i) Guided media:— The media which physically connects the computers in network are guided media. In
other words they are cables. Optical Fibre, Twisted pair, Coaxial cable are different examples of guided media.
(ii) Unguided media: — In this type there is no physical connection with cable between the nodes. It is also
called wireless media. Examples of unguided media are:- Microwave, radio wave, satellite, etc
b) Define “System Infector Virus” and “Application Infector Virus”.
Ans. System Infector Virus:- A computer virus which infects the main files of the operating system are called
system infector virus. They infect files like COMMAND.COM, IO.SYS, etc in MS-DOS and files like
`
WIN.COM in windows. This type of virus is more dangerous as it is activated at the time of booting computer.
Application Infector Virus:- A computer virus which infects application programs such as Word, Paint, Power
Point, Internet Explorer, etc. This type of virus is less dangerous than a system infector virus or startup.
infector virus because we can easily detect and clean them by using anti-virus program just after booting and
before using any application program.
c) Write the advantages of using multimedia presentation.
Ans.: Multimedia presentations use text, picture, audio, video, etc. in sharp contrast to only text based presentation
multimedia presentation can depict the idea and information more effectively. The proverb `A picture speaks a
thousand words' explains the usefulness of multimedia presentation. Following are some of the advantages of
multimedia presentation.
i) Effective
ii) Attractive
iii) Informative
iv) Accessible to physically disabled persons (For example, a presentation with sound can be useful for a blind
person)
d) Mention any four services of the Internet and discuss any one of them.
Ans.: Given below are some services of the Internet.
i) World Wide Web (WWW)
ii) E-mail
iii) Telnet
iv) File Transfer Protocol (FTP)
World Wide Web (WWW):
The World Wide Web ("WWW" or simply the "Web') is a system of interlinked, hypertext documents
that runs over the Internet. With a Web browser, a user views Web pages that may contain text, images, and
other multimedia and navigates between them using hyperlinks. The Web was created around 1990 by the
Englishman Tim Berners-Lee and the Belgian Robert Cailliau working at CERN in Geneva, Switzerland. As its
inventor, Berners-Lee conceived the Web to be the Semantic Web where all its contents should be
descriptively marked-up.
Extracted from: wikipedia.org
In World Wide Web many web pages made using HTML (Hypertext Markup Language are stored in many web
servers around the world. A user can access any document in the Web using proper URI.
e) What is data back up? Write its importance?
Making additional copy of data to another medium(usually a removable medium) for safe keeping purpose is called
data backup. The data in backup can be restored incase of the original data is lost or damaged. This is preventive measures for
data security. We can backup system data such as File Allocation Table, Partition Table, etc. so that it can be restored in case
of System disaster. Besides that we backup user files so that some or all of them can be restored in case they have been
accidentally deleted or corrupted.Data backup is very important because there are numerous reasons which can result into
data loss, it may not be always possible to regenerate the lost data. Keeping one or more backup copies of data is very wise
idea. Data backup should be done at regular intervals daily, weekly, fort nightly, etc. depending on the nature of work and the
data itself.
2. Choose the best alternative. [4x0.5=2]
a) Which of the following is not the device necessary to make a multimedia - - - - - - - - - -
a. Sound Card
b. Microphone
c. UPS
d. Speaker
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.
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.
Ans.: REM PROGRAM TO READ DATA FROM FILE CONTAINING NAME AND AGE AND
REM PRINT THE AVERAGE AGE
OPEN "NOTE.TXT" FOR INPUT AS #1
DO UNTIL EOF (I)
INPUT #l, N$, A
PRINT , N$, A
S=S+A
C=C+1
LOOP
PRINT "AVERAGE AGE: " ; S / C
CLOSE #1
END
We open the file in INPUT mode to read from the file; UNTIL condition should be used in place of WHILE as we
go out of the loop when we reach the end of file (condition is TRUE); File number must be used with INPUT
statement to read from file and DO is closed with LOOP not WEND.
11. Study the program given below and answer the questions that follow. [4x1=4 ]
DECLARE SUB TEST(T$)
CLS
A$ = "SCHOOL"
END
SUB TEST(T$)
L = LEN(T$)
FOR X = L TO 1 STEP -1
PRINT MID$(T$, X, 1);
NEXT X
END SUB
a) What statement should be added in the main module for the program to give output?
Ans.: CALL TEST(A$)
b) What will be the output after adding that statement?
Ans.: LOOHCS
The program prints the reverse of the string
c) Modify the FOR statement so that the statement L = LEN(T$) could be removed?
Ans.: FOR X = LEN(T$) TO 1 STEP -l.
d) Which variables are local to the TEST sub procedure?
Ans: L and X
12 a) Write a program using SUB ... END SUB to print the given string at line 10 column 20 of the screen.[3]
Ans:-
DECLARE SUB PRINTAT(N$)
CLS
INPUT "ENTER A STRING:”; A$
CALL PRINTAT (A$)
END
b) Write a program using FUNCTION ... END FUNCTION to print the given series up to 10 terms.
[3]
7 22 11 34 17 52 26 -- ----------
Ans:-
DECLARE FUNCTION NEXTTERM (N)
X=7
FOR C = 1 TO 10
PRINT X
X = NEXTTERM (X)
NEXT C
END
c) A sequential data file `STUDENT.DAT' contains name, class, roll number and section of the
students.Write a program to display the list of students studying in class 10 section `A'. (3)
CLS
OPEN "STUDENT.DAT" FOR INPUT AS #1
PRINT "NAME", "CLASS", "ROLL NUMBER", "SECTION"
DO UNTIL EOF(1) ' READ FROM FILE UNTIL ITS END IS REACHED
INPUT #1, N$, C, R, S$
IF C = 10 AND UCASE$(S$) = "A" THEN
PRINT N$, C, R, S$
END IF
LOOP
CLOSE #1
END
Subject: Optional II (Computer Science) ....9
SEND[2063]
SEDIPS
Group `A'
Fundamentals (20 Marks)
1. Answer the following questions: [5x2=10]
a) What is the Internet? Discuss its role in information dissemination.
The Internet is the global network of networks which operates on TCP/IP protocol. The Internet started in the US
in 1972 with four host computers connected with each other. Now it has grown to cover the whole globe. There
many heterogeneous networks connected with each other.
The Internet plays a vital role in information dissemination. The services of the Internet like e-mail, World Wide
Web, New Group, Bulletin Board, etc. work to transmit information from person to person or to the mass.
b) What is LAN topology? Illustrate star topology.
The layout of physical connection of computers in LAN is called topology. Topology defines how different
nodes and devices are connected with the cables.
Star Topology:
a) HTML
b) Coaxial cable
c) Telnet
d) Repeater
iii) language
iv) guided medium
i) login to another computer in the Internet
ii) improves strength of signal
4. Write technical terms for the following: [4x0.5=2]
a) Device used to connect networks using different protocols.
b) Plan formulated by the government for the development of Information Technology sector.
c) Data transmission rate in computer network.
d) Crime committed using computer technology and the Internet.
Ans: a) Gateway b) IT Policy c) Bandwidth d) Cyber Crime
Group “B”
Database Management (10 Marks)
GROUP 'C'
Programming (20 Marks.)
9. a) Differentiate between OUTPUT and APPEND IN open statement
OUTPUT APPEND
Used to write data to new file. Used to add data to the end of the file
Always creates a new file Writes data to the end of existing file or creates
a
12. a) Write a program using FUNCTION...END FUNCTION to convert length entered. in meter into inch.
(HINT: 1 meter = 39.37 inches) [3]
Ans:
DECLARE FUNCTION MET2INCH(M)
CLS
INPUT "ENTER LENGTH IN METER: " ; A
PRINT "LENGTH IN INCH IS: "; MET2INCH(A)
END
FUNCTION MET2INCH(M)
I = M* 39.37
MET2INCH = I
END FUNCTION
b) Write a program using FUNCTION ... END FUNCTION to ask a string from the user and print its
reverse. [3]
Ans:-
DECLARE FUNCTION REVERSE$(ST$)
CLS
INPUT"ENTER STRING: "; X$
PRINT "REVERSE OF THE STRING IS:”;REVERSES (X$)
END
FUNCTION REVERSE$(ST$)
L = LEN(ST$)
FOR C = 1 TO L
B$ = MID$(ST$, C , 1)
R$ = B$ + R$
NEXT C
REVERSE$ = R$
END FUNCTION
The FOR loop can also be written as:
FOR C = L TO 1 STEP -1
B$ = MID$(ST$, C, 1)
R$ = R$ + B$
NEXT C
Either gets the characters from the first and prints the next character before the previous character or extracts the
characters from the last and joint the previous character after it.
c) A sequential data file "RECORD.TXT" contains peoples' name, age and marital status Write a program
to display the list of people who are married and having age below 20 years (3)
CLS
OPEN "RECORD.TXT" FOR INPUT AS #5
PRINT "NAME", "AGE", "MARITAL STATUS"
DO NOT WHILE EOF(5) ' NOT WHILE is equivalent to UNTIL
INPUT #5, N$, A, M$
IF M$ = "MARRIED" AND A<20 THEN
PRINT N$, A, M$
END IF
LOOP
END
l
Subject: Computer Science (Optional II) 10
Group "A" (Fundamentals — 20 marks)
1. Answer the following questions: [5x2=10]
a) List out any four disadvantages of computer network.
Ans. Some of the disadvantages of computer network are as follow:
• It is difficult to make network system secured from threats such as hackers, viruses, novices
or industrial espionage.
• As traffic increases on the network the performance degrades unless it is properly designed.
• The efficiency of a network is very dependent on the skill of the system manager. A badly
managed network may operate less efficiently than stand-alone machine.
• If the network stops operating then it may not be possible to access various hardware and
software resources, and affects large number of users.
b) What is a star network?
Ans. In local area network, a centralized network topology with a physical layout that resembles a star.
It comprises of central network processor or wiring concentrator; the nodes are arranged around
and connected directly to the central point. Mostly hubs are used to provide central point for
connecting cables. Star network's wiring cost is considerably higher than other topology because
each node is directly connected to the central point.
c) How can you say that computer technology has enhanced the globalization process?
Ans. Computer technology has not only brought the world closer together, but it has allowed the
world's economy to become a single interdependent system. Computer technology enables not only
sharing of information quickly and efficiently, but also helps to bring down the barriers of
linguistic and geographical boundaries. The world has developed into a global village due to the
help of information technology allowing the countries which are not only separated by distance but
also by language and culture to share ideas and information each other.
d) List out any four common routes for virus infiltration.
Ans. There are different routes through which computer viruses are passed to the computer systems. Some
of them are:
(a) Exchangeable media such as floppy disk, USB portable memory devices.
(b) Shareware used in network systems.
(c) E-mail attachments.
(d) Pirated software etc.
e) What do you mean by encryption?
Ant It is process of converting or scrambling a message/data into unreadable form (called cipher text) by
using a key so that it can not be read by anyone other than its intended recipient. The intended recipient
can apply the key to decrypt (rearrange into original form) and read the message/data.
2. Fill in the blanks with suitable word(s):[4x0.5=2]
a) Cable media are called ............transmission media
b) ..................coordinates the activities of multiple computers across a network.
c) Bandwidth of analog device is measured in .............................................................................
d) Computers need ..........to ...........Volt constant power supply.
Ans. a) Guided b) NOS (Network Operating System) c) Hertz (Hz) d) 220 to 240
3. Write full forms of the following: [4X0.5=2]
a) STP b) MCGA c) DNS d) SIMM
Ans. a) Shielded Twisted Pair b) Multi Color Graphics Array
c) Domain Name Service d) Single Inline Memory Module
4. Give the appropriate technical terms-for the following: [4X0.5=2]
a) Directly connected with and accessible to a computer or a network, and ready for use.
b) A program or software that detects and removes computer virus from the infected file or memory.
c) To transfer data from a network location to user's computer.
d) A character (such as an asterisk or question mark) that stands for any other character, or series of
any other characters.
Ans. a) Online b) Anti-viral program c) Download d) Wildcard character
5. State whether true or false: [4X0.5=2]
a) Optical fiber is immune to electromagnetic interference.
b) Digital signatures are used for authentication purpose.
c) Volt guard can supply continuous power to the computer even in case of power failure.
d) We can not send graphics files in emails.
Ans:- a. True b. True c)False d) False
5. Match the following: [4X0.5=2]
a) Microwave i. Multi-media
b) Sound card ii. Unguided media
c) UPS iii. Power protection device
d) TCP/IP iv. Internet protocol
Ans:-
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]
Ans. REM Program to print the sum of even digits of an input number DECLARE
FUNCTION SOE(N)
INPUT A
PRINT SOE(A)
END
FUNCTION SOE(N)
WHILE N<>0
D=N MOD 10
IF D MOD 2 = 0 THEN E = E + D
N=N\ 10
WEND
SOE = E
END FUNCTION
SUB ABC(W$)
L = LEN(W$)
FOR I =1 TO L
M$ = MIDS(WS, I .1)
P = ASC(M$)
K=K +P
NEXT I
PRINT K
END SUB
Ans.
This program prints the sum of ASCII codes of each character of the string A$ i. e. 67+80+85 =232.
11. Analyze the following program and answer the questions that follow: [4X1=4]
DECLARE FUNCTION XYZS(W$)
W$ = "PROGRAM"
R$= XYZ$(W$)
PRINT R$
END
FUNCTION XYZ$(W$)
K = LEN(W$)
FOR I = K TO I STEP -2
M$ = M$ + MID$(W$. I, 1)
NEXT I
XYZ$ -= M$
END FUNCTION
i) What will be the return data type of the function XYZ?
Ans. The function will return the string value.
ii) What will be the output of the program when it is executed?
Ans. It will print a reverse string comprises of alternate characters of the word PROGRAM i.e "MROP"
iii) What will be the output of the program when FOR loop is changed as FOR = 0 K?
Ans. The output of the program will be "PORM"
iv) What is the name of the operator "+" used in the program?
Ans. + operator used in the program is called string operator and the operation is called string.
c) Write a program which reads data from the f i l e " RESUL.DAT ” having the fields Name, Science, Maths and
Computer, and copies all the records having the percentage more than or equal to 80 to a
new file "DISTINCT.DAT" (HINT: Consider full marks is 100) [3]
Ans:-
OPEN "RESULT.DAT' FOR INPUT AS #1
OPEN "DISTINCT.DAT' FOR OUTPUT AS #2
DO UNTIL EOF(1)
INPUT #1, NAMES, SCI, MTH, CMP
TOT = SCI + MTH + CMP
PER = TOT/300
IF PER > = 80 THEN
WRITE #2, NAMES, SCI, MTH, CMP, TOT, PER
END IF
LOOP
CLOSE #1
CLOSE #2
END
Subject : optional computer--11
Group “ A”
Computer Fundamentals (20 Marks)
1. Answer the following questions.
8. a)
Match the following. iv. Index
i.
[4x0.5= 2]Form a) Add data from one table to another
i. Form b) A column in Access table
ii. Append Query c) Make searching of records faster
iii. Field d) A customized data entry screen
FUNCTION TEST$(A$)
FOR X = 1 TO LEN (A$)
M$ = MID$(A$, X, I)
B$=M$+B$
NEXT X
TESTS = B$
END FUNCTION
Output:-
LANOITAN
The test$ function extracts each character from the given string from the first to the last and joins each
character before the previous character (B$=M$+B$) thus generating the reverse of string which is printed in
the main program
b) Debug the following program.
DECCLARE EVENDIG(N)
CLS
D=345265
CALL EVENDIG D
SUB EVENDIG (N)
DO WHILE N>0
R=N MOD 10
N=N\10
IF R MOD 2 =0 THEN S=S+R
WEND
PRINT” SUM OF EVEN DIGITS:”; S
SUB keyword is missing in DECLARE Statement. When a SUB procedure is called using CALL keyword then
parameter must be enclosed within parentheses; the closing statements for DO WHILE is LOOP not WEND;
SUB procedure defined must be closed by END SUB
Ans:-
DECCLARE SUB EVENDIG (N)
CLS
D=345265
CALL EVENDIG (D)
SUB EVENDIG (N)
DO WHILE N>0
R=N MOD 10
IF R MOD 2 =0 THEN S=S+R
LOOP
PRINT” SUM OF EVEN DIGITS:”;S
END SUB
11. Study the program below and answer the question that follows. [4X1=4]
OPEN “PETROL.TXT” FOR APPEND AS #1
OPEN “DIESEL.TXT” FOR APPEND AS #2
DO
INPUT “FUEL TYPE”( PETROL, DIESEL:”;T$
INPUT “QUANTIY:”;Q
INPUT “RATE:”;R
IF T$=”PETROL” THEN
WRITE#1,Q, R, DATE$
ELSE
WRITE#2 Q, R, DATE$
END IF
INPUT “ENTER ANOTHER”;A$
LOOP WHILE UCASE$(A$)=”Y”
CLOSE#1
CLOSE#2
END
a) The program opens two files .Why?
Two data files are opened to two different types of fuels (DIELES and PETROL) in separate files.
b) What are the information stored in each file?
The information stored in each file are: quantity, rate, and the current system date (DATE$ returns current system date)
c) Write only one CLOSE statement to close both the files.
CLOSE#1,#2
d) What will happen if APPEND in OPEN statements are replaced by OUTPUT?
When the program is executed for the next time all the data stored previously will be deleted as OUTPUT mode
always creates a new file and overwrite the previous file if it is already exists.
12. a) Write a program using FUNCTION... END FUNCTION to print all the vowels in the given string. [3]
Ans:-
DECLARE FUNCTION VOWEL$(A$)
CLS
INPUT "ENTER A STRING: "; W$
PRINT "VOWELS IN THE STRING: “ ; VOWEL$(W$)
END
FUNCTION VOWEL$(A$)
L = LEN(A$)
FOR X =1 TO L
C$ = MID$(A$, X, 1)
C$ = UCASE$(C$) 'CONVERT THE CHARACTER INTO UPPER CASE
IF C$="A" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN
V$ = V$ + C$
END IF
NEXT X
VOWEL$ = V$
END FUNCTION
b) Write a program using FUNCTION ... END FUNCTION to print the alternate characters of the given
string. (Hint: First. third, fifth, ... characters)
[3]
Ans:-
DECLARE FUNCTION ALTCHAR$(W$)
CLS
INPUT "ENTER A STRING: "; N$
PRINT "ALTERNATE CHARACTERS OF THE STRING ARE "; ALTCHAR$(N$)
END
FUNCTION ALTCHAR$(N$)
L = LEN (N$)
FOR X = 1 TO L STEP 2 'VALUE OF X WILL BE 1, 3, 5-----
C$ = MID$(N$, X, 1)
ST$ = ST$ + C$
NEXT X
ALTCHAR$ = ST$
END FUNCTION
c) A sequential data file "TRAVEL.TXT" contains name of passenger, number, destination and rate of
ticket. Write a program to calculate the total amount collected from the passengers going to “POKHARA”.
[3]
Ans:
OPEN "TRAVEL.TXT" FOR INPUT AS #3
DO UNTIL EOF(3)
INPUT N$, C, D$, R
IF UCASE$(D$) = "POKHARA" THEN
AMT = C * R
S = S + AMT
END IF
LOOP
PRINT "TOTAL AMOUNT COLLECTED: "; S
END
Subject: Computer Science (Optional II) 14
Group "A" (Fundamentals — 20 marks)
1. Answer the following questions: [5X2=10]
a) What is a network server?
Ans:- In client/server network, a computer that is dedicated to providing information or services in response to
external requests is called network server. In other words, it is a central computer of a network; used for shared
storage. A server may store software applications, databases, and data files for the network users. Depending on
the way a server is used, it also may be called a file sever, application server or server.
b)What is LAN topology? List the advantages of star topology.
Ans:- LAN topology refers to the physical layout or geometric arrangement of nodes and cable links in a local area
network. Network topology fall into two categories: centralized and decentralized. In a centralized topology,
such as star network, a central computer controls access to the network. This design ensures data security and
central management control over the network's contents and activities. In a decentralized topology, such as bus
and ring network, each workstation (node) can access the network independently and established its own
connections with other nodes.
Advantages of star topology are: -
• Easy to install and wire
• Easy to detect faults and to remove parts.
• No disruption to the network when adding and removing devices.
c) What is data security? List any two security measures to secure data.
Ans. Data security refers to the protection of data from different types of threats such as natural disasters, hardware
failure, criminal acts, malicious code, cyber terrorism etc. Two data security measures are:
• Valuable data files should be encrypted (converted into codes)
• Access privileges to the database should be limited and closely monitored etc.
d) Write any four symptoms that you may notice while working with the computer which is infected by
a computer virus.
Ans. We may notice the following symptoms:
• Programs in the computer may take longer time to load than normal.
• Drive light may keep flashing when we are not working with the drive.
• We may notice a list of unnecessary files with strange filename, which we have never created and
used before.
• Clicking noise may keep coming from the keyboard even if we do not press the wrong key.
• File/program size may keep changing etc.
SUB YOUNG(N$ ( ), A( ))
LET Y = A(l) : NAMES = N$(1)
FOR M = 2 TO 7
IF A(M) < Y THEN
Y=A(M) NAME$ = N$(M)
NEXT M
PRINT NAME$ , Y
DATA Ram,Sita,John,Shriya,Rabi,Kapil,Kamal,16,18,12,13,21,17, 19
END SUB
FUNCTION PPP(X, Y)
PPP = X*Y
END FUNCTION
Ans. 1, 2, 4, 8
11. Analyze the following program and answer the questions that follow: [4x I =4]
DECLARE SUB SSSS(A$)
DECLARE FUNCTION ZZZZ(K)
B$ = "ABCDE"
CALL SSSS(B$)
END
SUB SSSS(A$)
FOR J = I TO LEN(A$) STEP 2
M$ = MID$(A$, J, 1)
B = B +ASC(M$)
NEXT I
PRINT ZZZZ(B)
END SUB
FUNCTION ZZZZ(K)
DO WHILE K>0 '
R = K MOD 10
C=C+R
K=K\10
LOOP
ZZZZ=C
END FUNCTION
a) List the formal parameter and actual parameter of the function procedure ZZZZ.
Ans. Formal parameter : K Actual parameters: B
b) What will be the output of the program when executed?
Ans. Output will be: 3
c) What will be the output of the program if we exclude the function procedure and write PRINT B at the place of
PRINT ZZZZ(B)?
Ans. Output will be : 201
d) Will there be any change in output if we use the function ZZZZ in main module after CALL SSSS(B$) and
use SHARED B statement at the beginning of sub procedure SSSS?
Ans. No, there will not be any change in output of the program since the function will get the value of the same
variable B as actual parameter.
12. a) Write a program using FUNCTION ... END FUNCTION to count the numbers of even digits
in the given number. [3]
Ans:
DECLARE FUNCTION ISEVEN(N)
CLS
INPUT "ENTER A NUMBER"; A
DO WHILE A>0
R = A MOD 10
A =A \ 10
IF ISEVEN(R) THEN C = C + 1
LOOP
PRINT "NUMBER OF EVEN DIGITS:";C
END
FUNCTION ISEVEN(N)
IF N MOD 2 = 0 THEN
ISEVEN = -1
ELSE
ISEVEN = 0
END IF
END FUNCTION
b) Write a program to ask caller's name and telephone number and store them in a sequential data file
'MESSAGE.TXT' along with current system date and time. (No need to ask to enter another record) [3]
Ans:
CLS
OPEN "MESSAGE.TXT" FOR APPEND AS #2
INPUT "ENTER NAME:",N$
INPUT "ENTER TELEPHONE NUMBER:",PH$
LET D$ = DATE$
LET T$ = TIME$
WRITE #2, D$,T$,N$,PH$
CLOSE #2
END
c)Write a program to ask name and marks secured in English. Science and Computer, by the students and
store them in a data file 'MARK.DATA”. Make provision to ask user for another record. [3]
Ans:-
CLS
OPEN "A", #4, "MARK.DAT"
DO
INPUT "ENGLISH:", E
INPUT "SCIENCE:", S
INPUT "COMPUTER:"; C
WRITE #4, N$, E, S, C
INPUT "ENTER ANOTHER RECORD:";CH$
LOOP WHILE UCASE$(CH$) = "Y"
CLOSE #4
END
COMPUTER FOR SLC
Group 'A' Fundamentals (20 Mark)
11.Study the following program and answer the question that fallow. [4X1=4]
DECLARE SUB SHOW( ST$)
CLS
A$= “COMPUTER SCIENCE"
CALL SHOW (B$)
SUB SHOW (ST$)
L= LEN (ST$)
POST = (80 - L) /2
PRINT TAB (POST); ST$
ST$ = “EXAMNATION"
END SUB
a) What is the purpose of making SHOW sub procedure?
Ans:The purpose of subroutine SHOW is to print the given string at the centre of the screen
b) Separate formal parameter and actual parameters among A$, B$ and ST$
Ans:. B$ and A$ are actual parameters and ST$ is formal parameter.
c) Write the last statement of the main module without using the keyword CALL.
Ans:-SHOW B$
d) What will the 'PRINT A$' statement in the main module print?
Ans:-EXAMINATION
The value of formal parameter ST$ is changed to "EXAMINATIONN' in the subroutine which will change, the value
of the actual parameter A$ in the main procedure. (Example of pass by reference)
12.a)Write a program using SUB ... END SUB, to print reverse of a number. [3]
DECLARE SUB REV (N)
CLS
INPUT "ENTER A NUMBER:”;A
CALL REV(A)
SUB REV (N)
DO WHILE N> 0
R = N MOD 10
N = N \10
RV = RV * 10 + R
LOOP
PRINT "REVERSED OF NUMBER:”RV
ENDD SUB
b)Write a program, using FUNCTION ... END FUNCTION, to count vowels in the given string.[3]
DECLARE FUNCTION VOWEL (S$)
CLS
INPUT "ENTER A STRING”;P$
PRINT "NUMBER OF VOWELS IN THE STRING:” VOWEL(P$)
FUNCTION VOWEL (S$)
S$= UCASE$(S$)
FOR M = 1 TO LEN(S$)
C$ = MID$ (S$, M, 1)
IF C$="A" OR C$="E" OR C$="I" OR C$="O" OR C$="U" THEN V = V + 1
NEXT M
VOWEL = V
FUNCTION
c) Sequential data file “STUDENT.TXT' contains students' name and marks secured in English.
Write program to print the name of the student securing 32 marks or more. [3]
OPEN “STUDENT.TXT" FOR INPUT AS #3
PRINT "LIST OF STUDENTS SECURING 32 OR MORE"
UNTIL EOF(3)
INPUT #3, N$, E
IF E>=32 THEN
PRINT N$
END IF
LOOP
ClOSE#3
END
b. Write a program to declare function-procedure to print t supplied string in alternate capital letters. Suppose user inpu
"NEPAL" then output should be "NePaL". [3 ]
Ans:-
DECLARE FUNCTION ALTCAPS$ (N$)
CLS
INPUT "Enter String”; A$
AC$ = ALTCAPS$(A$)
PRINT "ALTERNATIVE CAPS ="; AC$
END
FUNCTION ALTCAPS$ (N$)
FOR I = I TO LEN(N$)
C$ = MID$(N$, I, 1)
IF I MOD 2= 1 THEN
W$ =W$ + UCASE$(C$)
ELSE
W$ = W$ + LCASE$(C$)
END IF
NEXT I
ALTCAPS$ = W$
END FUNCTION
c. A data file named "Employee.Dat" contains Name, Post an Salary for number of employees. Write a program to display data for the
employees whose salary is between 8000 to 12000. [3 ]
Ans:
OPEN "EMPLOYEE.DAT" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, N$, PS, S
IF S >= 8000 AND S <= 12000 THEN
PRINT N$, P$, S
END IF
LOOP
CLOSE #1
END
Subject: Computer Science F.M. 50
Time: 1hr 30 min P.M. 16
Group "A"
Fundamental (20 marks
1.Answer the following questions: [5X 2 = 10]
a)What are protocols? Write the names of common protocols of network?
Ans: Protocols are the set of rules that the computers in the network must follow to communicate and to exchange data with each other.
They are used to make a logical connection between different computers and transfer data from one computer to another. The names of
common protocols of network are as follows-:
i. TCP/IP
ii. ARP
iii. HTTP
iv. FTP
v. SMTP
vi. POP
b)What is e-mail? Write the advantages of e-mail?
Ans: E-mail is the world's largest electronic mailing system which is a most popular service of the Internet. It is an easy medium to
exchange of messages between the computers. More than 25 million people are directly connected to the Internet and can send receive
electronic mail.
The main advantages of e-mail are, it is very fast, easy and cheaper than any other means of communication.
c)What do you mean by multimedia? Name any five types o used in multimedia technology?
Ans: Multimedia is the combination of different media. The multimedia is made up of two separate words: 'multi' `and ` which means
many and materials, through which informed** transmitted.
i. Text
ii. Graphics
iii. Video
iv. Sound
v. Animation
d)What is computer virus? How does a virus spread from one computer to the another?
Ans: Computer virus is a computer program, which replicates itself by making copies of itself without the user's
knowledge. The programmer with the intent of destroying or damaging the data and programs residing in the
computer system writes it. It interferes the normal functioning of the computer.
Virus spread from one computer to another in various ways. It is usually passed through the infected files of the disk.
Some viruses transfer if you boot your computer with an infected disk while other can infect your system when you
copy a file from an infected disk. Ii is also passed when you download a file from the Internet or access data or
programs in a network.
e)What is computer security? Write any three measures to protect data and software from virus.
Ans: Computer security means security provided to protect hardware, software and data from intentional, accidental
and natural disaster.
Four different measures to protect data and software from virus are a,. follows:
i. Do-not use pirated software.
ii. Use anti-virus software to early detect the virus.
iii. Scan the mail or unknown' files of Internet before opening in your computer.
iv. Back up all important data and software.
a)The device which is used to convert analog signal into digital signal and vice-versa.
i) Processor
ii) MODEM
iii) Data cable
iv) Memory .
Ans: MODEM
b)Cyber law refers to the laws regarding the
i) Hardware and software
ii) Computer System
iii) Internet and cyberspace
iv) Computer programmer
Ans: Internet and cyberspace
Which is not computer virus?
Group "B"
MS-Access (10 marks)
7. Answer the following questions.
Ans: In QBASIC, program entry point is called main-module. It is located at the top of other modules. The main-
module is the controlling section of a modular programming.
b.What is function procedure? Write the types of function procedure. 1
Ans: Function procedure is a module which is written under main module. Function procedure accepts data as
parameter/parameters and returns value after manipulating the data.
Differentiate between Append and Output mode. 1
Ans: Append mode adds data to the existing data file. If specified file is not located it creates new data file.
Output mode creates new data file. If specified file is located then it erases the existing file and creates new one.
12.a. Write a sub-program to check whether input number is Even or Odd. User inputs data in the main program.
Ans:
DECLARE SUB MUL(N)
INPUT "ENTER A NUMBER:";X
CALL MUL(X)
END
SUB MUL(N)
R = N MOD 2
IF R=0 THEN
PRINT N; "is even"
ELSE
PRINT N; "is odd"
END IF
END SUB
b. Write a program to define a user defined function to find HCF of, two numbers. User should input numbers in the main
module and pass to the function as parameters. [3]
Ans:
DECLARE FUNCTION HCF (A, B)
CLS
INPUT "Enter first number:"; X
INPUT "Enter second number:"; Y
H = HCF(X, Y)
PRINT "HCF= "; H
END
FUNCTION HCF (A, B)
WHILE B 0
C = A MOD B A=B
B.=C
WEND