Sunday, September 28, 2008

Mad Science - Nine of the oddest experiments ever

Read here about some of the most bizarre experiments conducted in the name of science.

More Computer Notes now available online

Now that I have all the time in the world, I decided to find out where is all my information on the web? I discovered that I had, over the last 5-7 years put up a lot of info - C programs, notes on computer graphics, systems programming, numerical methods, basics, networking, etc, etc. Here are some links that I can give immediately:

King Saud University - Saudi Arabia
- They have put up many of my Java notes.

http://groups.msn.com/ComputerNotesOnline
/ - You should have a Hotmail or Microsoft Live account to use this.

Notes Online at Yahoo Groups - This requires that you have a Yahoo email account.

My notes at Elphi web site.

Notes for MSc Comp Sc
(also useful for BSc and other classes)

Sunday, September 21, 2008

What does one do Now?

Its something that's difficult to explain. There's no rational, no logic. Only madness behind it. How else does anybody explain that a person puts in 7-8 hours a day in his teaching job, and gets kicked out. Just because some one who is quite incapable has his own ambitions to fulfill, whether he has any relation with the subject or not. Personal ambitions can ruin other peoples' lives. And this is what is happening.

I am not in a position to engage any lectures till the clouds clear up. When and whether that will happen, only God knows. But my commitment to my students remains. So if you have doubts, pls send an email or leave a comment on this blog. Will do my best to answer your queries.

And yes, do pray for better sense to prevail.

Wednesday, September 17, 2008

Careers in Computing

Here's a good site for info on careers in IT and computing:
http://computingcareers.acm.org/

Another New Opportunity for IT Professionals

So coding in C and Java is not your cup of tea but you still like to be in computing! Well, there's animation as a career option but it does require a different kind of aptitude. Social networking (here's a new site for that: http://www.tabup.com/Default.aspx) (as opposed to hardware networking) is also gradually becoming a full time occupation with many. But if green bucks is what you are looking for, why not combine your knowledge of computing, mathematics and explore a new field called " Financial Engineering".

Before you jump up with "but we are not commerce students", let me tell you this is not only for commerce or finance guys. Have a look at todays (17.9.2008) Ascent of Times Of India (Mumbai). Have a look at this web site for more on Financial Engineering: http://www.iafe.org/resources_what.html

IIM Calcutta offers a course in FE. Another one is the Institutre of Capital Markets (http://utiicm.com/ferm/index.asp#12)

Have a look at this career too!

Friday, September 12, 2008

C Assignment # 4

C Assignment # 4

1. Write a C program to compute the roots of a quadratic equation ax^2 + bx + c = 0. Coefficients a, b and c will be input by the user using scanf() function.

2. Explain the following terms with reference to C programming, and give suitable examples:
syntax error, logical error, and run-time error.

3. What is the filename extension of a program in C language?

4. Which software do you use to run C programs? Study this software and prepare a report on the following features of this software:
a. Editing Options
b. Debugging options
c. Compiling and running options
d. Window options
e. Environment options.

5. Write a program in C to convert distance in kms to equivalent distance in mts. E.g. if input is 267 kms, output should by 267000 mts. Be careful with the data types you use!

6. Banks pay an interest on the money you keep with them. Assume that the banks compute interest using the simple interest formula I = PRT/100. Compute the amount of money receivable at the end of T years when a principal sum of P is kept at an interest rate of R.

7. How will you modify the above problem if interest is paid using compound interest formula (interest compounded quarterly)? Look up the formula for compound interest on the Net or derive it on your own.

C Assignment # 3

Unit 2:

1. A C program contains the following declarations:
int i = 8, j = 5;
float x = 0.005, y = -0.01;
char c = 'c', d = 'd';

Determine the value of each of the following expressions. Use the values initially assigned to the variables for each expression.
(a) -(i + j)
(b) ++x
(c) c == 99
(d) y--
(e) --j
(f) j != 6
(g) 2 * x + ( y == 0)
(h) !(c == 99)
(i) (i > 0) && (j <> 0) || (j < i =" j" style="font-style: italic;">getchar() and the putchar() function in C.

3. Write a program in C to read in a line of lower-case text and convert it into upper-case text. Use the getchar() and putchar() functions. Assume that the line is terminated by the newline ('\n') character.

4. What is the purpose of the scanf() function? What is the purpose of the control string in a scanf() function? What is the use of the ampersand symbol in scanf()? If & symbol is not used with a variable in scanf() will it result in a syntax error?

5. What is the purpose of the printf() function? In printf() function, must the variable names be preceded by the ampersand function?

C Assignments # 2

Unit 1:

1. Describe the 5 arithmetic operators in C.

2. Consider an arithmetic expression where the operands are of different types. What are the rules that apply to such expressions?
[Ans: Consider the expression a + b, where a and b are variables.
(i) If a is floating point and b is double, then float variable is converted into double and the result is in the data type double.
(ii) If a is a floating point variable and b is an int data type, then b is converted into float type and then the expression is evaluated.
(iii) If a is int and b is long int, then a is converted into data type long int before the calculation is done.
]

3. What are the unary operators in C?

4. State the relational operators in C. What is the output an expression containing relational operators? Give appropriate examples.

5. State the logical operators in C. Give appropriate examples.

6. With the help of an examples, explain the use of the conditional operator (ternary operator) in C.

7. With appropriate examples, explain the pre-increment and post-increment operators.

8. With appropriate examples, explain the pre-decrement and post-decrement operators.

9. What are pre-processor directives? Give two pre-processor directives that you have used in C programs.

10. What are library functions in C? Give 5 examples and explain in brief.

Tuesday, September 2, 2008

BINARY SEARCH ALGORITHM

BINARY SEARCH ALGORITHM

The binary search algorithm is used to find out whether an element 'x' is present in a set of data which is in ascending order.


Consider a numeric array of size '
which is sorted in ascending order. We have to search for an element 'x´in this array.


Elements of this array can be written as A(1), A(2), A(3), … A(n). First find the middle value in the array, as follows:

If the array contains even number of elements, then:


Middle element = (n + 1) DIV 2

Compare the value of x with this middle element.

If the value of x is greater than the value of the middle element, adjust the lower limit like this:

Lower = middle + 1

Calculate middle element:

Middle = (lower + upper) DIV 2

If the value of x is less than the value of the middle element, adjust the lower limit like this:

Upper = middle - 1

Thus, each time one half of the array is not searched.

Algorithm:

1. Establish the sorted array of size n and element to be found x.

2. Set upper and lower limits.

3. Repeatedly:

a) Calculate the middle position of the array.

b) If value to be found (x), is greater than middle value, then

Adjust lower limit as:

Lower = middle + 1

Else adjust upper limit as:

Upper = middle - 1

Until sought value is found or lower > upper.

----------------------------------------------------------------------------------------------------------------