IIEST, Shibpur

Indian Institute of Engineering Science and Technology, Shibpur

(Formerly Bengal Engineering and Science University, Shibpur)

Empowering the nation since 1856

आई आई ई एस टि, शिवपुर

भारतीय अभियांत्रिकी विज्ञान एवं प्रौद्योगिकी संस्थान, शिवपुर

(पूर्व में बंगाल इंजीनियरिंग एंड साइंस यूनिवर्सिटी)

१८५६ से देश को सशक्त बनाना

Assignments

First Week (January 16, 2012)

  1. Familiarization with the network environment of the laboratory - working on the Unix server from Windows clients. Create a file using "vi" editor and save your class-note, whatever have been discussed in the class.

 

Second Week (January 30, 2012)

Third Week (February 6, 2012)

  1. Write a user-friendly C program that prints the prime numbers between two positive integers. The positive integers are to be read from the user.
  2. Write a complete user-friendly C program that reads inetegers as long as the user likes and then prints the smallest and largest among them.
  3. Write a complete user-friendly C program that reads integers from the user and print them in binary format.

  4. Let A0 + A1*X1 + A2*X2 + A3*X3 + ..... An*Xn is a polynomial where Ai is the co-efficient of the term Xn. Let the these co-efficients are integers and stored in an array. Write a complete user-friendly C program that reads the polynomial (that is, the co-efficients) from the user and evaluates the polynomial for different values of X.

Fourth Week (February 6, 2012)

  1. Write a complete user-friendly C program that reads integers from the user until the user gives a negetive integer, when the program prints the number of occurences of decimal digits in the numbers (excluding the last negetive integer) given so far.
  2. Write a complete user-friendly C program that reads integer numbers (at most of 4 digits) from the user and prints them in words.

  3. Write a complete user-friendly C program that reads an integer from the user and prints all the unique inetegers which are just permutations of the digits of the given number. For example, if the given number is 3990 then the program should print 399, 939, 993, 3099, 3909, 3990, 9039, 9093, 9309, 9390, 9903, 9930.

Fifth Week (February 13, 2012)

  1. Write a complete user-friendly C program that reads a sentence from the user and then prints the sentence after dropping the non-english, non-space and non-punctuation characters. That is, if the user enters "Hello world! how $weet & beatiful *s are!" then the program should print "Hello world! how weet beatiful s are!".
  2. Write a C-program that prints the complete ASCII table. That is, the program prints the code of each character as present in the ASCII table. The printing should be in ascending order of the code.
  3. Write a complete user-friendly C program that reads a sentence from the user and then prints the frequencies of occurrences of each english letter in the sentence. Assume that a sentence is nothing but a sequence of characters ending with a stop (.). Do not distinguish between upper-case and lower-case (that is, small and capital letters). In other words, the counting should be case-insensitive.
  4. Write a complete user-friendly C programs that reads integers as long as the user wants and then finds out and prints their common factors, that is, prints those numbers which are factors of all the given integers. A typical execution session of the program will be as follows

$./a.out

Give an integer: 12

Want to give another integer? y

Give an integer: 18

Want to give another integer? n

The common factors are 2 3.

Sixth Week (February 20, 2012)

Write functions in C as specified below. In each case write a complete and user-freindly program to demosntrate the working of the function.

    1. int largest(int data[][20], int r, int c): the function returns the largest element from data considering r rows and c columns.
    2. int factors(int n, int f[]): the function finds out the factors of n and stores them in f. It returns the no of factors those have been found.
    3. int find(int data[][20], int r, int c, int n): the function searches for n in the array data considering its r rows and c columns. The function returns 1 (true) if n is there in the array, otherwise, it returns 0 (false).
    4. void printInitials(char fullname[]): the function prints the initials of the name that has been passed through fullname. For example, if fullname contains "abcd xyz pqr", then the function should print "a.x.p.". Assume the the string in fullname is null terminated.
    5. void compact (char str1[], char str2): the function compacts the string passed in str1 by dropping all the white space characters (space, tab, newline) and stores the compacted string in str2. For example, if "abc xyz pqr " is passed in str1 then str2 should contain "abcxyzpqr".

Seventh Week (March 12, 2012)

Write functions in C as specified below. In each case write a complete and user-freindly program to demosntrate the working of the function.

    1. int stringReplace(char src[ ], char c1, char c2): the function replaces every occurrences of the character c1 in the string src by the the character c2 and returns how many such replacements have been done. As usual assume that src contains a null terminated string.
    2. void shiftRightAndRotate(char src[ ], int n): the function shifts and rotates the characters of the string src toward right by n places. For example, the string "abcde" when shifted and rotated toward right by 2 places becomes "deabc"; when by 3 places becomes "cdeab".
    3. int sumOfNIntegers(int data[ ], int N): a recursive function that returns the sum of first N integers from the array data.
    4. int largestOfNIntegers(int data[ ], int N): a recursive function that returns of the first N integers from the array data.
    5. int stringCompare(char str1[ ], char str2[ ]): a recursive function that compare strings str1 and str2 - returns 0 if both are same, -1 if alphabetically str1 comes before str2 and 1 if alphabetically str1 comes after str2.
    6. int HCF(int n1, int n2): a recursive function that returns the HCF of n1 and n2.

 

Eigth Week (March 19, 2012)

Make-up class - Those who could not complete earlier assignments should try them.

Students not having any pending assignments either may leave or try to write programs using pointer variables to demonstrate how data (+ve, -ve integers, float, ...) are kept in the memory.

 

Tenth Week (April 2, 2012)

  1. Let Complex Numbers be represented by structure variables in your program. Write a complete and user-freindly C program that reads complex numbers from the user as long as (s)he wishes and then prints the largest one. Let a complex number C1 be larger that another complex number C2 if absolute value of C1 is greater than that of C2.
  2. Write a complete and user-friendlyl C program that reads a few complex number and print them in ascending order. As mentioned above, the comparison between two complex numbers is in terms of their absolute values.


Twelfth Week (April 16, 2012)

  1. Let a point be represented by a structure
              struct point {
                    float x,
                    float y;
               }
    and a circle be represented by a structure
              struct circ {
                     struct point centre;
                     float radius;
              }.
    Write a function struct mergeCircle(struct circle C1, struct circle C2) that returns the circle whose area is the sum of the areas of C1 and C2 and whose centre is at the midpoint of the straight line joining the centres of C1 and C2. Write a complete program to demonstrate your function.
  2. Write a program that reads as many circles (as stated in the previous case) as the user wants stores them in a dynamically created "array" and print the circles (that is, their radius and centre) in ascending order of their area.