Gujarat Technological University: 1. Learning Objectives
Gujarat Technological University: 1. Learning Objectives
With effective
Syllabus for Master of Computer Applications, 1st Semester from academic
Subject Name: Problem Solving using C year 2020-21
Subject Code: 619401
1. Learning Objectives:
The student will be able to develop solution of problem using his/her own logic and
gradually learn to solve various problems using efficient algorithm and
Programming techniques.
3. Mode of Delivery:
In tutorial sessions, discuss the basics and the methodology for tasks to be completed
during next lab session(s). In the Lab sessions – Ask students to write, compile and
test the programs on computer. Check for common difficulties faced by students.
Conduct a brief session to explain and then resume the hands-on working. If a few
students are not able to complete all the assigned task(s) during lab sessions, help
them and motivate them to complete pending tasks at home.
4. Course Contents:
Explain for-loop. Also explain the general algorithm for summation: (i)
Initialize sum = 0; (ii) repeat sum = sum + value
* Write a program to find the sum of 1, 2, 3, … , n. Print average (avg)
also.
2. Explain string variable, its declaration and scanf() to accept strings 2+4
Page no. 1 of 7
GUJARAT TECHNOLOGICAL UNIVERSITY
With effective
Syllabus for Master of Computer Applications, 1st Semester from academic
Subject Name: Problem Solving using C year 2020-21
Subject Code: 619401
6. * Write a program to calculate and display the value of the slope of the 1 + 2
line connecting the two points whose coordinates are (3, 7) and (8, 12).
Slope of a line between two points (x1 , y1 ) and (x2 , y2 ) is (y2 – y1 ) / (x2
– xl ). Run the same program for the line connecting the points (2, 10)
and (12, 6), and other pairs of points.
Page no. 2 of 7
GUJARAT TECHNOLOGICAL UNIVERSITY
With effective
Syllabus for Master of Computer Applications, 1st Semester from academic
Subject Name: Problem Solving using C year 2020-21
Subject Code: 619401
* Write a program that calculates the distance between two points whose
coordinates are (7, 12) and (3, 9). Distance between two points having
coordinates (xl , y1 ) and (x2 , y2 ) = sqrt([xl – x2 ]2 + [yl – y2 ]2 ).
Also, run the program for the points (-12, -15) and (22, 5) and a few
other points.
8. Explain: (a) sin(x) defined by the infinite series expansion. What will be 2 + 4
the stopping criterion?
* Write a program to evaluate sin(x)
* Write a program to determine and display the maximum height reached
when the ball is thrown at 5 miles / hour at an angle of 60 degrees. (Hint:
Make sure to convert the initial velocity into the correct units.) The
maximum height reached by a ball thrown with an initial velocity v in
feet/sec at an angle of θ is given by the formula height = (0.5 * v2 * sin2 θ
) / 32.2. Run the program for v = 7 miles / hour and angle = 45 degrees.
Page no. 3 of 7
GUJARAT TECHNOLOGICAL UNIVERSITY
With effective
Syllabus for Master of Computer Applications, 1st Semester from academic
Subject Name: Problem Solving using C year 2020-21
Subject Code: 619401
10. * Write a program in C (a) to find factorial of n (n!), and (b) first n terms 2 + 4
of the Fibonacci sequence using an iterative algorithm.
12. * Remove all duplicates from an ordered array and contract the array 1 + 2
accordingly.
Total Hours 24 + 48
5. Text Book:
1. Brian W. Kernigham, Dennis Ritchie, “The C Programming Language”, Pearson
(2015)
2. R. G. Dromey, “How to Solve it by Computer”, Pearson (2013)
Page no. 4 of 7
GUJARAT TECHNOLOGICAL UNIVERSITY
With effective
Syllabus for Master of Computer Applications, 1st Semester from academic
Subject Name: Problem Solving using C year 2020-21
Subject Code: 619401
6. Reference Books:
• Yeshvant Kanetkar, “Let Us C”, BPB Publication (2017)
Webliography
• https://www.w3resource.com/c-programming-exercises/
• https://www.codechef.com/
• https://www.learn-c.org/
• https://www.prep.youth4work.com/practice-tests/c-programming-test
• https://www.indiabix.com/online-test/c-programming-test/
• https://www.hackerrank.com/c-programming-test-1/
• https://www.mycplus.com/featured-articles/programming-contests-and-
challenges/
• https://www.hackerearth.com/challenges/
• https://www.geeksforgeeks.org/category/competitive-programming/
• https://www.techgig.com/challenge
• https://www.freecodecamp.org/news/the-10-most-popular-coding-challenge-
websites-of-2016-fb8a5672d22f/
7. Course Outcome:
After studying this course, students will be able to write programs using iterative and
recursive algorithms for various basic tasks such as to carry out the following tasks:
Sum and average of a given sequence of numbers using an array (a Pointer) or a
List
Sum of infinite series, such as for trigonometric functions, etc
Using numerical methods to find Square root of a number
Prime numbers, prime divisors of n
GCD of given integers
Find n! and first n Fibonacci numbers using iterative and recursive algorithms
Find maximum and minimum in a given sequence on n numbers.
Remove duplicate values in an array.
Using Pointers, exchange 2 values
Improved algorithm for x^n
9. Additional Exercises:
1. Given two variables of integer type a and b, exchange their values without using
a third temporary variable.
2. Write a program to print out n values of the following sequence: 1 – 1 1 – 1 1
–1 …
3. Write a program to compute the sum of the first n terms (n >= 1) of the following
series: s = 1 – 3 + 5 – 7 + 9 – 11 + …
4. For a given x and n, design an algorithm to compute xn / n! .
Page no. 5 of 7
GUJARAT TECHNOLOGICAL UNIVERSITY
With effective
Syllabus for Master of Computer Applications, 1st Semester from academic
Subject Name: Problem Solving using C year 2020-21
Subject Code: 619401
3. N= 4 4. n= 4
A 0
A B A 1 0 1
A B C B A 2 1 0 1 2
A B C D C B A 3 2 1 0 1 2 3
Page no. 6 of 7
GUJARAT TECHNOLOGICAL UNIVERSITY
With effective
Syllabus for Master of Computer Applications, 1st Semester from academic
Subject Name: Problem Solving using C year 2020-21
Subject Code: 619401
5. N= 4 6. N= 4
* 1
* * * 1 2 1
* * * * * 1 2 3 2 1
* * * * * * * 1 2 3 4 3 2 1
* * * * * 1 2 3 2 1
* * * 1 2 1
* 1
7. 8. N= 5
N= 5 * *
+ * * * *
- - * * * * * *
* * * * * * * * * * *
+ + + + * * * * * * * * *
- - - - -
9. n= 4
*
* *
* * *
* * * *
* * *
* *
*
Page no. 7 of 7