Wednesday, March 29, 2023

Debug the following program

 SET - 1

Debug the following program and rewrite it.




1. REM to print all the records where address is Kathmandu

OPEN "ADD.DAT" FOR INPUT AS #1

CLS

WHILE EOF (1)

INPUT #1, NA$, AD$, G$

IF UCASE(G$)="KATHMANDU" THEN PRINT NA$, AD$, G$

WEND

CLOSE #10

END

 

Debugged Program:

REM to print all the records where address is Kathmandu

OPEN "ADD.DAT" FOR INPUT AS #1

CLS

WHILE NOT EOF (1)

INPUT #1, NA$, AD$, G$

IF UCASE$(AD$)="KATHMANDU" THEN PRINT NA$, AD$, G$

WEND

CLOSE #1

END

 

2. REM to create a new file CLS

OPEN “ABC.DAT” FOR INPUT AS #1

DO

INPUT “Enter Name, Roll No & Total. “; N$, R, T

INPUT #1, N$, R, T

INPUT “Supply more records Y/N”; C$

LOOP WHILE UCASE(Y$)=”Y”

CLOSE #1

END

 

DEBUGGED PROGRAM:

REM to create a new file CLS

OPEN “ABC.DAT” FOR OUTPUT AS #1

DO

INPUT “Enter Name, Roll No & Total. “; N$, R, T

WRITE #1, N$, R, T

INPUT “Supply more records Y/N”; C$

LOOP WHILE UCASE$(C$)=”Y”

CLOSE #1

END

 

3. REM to add record in an existing file

CLS

OPEN “Record.Dat” FOR OUTPUT AS #1

AA:

INPUT “Enter Name, Class and Roll No.”; Nm$, Cl, Rn

INPUT #2, Nm$, Cl, Rn

INPUT “More records”; Y$

IF UCASE$(Y$)=”Y” THEN GOT aa

CLOSE “Record.dat”

END

 

DEBUGGED PROGRAM:

REM to add record in an existing file

CLS

OPEN “Record.Dat” FOR APPEND AS #1

AA:

INPUT “Enter Name, Class and Roll No.”; Nm$, Cl, Rn

WRITE #1, Nm$, Cl, Rn

INPUT “More records”; Y$

IF UCASE$(Y$)=”Y” THEN GOTO aa

CLOSE #1

END

 

4. DECLARE SUB Series ( ) CLS

EXECUTE Series

END

SUB Series( )

REM Program to generate 1 1 2 3 5      upto the 20th terms

A=1

B=1

FOR ctr=10 to 1

DISPLAY A:B:

A=A+B

B=A+B

NEXT ctr

END Series ( )

 

DEBUGGED PROGRAM:

DECLARE SUB Series ( )

CLS

CALL Series

END

SUB Series( )

REM Program to generate 1 1 2 3 5      upto the 20th terms

A=1

B=1

FOR ctr=1 to 20

PRINT A; B;

A=A+B

B=A+B

NEXT ctr

END SUB

 

5. REM to display records from existing file.

CLS

OPEN “emp.txt” FOR APPEND AS #1

WHILE NOT EOF(#1)

WRITE #1, eN$, post$, salary

PRINT eN$, post$, salary

CLOSE #1

END

 

DEBUGGED PROGRAM

REM to display records from existing file.

CLS

OPEN “emp.txt” FOR INPUT AS #1

WHILE NOT EOF(1)

INPUT #1, eN$, post$, salary

PRINT eN$, post$, salary

WEND

CLOSE #1

END

 

6. REM Program to make a word reverse

DECLARE FUNCTION Rev$(N$)

CLS

INPUT “Enter a word”: N$

DISPLAY “Reversed is”; Rev$(N$)

END

FUNCTION Rev$(N$)

FOR K=LEN$(N$) to 1 STEP-1

B$=B$+MID$(N$,1,K)

NEXT K

B$=REV$

END FUNCTION

 

DEBUGGED PROGRAM:

REM Program to make a word reverse

DECLARE FUNCTION Rev$(N$)

CLS

INPUT “Enter a word”: N$

PRINT “Reversed is”; Rev$(N$)

END

FUNCTION Rev$(N$)

FOR K=LEN(N$) to 1 STEP-1

B$=B$+MID$(N$,K,1)

NEXT K

REV$ = B$

END FUNCTION

 

7. REM to add more data in a sequential file.

OPEN “EMP.DAT” FOR INPUT AS #2

DO

INPUT “ENTER NAME”; N$

INPUT “ENTER ADDRESS”; A$

INPUT “ENTER SALARY”; S$

WRITE #1, N$, A$, S

INPUT” Do you want to add more records.”; M$

LOOP WHILE UCASE(M$) = “Y”

END

 

DEBUGGED PROGRAM:

REM to add more data in a sequential file.

OPEN “EMP.DAT” FOR APPEND AS #2

DO

INPUT “ENTER NAME”; N$

INPUT “ENTER ADDRESS”; A$

INPUT “ENTER SALARY”; S

WRITE #2, N$, A$, S

INPUT” Do you want to add more records.”; M$

LOOP WHILE UCASE$(M$) = “Y”

CLOSE #2

END

 

8. Rem to convert the given number in reverse order

DECLARE FUNCTION REV (A)

CLS

INPUT "ENTER A NUMBER"; A

CALL REV (A)

PRINT "REVERSE ="; RE

END

FUNCTION REV$ (A)

WHILE A<> 0

R= A MOD2

S = S * 10 + R

A = A - 10

WEND

REV = S

END SUB

 

DEBUGGED PROGRAM:

Rem to convert the given number in reverse order

DECLARE FUNCTION REV (A)

CLS

INPUT "ENTER A NUMBER"; A

PRINT "REVERSE ="; REV (A)

END

FUNCTION REV (A)

WHILE A<> 0

R= A MOD 10

S = S * 10 + R

A = A \ 10

WEND

REV = S

END FUNCTION

 

9. DECLARE FUNCTION PAL$ (W$)

CLS

INPUT "Enter a word"; W$

SHOW PAL$ (W$)

END

FUNCTION PAL$ (W$)

FOR I= LEN (W$) TO 1 STEP1

R$=R$+MID$ (W$, I, 1)

NECT I

IF R$-W$ THEM

P$="Palindrome"

ELSE

P$="Not palindrome"

ENDIF

P$=PAL$

END FUNCTION

 

DEBUGGED PROGRAM:

DECLARE FUNCTION PAL$ (W$)

CLS

INPUT "Enter a word"; W$

PRINT "GIVEN WORD IS "; PAL$ (W$)

END

FUNCTION PAL$ (W$)

FOR I= LEN (W$) TO 1 STEP -1

R$=R$+MID$ (W$, I, 1)

NEXT I

IF R$ =W$ THEN

P$="Palindrome"

ELSE

P$="Not palindrome"

END IF

PAL$ = P$

END FUNCTION

 

10.  REM print the input integer in reverse order

DECLARE SUB REV (N)

CLS

INPUT "Enter an integer number"; NO

CALL REV (NO)

END

SUB REV (N)

A = N

WHILE A = 0

R = A MOD 10

S = S + 10 + R

A = A \ 10

NEXT

DISPLAY "Reverse"; S

END SUB

 

DEBUGGED PROGRAM:

REM print the input integer in reverse order

DECLARE SUB REV (N)

CLS

INPUT "Enter an integer number"; NO

CALL REV (NO)

END

SUB REV (N)

A = N

WHILE A <> 0

R = A MOD 10

S = S * 10 + R

A = A \ 10

WEND

PRINT "Reverse"; S

END SUB

Thursday, March 16, 2023

Computer Security Question & Answer

 




Computer Security | Hardware and Software Security

 

Solved Question & Answer

1. What is computer security?

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

 

2. What are the main objectives of computer security?

Ans: The main objectives of computer security involves ensuring confidentiality, integrity, and availability of assets or information.

 

3. What are the major types of security?

Ans: The types of security are:

·       Hardware security                     

·       Software security

 

4. Write down any five possible threats to computer security?

Ans: five possible threats to computer security are:

·       Human error

·       Computer crime

·       Natural disasters

·       War and terrorist activity

·       Hardware failure

 

5.  Why do we need to provide security to our computer system?

Ans: We need to provide security to our computer system because if we do not take care of a computer system than our valuable data, information and programs may be lost or damaged. We may lose data, information or programs due to computer viruses. The computer system may be damaged due to some physical factors like fluctuation in electric power, dust, overheat, etc. Thus to protect our computer from various negative aspects we should provide security to our computer system.

 

6. What is hardware security?

Ans: The security given to the various hardware tools or equipment from being lost or damaged due to accidental or intentional harm is known as hardware security.

 

7. List some of the hardware security measures.

Ans: Some of the hardware security measures are:
i)Regular  maintenance
ii) Insurance Policy
iii) Power Regulator Device
iv) Fire detectors
v) Protection from theft

 

8. What is software security?

Ans: The security given to the software and data from being lost or damaged due to accidental or intentional harm is called software security.

 

9. List some of the software security measures.

Ans: Some of the software security measures are:
i) Backup
ii) Scandisk
iii) Defragmentation
iv) Password

 

10.  What is voltage regulator device? Give example.

Ans: A voltage regulator device is an electrical regulator device designed to automatically maintain a constant voltage level.
E.g.: Spike guard, Volt guard, etc.

 

11.  What is the function of voltage regulators?

Ans: The voltage regulator automatically maintains a constant voltage level.

 

12.  What are power protection devices? Give examples.

Ans: The device that provides clean AC power to sensitive electrical equipment are called power protection devices. Examples are: UPS, Volt Guard, Spike guard, etc.

 

13.  Why is power protection device needed in a computer system?

Ans: Power protection device is needed in a computer system to protect the computer system from damage and expensive data loss.

 

14.  What is UPS?

Ans: A UPS is a device that allows computer to keep running for at least a short time when the primary power source is lost. It provides continuous power supply to the computer system and protects them from power surge and voltage fluctuation.

 

15.  What is importance of UPS in computer security system?

Ans: The importance of UPS in computer security system is that it controls fluctuation of electric voltage and provides enough backup electric power to the computer system when there is power failure.

 

16.  Why do the computer system need regular maintenance?

Ans: Computer system need regular maintenance to keep the computer hardware in good working condition and it also helps to find out problems in hardware and correct the problems before they cause several damages.

 

17.  What should be done to protect computer system from fire and theft?

Ans: Fireguards and fire extinguisher should be installed to protect computer system from fire. Alarms, security lighting and closed circuit television cameras should be used to protect computer system from theft.

 

18.  What is surge protector?

Ans: A device that shields computer and other electronic devices from surges in electric power or transient voltage, that flow from the power supply.

19.  What is password?

Ans: A password is a secret word or phrase that gives a user access to a particular program or system.

 

20.  What is cryptography? How encryption helps in data protecton?

Ans: The cryptography is the method of protecting data/information and communications by converting content using codes into a format that is unreadable for an unauthorized user.

     

Encryption helps in data protection by providing a secure way to store and transmit sensitive information.

 

21.  What is password policy?

Ans: A set of rules designed to enhance computer security by encouraging user to employee strong passwords and use them properly is called password policy.

 

22.  What should be done to protect the system form unauthorized access?

Ans: To protect a system from unauthorized access, password should be kept in a system which provides security to the system. A password should be difficult to guess and determine and should be changed regularly and memorized.

 

23.  What is backup?

Ans: Backup is a copy of a file which is used in the event of the original file being corrupted.

 

24.  Why is backup vital to computer system?

Ans: Backup is essential to computer security system to recover the important data and programs from accidental and intentional harm. They are stored in different storage devices like hard disk, CDs and pen drives. When the data and software gets lost or damaged the backup system helps to recover the lost or damaged data or software from the backup copy of data and software.

 

25.  How can software prevent data loss?

Ans: Software prevents the data loss by the following ways:
i) Antivirus software can detect and remove virus from the computer.
ii) Scan disk checks folders, bad sector and other error of the disk and fix them.
iii) Software for backup helps in securing the information by keeping backup.

 

26.  What is scan disk?

Ans: Scan disk is a process which involves in maintaining the disk files and folders using a kind of utility software which checks files, folders, bad sectors, lost clusters, lost chains and any errors of the specific disk and  can fix them if it is possible.

 

27.  What is defragmentation?

Ans: The process of re-writing parts of a file to contiguous sectors on a hard disk to increase the speed of access and retrieval is called defragmentation.

 

28.  What is fragmentation?

Ans: The scattering of the parts of the same disk file over different location is called fragmentation.

 

29. What is firewall in computer? Write its types.

Ans: A firewall is a security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules.

           Its types are Software Firewall and Hardware Firewall

 

******