Friday, July 15, 2022

Link to new website

I am no longer updating this blog. I now have the site https://scitechgen.com where I put up more information and it is also updated regularly. Please visit the site https://scitechgen.com for more. 

I also have my YouTube channel youtube.com/scitechgen where I put up explanatory videos on Computer Science, mathematics, Physics and Statistics. 

 It will be nice if you can join me in these two places (its FREE!) and share your views, experiences and articles. 

Thank you.

Wednesday, May 25, 2011

Project ideas for TYBSc IT and TYBSc Comp Sc

http://bsc-it-compsc.blogspot.com/2011/05/project-ideas-for-tybsc-it-and-tybsc.html

Wednesday, March 4, 2009

International Balkan University, Macedonia

International Balkan University, Macedonia has recommended my notes on computer science and IT for their course in IT.

Thank you Prof. Melih Bulu, Assistant Ibrahim Dincer, M.Sc.
http://www.ibu.edu.mk

Thursday, September 11, 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

C Assignment # 3

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 < 5)
(j) (i > 0) || (j < 5)
(k) i += 2
(l) j -= 3
(m) i = j = 6

2. Explain the use of the 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 Assignment # 2

C Assignment # 2

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.

C Assignment # 1

C Assignment # 1

1. What are some uses for comments?
2. Why is indentation important?
3. What are the largest & smallest values that can be stored in an int type variable?
4. What is the difference between the constants 7, '7', and "7"?
5. What is the difference between the constants 123 and "123"?
6. What is the function of the semicolon in a C statement?
7. State the various data types in C language.
8. Explain why the largest value that can be stored in an int type variable is 32767?

Programming Exercises:

1. Write a program to print the numbers from 1 to 10 and their squares:

1 1
2 4
3 9
...
10 100

2. Write a program to print this triangle:

*
**
***
****
*****
******
*******
********
*********
**********

Don't use ten printf statements.


3. What would be the equivalent code, using a while loop, for the following example ?

for(i = 0; i < 10; i = i + 1)
printf("i is %d\n", i);


4.What would this code print?

int i;

for(i = 0; i < 3; i = i + 1)
printf("a\n");
printf("b\n");

printf("c\n");


5. Write a program to compute the average of the ten numbers 1, 4, 9, ..., 81, 100, that is, the average of the squares of the numbers from 1 to 10.

6. Write a program to print the numbers between 1 and 10, along with an indication of whether each is even or odd, like this:

1 is odd
2 is even
3 is odd
...

7. Write a program to print the first 7 positive integers and their factorials in this form:
1! = 1
2! = 2
3! = 6
4! = 24, etc

8. Write a program to print the first 10 Fibonacci numbers. Each Fibonacci number is the sum of the two preceding ones. The sequence starts out 0, 1, 1, 2, 3, 5, 8, ...