Quiz 2


  • Instructions(To Be Strictly Followed)

    Time : 1 Hour 20 Minutes.
    Mail your code to cs296@cse.iitb.ac.in.

    Make a shar archive of all your code files as follows. On the prompt give following command.
    shar -o <your-roll-no>.shar <code-files>...
    This will create an archive <your-roll-no>.shar.01. Mail this file as an attachment to the above address.

    The subject of the mail MUST be quiz2:msc for MScs and quiz2:btech for BTechs


  • PERL

    You are given a perl script which does the following :
    It takes a word and a filename as a command line argument and prints the number of times the word occurs in the file.

    You have to modify the script such that it takes the names of files as command line argument. ie

    $ getfreq file1 file2 ....

    and print the following

      word   frequency

    for all the words in all the files in sorted order.

    Get the sample files from here :
    file1
    file2
    file3

    Get the script from here :
    getfreq.pl

  • SHELL

    You are given the following 2 files :
    datafile1 : containing ascii text
    datafile2 having the following format

      word1   word2

    You are provided with a script which takes two words as command line arguments and replaces all occurances of word1 in file datafile1 with word2.

    You have to modify this script so as to do the following :
    Scan the datafile2, line by line to get word1 and word2 and replace all occurances of word1 by word2.

    Get the shell script from here :
    replace.sh


  • JAVA

    You are given an applet which can draw an arc and fill up that arc. You are also given a partial source code of the program where you have to make modifications to make it run like the shown applet. As a hint you have been shown the place where you can insert the code. However, if you can show the same output with some other method, it is fine. Your program will be graded only if it runs correctly . If it doesn't then you will get zero marks.

    Download the following file
    ArcTest.html
    ArcTest.java