How To Exam?

a knowledge trading engine...


University of Mumbai 2003 B.E Computer Science COMPUTER PROGRAMMING - I - Question Paper

Sunday, 14 July 2013 04:35Web

COMPUTER PROGRAMMING - I (JAN. 2003)
part I
(a) Write a program that, provided a number as input, prints its square, cube and 4th power without doing any unnecessary computations. (3)
(b) Write a program which reads and multiplies together 20 real numbers (floating point numbers). * (3)
(c) Write a program to print a "4 times table" in the subsequent form. (3)
1x4 = 4
2x4 = eight

3x4=12
4x4=16 etc.
(d) Write a program that prints a Christmas tree. (4)

(Use escapes sequence to print the \ and " characters)
(e) Write a program that reads a number greater than or equal to 1,000 from the user where the user enters a comma in the input. Then print the number without a coma. Here is the sample dialog. (5)
Please enter an integer ranging from 1,000 and 999,999: 34,678 34678
(a) Write a program that learn 2 floating point numbers and tests whether they are the identical up to 2 decimal places. (4)
(b) Rewrite the subsequent do loop into awhile loop (4)
int n = 1;
float x = 0; float s;
do
{
S=1.0/(n*n);
x = x + s;
n++;
}
while (s>0.01);
(c) The Fibonacci sequence is described by the subsequent rule. The 1st 2 values in the sequence are one and 1. Every following value is the sum of the 2 values preceding it. Write a program that prompts the user for n and prints the nth value of the Fibonacci sequence. (4)
(d) Factoring of integers. Write a program that asks the user for an integer and then prints out all its factors. For example, when the user enters 150, the program should print (4)

2
3
5
5
3. (a) Write the program to calculate the distance S fallen by an object in free fall:
The formula is S = So + Vot + one /2at2.
Make a table of S for t=1,5, 10, 15,20,25……100. (8)
(b) Write a program to input data in to an array X (100), calculate the sum and avg.. Then count the number of values of X greater than the avg. and the number less than avg.. Print the values, The average, and the 2 counts. (8)
4. (a) 1 dimensional Array 'A [J]' has N elements and are in the memory of the computer. Write a program segment which
i) Interchanges A[1] and A[2], only if A[1] > A[2], interchanges A[3] and A[4] only if A[3] > A[4] and so on.
ii) Cyclically permutes the values of A so that A[2] contains the original value of A[1], A[3] contains the original value of A[2] and so on, with A[1] containing the original value of A[N]. (8)
(b) Write a program to learn the names and total marks of a class of 50 students. organize the data (names and marks) in descending order of total marks and print the output with proper headings. (8)
5. (a) List and discuss UNIX commands. (8)
(b) Write notes on UNIX Filestore (Files and Directories). (4)
(c) Describe UNIX as an operating System. (4)
part II
6. Explain the subsequent with suitable programs (18)
(a) Storage classes in C.
(b) Preprocessor directive # describe and # include.
(c) Strings and string handling factions in C.
7. A magic square is an n x n array of integers having the identical value for the entire row sums, column sums and sums of the 2 main diagonals. For Example: (16)
4 nine 2
3 five 7
8 one six
In a three x three magic square with the sum of the rows, columns and diagonals equals to 15. The algorithm for forming an n x n magic square when n is as follows:
(a) Generate the integers from one through n2.
(b) As this is done, place the 1st number in the middle of the bottom row of the array in position A (i, j).
(c) Place the rest of the number in position A (MOD (i, n) + 1, MOD(j,n) + 1}, unless a number is already there. In that case place it in position A(i-I,j).
(d) Repeat above step (step c.) until all the integers have been placed in the array. Write a program that generates and prints magic squares ofsizes3,5,7,9,11, 13,15.
8 With the help of Functions for matrix multiplication and transpose write a program to check the identity ( A X B )T = BT X AT where the order of matrix A is M X L and B is L X N. Also write functions for matrix studying and matrix display. (16)
9. (a) elaborate recursive functions ? discuss with suitable examples. (8)
(b) Write a recursive function to obtain the GCD of 2 numbers using the subsequent Euclid's recursive algorithm. (8)
GCD(m, n) if n > m
GCD (m, n) = m if n = 0
( GCD(n, m%n) otherwise
10.(a) What is a union ? How does a union differ from a structure ? discuss with suitable examples. (4)
(b) What is self referential structure ? For what type of applications are self referential structures useful? (4)
(c) Write a complete program to iimplement a structure for the subsequent fields. (8)
Name
Roll number
Date of Birth
Total marks
And also give the provision to sort the list (Array of structures) on
any desired Field e.g. on Name, Roll number, Date of Birth etc.




( 0 Votes )

Add comment


Security code
Refresh

Earning:   Approval pending.
You are here: PAPER University of Mumbai 2003 B.E Computer Science COMPUTER PROGRAMMING - I - Question Paper