INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING COURSE DESCRIPTION FORM Course Title Course Code Regulation Course Structure Course Coordinator Team of Instructors COMPUTER PROGRAMMING LAB A10581 R13 - JNTUH Lectures Tutorials Practicals Credits - - 3 4 Ms. B. Padmaja, Associate Professor Ms. G. Sunitha, Associate Professor, Ms. Y. Mohana Roopa, Associate Professor, Ms. T. Ramya, Assistant Professor I. COURSE OVERVIEW: The objective of this lab is to understand various steps in program development using C programming language. This lab complements the computer programming course. Students will learn to write programs using structured programming approach to solve real world problems. Students will gain knowledge on basic data structures such as lists, stacks, queues, simple searching and sorting methods. II. PREREQUISITE(S): Level Credits Periods/ Week Prerequisites UG 4 3 Mathematical background and Logical Thinking III. MARKS DISTRIBUTION: Sessional Marks There shall be a continuous evaluation during the semester for 25 marks. Day-to-day work in the laboratory shall be evaluated for 15 marks and internal practical examination conducted by the concerned teacher shall be evaluated for 10 marks. End Semester Exam Total Marks 50 75 IV. EVALUATION SCHEME: S. No Component Duration Marks 1. Day-to-day Evaluation - 15 2. Internal Practical Examination 2.5 hours 10 5. End Semester Examination 2.5 hours 50 V. COURSE OBJECTIVES: I. Be familiar with the basic building blocks of C language. II. Be familiar with the structured programming approach. III. Be familiar with the pre defined and user defined functions. IV. To strengthen the ability to identify basic data structures and its usage. 1 P a g e
V. To gain knowledge in practical applications VI. Be familiar with the various sorting and searching methods. VI. COURSE OUTCOMES: At the end of the laboratory course the students are able to: 1. Write programs in C to solve real-world problems. 2. Choose the appropriate data structure and algorithm design method for a specified application. 3. Implement linear data structures such as lists, stacks, queues. 4. Implement simple searching and sorting methods. 5. Understand which algorithm or data structure to use in different scenarios. 6. Write complex applications using structured programming methods. VII. COURSE PLAN: Division of Experiments Control Statements List of Experiments Week -1 a. Write a C program to find the sum of individual digits of a positive integer. b. A Fibonacci sequence is defined as follows: the first and second terms in the sequence are 0 and 1. Subsequent terms are found by adding the preceding two terms in the sequence. Write a C program to generate the first n terms of the sequence. c. Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user. d. * A character is entered through keyboard. Write a C program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol using if-else and switch case. The following table shows the range of ASCII values for various characters. Characters ASCII values A Z 65 90 a z 97 122 0 9 48 57 Special symbols 0 47, 58 64, 91 96, 123-127 e. * If cost price and selling price of an item s input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Write a C program to determine how much profit or loss incurred in percentage. Week -2 a. Write a C program to calculate the following sum: Sum = 1 x 2 /2! + x 4 /4! x 6 /6! +x 8 /8! x 10 /10! b. Write a C program to find the roots of a quadratic equation. c. * Write a C program to print the numbers in triangular form 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Week 3 a. The total distance travelled by vehicle in t seconds is given by distance s = ut + 1/2at 2 where u and a are the initial 2 P a g e
Functions Arrays Strings velocity(m/sec) and acceleration (m/sec 2 ). Write C program to find the distance travelled at regular intervals of time given the values of u and a. The program should provide the flexibility to the user to select his own time intervals and repeat the calculations for different values of u and a. b. Write a C program, which takes two integer operands and one operator from the user, performs the operation and then prints the result. (Consider the operators +, -, *, /, % and use switch statement). c. * Write a C program to print the factors of a given number. Week 4 a. Write C programs that use both recursive and non-recursive functions i. To find the factorial of a given integer. ii. To find the GCD (greatest common divisor) of two given integers. b. * Write C programs that use both recursive and non-recursive functions i. To print Fibonacci Series. ii. To solve Towers of Hanoi problem. c. * Write a C program to print the transpose of a given matrix using function. d. * Write a C program that uses a function to reverse a given string. Week 5 a. Write a C program to find the largest integer in a list of integers. b. Write a C program that uses functions to perform the following: i. Addition of Two Matrices ii. Multiplication of Two Matrices c. * Write a C program to count and display positive, negative, odd and even numbers in an array. d. * Write a C program to merge two sorted arrays into another array in a sorted order. Week 6 a. Write a C program that uses functions to perform the following operations: i. To insert a sub-string in to a given main string from a ii. given position. To delete n Characters from a given position in a given string. b. Write a C program to determine if the given string is a palindrome or not. c. * Write a C program to find a string within a sentence and replace it with another string. d. * Write a C program that reads a line of text and counts all occurrence of a particular word. Week -7 a. Write a C program that displays the position or index in the string S where the string T begins, or 1 if S doesn t contain T. b. Write a C program to count the lines, words and characters in a given text. c. * Write a C program to remove blank spaces from a string. d. * Write a C program to check how many alphabets and non alphabets are there in a string. 3 P a g e
Control Statements Structures Files Week -8 a. Write a C program to generate Pascal s triangle. b. Write a C program to construct a pyramid of numbers. c. * Write a C program to print the factors of a given number. Week -9 a. Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression: 1+x+x 2 +x 3 +...+x n For example: if n is 3 and x is 5, then the program computes 1+5+25+125. Print x, n, the sum. Perform error checking. For example, the formula does not make sense for negative exponents if n is less than 0. Have your program print an error message if n<0, then go back and read in the next pair of numbers of without computing the sum. Are any values of x also illegal? If so, test for them too. b. * Write a C program to find friendly numbers between 1 to n. Week 10 a. 2 s complement of a number is obtained by scanning it from right to left and complementing all the bits after the first appearance of a 1. Thus 2 s complement of 11100 is 00100. Write a C program to find the 2 s complement of a binary number. b. Write a C program to convert a Roman numeral to its decimal equivalent. c. * Write a C program to check whether a given 3 digit number is Armstrong number or not. Week 11 a. Write a C program that uses functions to perform the following operations: i. Reading a complex number ii. Writing a complex number iii. Addition of two complex numbers iv. Multiplication of two complex numbers (Note: represent complex number using a structure.) b. * Write a C program to compute the monthly pay of 100 employees using each employee s name, basic-pay. The DA is computed as 52% of the basic pay. Gross-salary (Basic-pay + DA). Print the employees name and gross salary. c. * Write a program to calculate and print student wise total for 50 students and 3 subjects. The structure should contain 3 subjects and total. Week 12 a. Write a C program which copies one file to another. b. Write a C program to reverse the first n characters in a file. (Note: The file name and n are specified on the command line.) c. * Write a C program to read data from a file named INPUT containing numbers. Write all even numbers to file called EVEN and odd numbers to file called ODD. Week 13 a. Write a C program to display the contents of a file. b. Write a C program to merge two files into a third file (i.e., the contents of the first file followed by those of the second are put in the third file) c. * Write a C program to count the number of characters and number of lines in a file. 4 P a g e
Searching Sorting Linked List Stack Queue Numerical Methods Week 14 a. Write a C program that uses non recursive function to search for a Key value in a given list of integers using linear search. b. Write a C program that uses non recursive function to search for a Key value in a given sorted list of integers using binary search. c. Week 15 a. Write a C program that implements the selection sort method to sort a given array of integers in ascending order. b. Write a C program that implements the bubble sort method to sort a given list of names in ascending order. Week 16 a. Write a C program that uses functions to perform the following operations: ii. Create a singly linked list of integer elements. iii. Traverse the above list and display the elements. b. * IARE College maintains the employee details like empid, name and salary in a single linked list. Print the following details i. Total salary ii. Highest salary iii. Lowest salary paid to the employees Week 17 a. Write a C program that implements stack (its operations) using a singly linked list to display a given list of integers in reverse order. Ex. input: 10 23 4 6 output: 6 4 23 10 b. * Write a program to reverse a string using stack. Week 18 a. Write a C program that implements Queue (its operations) using a singly linked list to display a given list of integers in the same order. Ex. input: 10 23 4 6 output: 10 23 4 6 b. * Read your phone number and store it into a Queue and display your phone number. Week 19 Write a C program to implement the linear regression algorithm. Week 20 Write a C program to implement the polynomial regression algorithm. Week 21 Write a C program to implement the Lagrange interpolation. Week 22 Write C program to implement the Newton-Gregory forward interpolation. Week 23 Write a C program to implement Trapezoidal method. Week 24 Write a C program to implement Simpson method. *Content beyond the university prescribed syllabi VIII. TEXT BOOKS: 1. P. Padmanabham, C programming and Data Structures, 3e, BS Publications. 2. Rajaraman, Computer Programming in C, PHI Publishers. 3. E. Balagurusamy, C Programming, 3e, TMH Publishers. 4. M.V.S.S.N. Prasad, C Programming, ACME Learning Pvt. Ltd. 5. N.B.Venkateswarlu and E.V.Prasad, C and Data Structures, S. Chand Publishers. 5 P a g e
6. K.R. Venugopal and S.R. Prasad, Mastering C, TMH Publishers. Prepared by : Ms. B. Padmaja, Associate Professor Date : 12 th June, 2015 HOD, CSE 6 P a g e