Structured Programming Language C: LU Mid-Term Exam - 2010
Question no. 1 What is Programming? Define Compiler. Write a program to calculate the following: F = a*b-b*c-c 2 *(b-1)/3 Which of the following are valid/invalid names for variables? If invalid, explain why? _abc 9abc A098 abc Write the difference between WHILE and DO-WHILE loop. Question no. 2 Write a for loop to print all the odd numbers from 122 to 10000. Write the output of the following code: int main() { int n=5, i, j; for(i=5; i>=1; i--) { for(j=1; j<=i; j=j+2) { printf("%d",j); } printf("\n"); } } Given N, write a program to output the following: 1234...(N-1)N 1234...(N-1) ...... 12 1 Question no. 3 What is an Array? Why do we need array? Write a program to take 1000 numbers as input. Print the numbers in reverse order. Write a program to find MAXIMUM between 100 numbers. Question no. 4 Write a program to find MINIMUM between 2 numbers. Write a program, which will take MARK as input and s