1CSc.102-2065 2065 Candidates are required to give their answers in their own words as for as practicable. 1. Draw the flow chart for finding largest of three numbers and write an algorithm and explain it. 2. Find the valueof a in each of the following statements: int i = 3, j = 4, k =8; float a = 4.5, b = 6.5, c = 3.5; a) a = b-i/k + c/k b) a = (b-k)/j + (j+c)/k c) a = c - ((i+j)/(k+i)) *b d) a = c - i + j/k + i * b e) a = c + j % 2 +b f) a = (b + 1) % (c + 1) 3. Write a program for the interest charged in installments for following case. A cassette player costs Rs. 2000. A shopkeeper sells it for Rs. 100 down payment and Rs. 100 for 21 more months. What is the monthly interest charged? 4. Write a program that uses a for loop to compute and prints the sum of a given numbers of squares. 5. Write a program to obtain the product of the following matrices and explain it: A = 3 5 7 2 3 4 4 5 2 B = 7 6 6 5 4 3 6. Write a function to add, subtract, multiply and divide two complex numbers (x + iy) and (c + id). 7. Write a program which will read a line and delete from it all occurrences of the word that. 8. What is pointer and explain its applications? Write a program that uses pointers to copy an array of double. 1
1CSc.102-2065 Define a pointer. Write a function that is passed an array of n pointers to the maximum of the n floats. 9. Define a structure of employee having data members name, address, age and salary. Take data for n employee in an array dynamically and find the average salary. 10. Given a text file, create another text file deleting the following words three, bad and time. Why do you require graphical function? Explain the basic graphical function with suitable program. 2
1CSc.102-2066 2066 Candidates are required to give their answers in their own words as for as practicable. 1. Why flowchart is required? Explain different symbols used in the flow chart and explain with suitable example. 2. Determine which of the following are valid identifiers? If valid, explain why? a) record1 b) 1record c) file_3 d) return e) #tax f) name g) goto h) name and address i) name-and-address j) 123-45-6789 k) Void l) name_address 3. Find the error in the given program and explain it. Write the correct program. #include<stdio.h> #include<math.h> main { float p,r,n; printf( Please enter the value for the principal (P): ); scanf(%f, &p): printf( Please enter the value for the interest rate (R)); scanf( %f, &r); printf( Please enter the value for the number of years (n): ); scanf( %f, n); = p * pow + r/100), n); Printf( \n The final value (F) is: %. 2f\n, f); 4. Write a program that uses a while loop to compute and prints the sum of a given numbers of squares. For example, if 4 is input, then the program will prints 30, which is equal to 1 2 + 2 2 + 3 2 + 4 2 5. Write a program to enter two 3 x 3 matrices and calculate the product of given matrices. 6. Explain the use of two dimensional arrays. Illustrate it with suitable program and explain it. 3
1CSc.102-2066 7. Write and test the following power ( ) function that returns x raised to the power n, where n can be any integer: double power (double x, int p) 8. Justify that pointer is jewel in C language. Write a function that is passed an array of n pointers to floats and returns a newly created array that contains those n float values in reverse order. Assume any necessary data. Explain pointer with suitable diagram. Write a function that uses pointers to search for the address of a given integer in a given array. If the given integer is found, the function returns its address; otherwise it returns NULL. 9. Why structure is required? Make a program using structure of booklist having data members title, author and cost. Enter four data and calculate total cost. 10. Create a text file and enter to write a good program is very time consuming job. Create another text which contains reverse of above text. Explain the use of graphical function. Make a program that contains basic graphic functions. 4
1CSc.102-2067 2067 Candidates are required to give their answers in their own words as for as practicable. 1. Draw the flow chart for the solution of a quadratic equation and write an algorithm and explain it. 2. Find the value of a in each of the following statements: int i = 2, j = 5, k = 7; float a = 1.5, b = 2.5, c = 3.5; a) a = c i/j + c/k; b) a = (c-i)/k + (j+b)/j; c) a = b * b (( i + j)/c); d) a = b k + j/km + i * c; e) a = c + k % 2 + b; f) a = (b + 4) % (c + 2); 3. A machine is purchased which will produce earning of Rs. 20000 per year while it lasts. The machine cost Rs. 120000 and will have a salvage value of Rs. 20000 when it is condemned. If the 12 percent per annum can be earned on alternative investments what should be the minimum life of the machine to make it a more attractive investement compared to alternative investements? 4. Write a program to transpose the following matrix. 3 7 5 2 8 A = 2 5 8 3 4 6 9 3 6 5 5. Write a program that uses a do while loop to compute and prints the sum of squares given n numbers. 6. Write a function to multiply two n x n matrices. 7. Write a program to count the number of words in sentence. 8. Why pointer is called jewel of C language? Write a program that uses pointers to copy an array of integer. 5
1CSc.102-2067 Explain the importance of pointer. Write a function that is passed an array of n pointer to floats and returns a newly created array that contains those n float values. 9. Define a structure of student having data members name, address, marks in C languages and marks in information system. Take data for n students in an array dynamically and find the total marks obtained. 10. Some text file is given, create another text file replacing the following words Ram to Hari, Sita to Gita, and Govinda to Shiva. What are the uses of graphical function? Explain the basic graphical function with suitable program. 6
1CSc.102-2068 2068 Candidates are required to give their answers in their own words as for as practicable. 1. Write an algorithm and flow chart to determine whether a given integer is odd or even and explain it. 2. How can you declare the variable in C? Explain with example. 3. Write a program to find the factorial of a given integer. 4. Explain switch statement with example. 5. Write a program to find the largest and smallest among the given elements in array. 6. Explain the user-defined functions and its type with example. 7. Write a program to accept numbers and sort them with using pointer. 8. Explain the passing structure to function with example. 9. Write a program to accept any number and print the sum of the number up to a single digit through recursive function. 10. Explain the pointer to structure with example. Write short notes on: a) Dynamic memory allocation b) Opening and closing file 7
CSc.102-2069 2069 Candidates are required to give their answers in their own words as for as possible. 1. What an algorithm and flow chart to find out whether a given integers is zero, +ve or ve and explain it. 2. What are the basic four data types uses in c programming? What are its size and range? 3. Explain the if else statement with example. 4. Differentiate between break and exit statement with example. 5. Explain the multidimensional array with examples. Write a program to convert a lowercase character string into uppercase. 6. Explain the library functions with examples. 7. Write a program to find the sum of all the elements of an array suing pointers. 8. Explain the pointer arithmetic with example. 9. Explain the array of structure and write a program to accept record of 15 person which has name, age and address and also display them. 10. What are the three types of input/output functions with support in C-programming? Explain with example. Write short notes on: a) Delimiters b) Graphics function 8