Pages

Monday 3 October 2011

CS 101 Introduction to Computing Solution (Assignment # 8) Fall 2011


CS 101 Introduction to Computing

Solution (Assignment # 8)


Q #1.
(a) What is the difference between Viruses and Worms? You can take help from internet to answer this question. Give your answer precisely and to the point.

Ans. Differences between a virus and a worm:

Following are the differences between a virus and a worm:

Difference in Need for Embedding:

  • A virus needs to embed itself in the code of some other executable program etc so that virus code can execute during execution of the infected program.

  • A worm does not need to embed itself in any other executable program rather a worm can exist independently.

Difference in Methodology of Working:

  • A virus tries to damage the infected system and it propagates itself to other files or hard disks etc.

  • For instance, if we connect another hard disk to a virus-infected system then the virus can also attack this new un-infected hard disk.

  • A worm may also damage the infected system and it automatically copies itself to other computers on the network which have a certain security hole.

  • A worm uses network features like “file transfer capability” to send its copies.

Difference in Basic Intention:

  • The basic intention of a virus is to damage the computer resources like hard disk, Partition Table, Boot Sector and user data etc.

  • The basic intention of a worm is to send its copies over the network and slow down the performance (speed) of the network.

  • Worms also try to slow down the servers by putting a huge load of network traffic.

  • For this purpose, a worm consumes the network bandwidth by sending its large number of copies to other computers.

  • However, the worm can also perform damage to a system in addition to consuming network bandwidth.

Difference in Execution:

  • Since, a virus is part of some other executable code so, it can only be executed when the original executable code executes.

  • Since, a worm can exist independently so, it can be in execution without the execution of some other host program.



Difference in Hardware Requirements for Propagation:

  • A worm always needs some computer network to distribute its copies to other computers.

  • A worm cannot propagate without the presence of any computer network.

  • Also, a worm will not create its multiple copies on a single computer.

  • A virus does not need a computer network to propagate rather it can infect the files on the local system.

  • Also a virus can move to other hard disks e.g., when we try to transfer data between hard disks.

Difference in Need for Human Actions for Propagation/Execution:

  • A virus may exist on a computer but it cannot perform damage/propagation automatically unless we (humans) somehow execute the infected file directly or indirectly.

  • A worm does not need any human action for its propagation and execution rather it can automatically propagate (send copies) through the computer networks.



(b) What precautionary steps can you take to protect your computer from different   viruses? Briefly explain in points                   

Ans. There are several things that you should do to protect your computer from virus infections:
·    Use a high-quality anti-virus program, and be sure to update it regularly. Use it to scan any files, programs, software, or diskettes (even new software from a commercial company) before you use them on your computer.
·    Make back-up copies of important documents or files and store them on separate diskettes. Making backups will also protect your information against accidental file deletion, diskette failure, and other damage.
·    Whenever you use a computer in a campus lab, be sure to reboot or run "cleanup" before you start your session and log out when you end your session.
·    Do not share commercial software with anyone. It is a violation of the author's copyright to distribute such material, and it is a way to spread viruses.
·    When you get public domain (PD) software for which the author has granted permission to make copies, get it from a reliable source. (For example, and individual you do not know is not a reliable source.) Before you run PD material, use an anti-virus program to inspect for known viruses.
·    Always scan your disks and files after using them on another computer.
·    Always scan all files you download from the Internet.
·    Always scan Word or Excel file email attachments before you read them.

Q #2.
Write down the output for each part of the JavaScript code.         

(a)
<script type="text/javascript">

for(var a=1; a<6;a++)
                                                                   
document.write(a);                                                       // output = 12345

</script>

(b)
<script type="text/javascript">

var str="Islamic Republic of Pakistan"

document.write(str.substr(19));                            // output = Pakistan


</script>


(c)
<script type="text/javascript">

document.write(Math.round(5.55));                     // output = 6

</script>

(d)
<script type="text/javascript">

document.write(Math.cos(0));                               // output = 1
                                                                                     
</script>

(e)
<script type="text/javascript">

document.write(Math.sqrt(100));                         // output = 10

</script>