Problem Solving Techniques
Programme Bachelor of Computer Applications Programme
Code
Course Skill Enhancement Course Type Theory
Category
Course Code 25SEC11T CA 30 Year/Sem 2/3
Course Title Problem Solving SEE 70 Lectures 3 Per
Techniques Week
Credits 3 Max. 100 Exam. 3Hrs
Marks Duration
Course Objectives
Understand basic terminology of computers, problem solving, programming
Languages and their evolution (Understand)
Create specification from problem requirements by asking questions to disambiguate
the requirement statement. (Create)
Design the solution from specification of a problem and write pseudo code of the
algorithm using basic building blocks or structured programming constructs
(Sequence, Selection and Repetition statement). (Create)
Translate an algorithm into a C computer program (Create)
Testing and analysing programs using debugging tools. (Analyze)
Prerequisite: This is an introductory programming course and hence no prerequisites
Course Outcomes:
CO Course Outcome Statement Bloom’s Mapped
Code Level Units
CO-1 Understand the nature and classification of Understand Unit I
computational problems, and describe the
foundational steps in algorithm development and
problem solving.
CO-2 Apply structured programming concepts using Apply Unit I, II,
control structures and data representation formats III, IV
for solving basic computational problems in C
language.
CO-3 Develop and test C programs using selection, Apply / Unit II,
repetition, modular constructs, and functions for Analyze III, IV
problem solving and pattern generation.
CO-4 Analyze and implement algorithms to solve Analyze / Unit II,
numeric, statistical, and pattern-based problems Apply III, IV
using iterative and recursive approaches.
CO-5 Demonstrate the use of arrays, strings, functions, Apply / Unit IV
and matrix operations in designing modular, Create
efficient, and maintainable programs in C.
Course Contents:
UNIT I: (CO-1, CO-2) Problems And Problem Instances, Generalization and Special Cases,
Types of Computational Problems, Classification of Problems, Analysis of Problems,
Solution Approaches, Algorithm Development, Analysis of Algorithm, Efficiency,
Correctness, Role of Data Structures in Problem Solving, Problem-Solving Steps (Understand
the Problem, Plan, Execute, And Review), Breaking the Problem into Subproblems,
Input/Output Specification, Input Validation, Pre and Post Conditions.
UNIT II: (CO-2, CO-3, CO-4) Structured Programming Concepts: Sequence
(Input/Output/Assignment), Selection (If, If-Else) And Repetition (For, While, Do-While)
Statements, Control Structure Stacking and Nesting. Different Kinds of Repetitions: Entry
Controlled, Exit Controlled, Counter Controlled, Definite, Indefinite and Sentinel-Controlled
Repetitions. Pseudocode and Flowcharts. Definition And Characteristics of Algorithms,
Standard Algorithm Format. Problems Involving Iteration and Nesting: Displaying Different
Patterns and Shapes Using Symbols and Numbers, Generating Arithmetic and Geometric
Progression, Fibonacci and Other Sequences, Approximate Values For π, Sin(x), Cos(x), Etc.
Using Taylor Series. Different Kinds of Data in The Real World and How They are
Represented in The Computer Memory. Representation of Integers: Signed Magnitude Form,
1’s Complement And 2’s Complement. Representation of Real Numbers: IEEE 754 Floating
Point Representation. Representation of Characters: ASCII, UNICODE. C Language:
Introduction To Programming Languages, Different Generations of Programming Languages.
Typed Vs Typeless Programming Languages, History of C Language, An Empty C Program.
C Language Counterparts For Input (scanf()), Output (printf()) Statements, Assignment,
Arithmetic, Relational and Logical Operators. If, If-Else Statements, For, While, Do-While
Statements. Data Types. Translating Pseudocode/Algorithm to C Program. Incremental
Compilation and Testing of The C Program. Simple Problems Involving Input, Output,
Assignment Statement, Selection and Repetition. Good Coding Practices.
UNIT III: (CO-2, CO-3, CO-4) Problems on Numbers: Extracting Digits of a Number (Left
to Right and Right to Left), Palindrome, Prime Number, Prime Factors, Amicable Number,
Perfect Number, Armstrong Number, Factorial, Converting Number from One Base to
Another. Statistics (Maximum, Minimum, Sum and Average) on a Sequence of Numbers
which are Read using SentinelControlled Repetition using only a few Variables. C Language:
else-if Ladder, switch Case, Increment/Decrement Operators, break and continue Statements.
UNIT IV: (CO-2, CO-3, CO-4, CO-5) Modular Programming, Top-Down and Bottom-Up
Approaches to Problem Solving. Recursion. Problems on Arrays: Reading and Writing of
Array Elements, Maximum, Minimum, Sum, Average, Median and Mode. Sequential And
Binary Search. Any one Sorting Algorithm. Matrix Operations. C Language: Function
Definition and Declaration (Prototype), Role of Return Statement, One Dimensional and
Two-Dimensional Arrays. String Functions. Other Operators, Operator Precedence and
Associativity. Debugging.
Text Books
1. Venkatesh, Nagaraju Y, Practical C Programming for Problem Solving, Khanna Book
Publishing Company, 2024.
2. AICTE’s Programming for Problem Solving (with Lab Manual), Khanna Book
Publishing Company, 2024.
3. Harvey Deitel and Paul Deitel, C How to Program, 9th edition, Pearson India, 2015.
4. R G Dromey, How to Solve It by Computer.
Reference Books
1. Brian W. Kernighan and Dennis Ritchie, The C Programming Language, 2nd edition,
Pearson, 2015.
2. Jeri Hanly and Elliot Koffman, Problem Solving and Program Design in C, 8th
edition, Pearson, 2015.
Problem Solving Techniques: Lab Problems
Programme Bachelor of Computer Applications Programme
Code
Course Skill Enhancement Course Type Practical
Category
Course Code 25SEC11T CA 30 Year/Sem 2/3
Course Name Problem Solving SEE 70 Lectures 3 Per
Techniques Lab Week
Credits 3 Max. 100 Exam. 3Hrs
Marks Duration
UNIT-II
1. Converting degrees Celsius to Fahrenheit and vice versa?
2. Display three input numbers in sorted (non-decreasing) order?
3. Given a positive integer value n (>= 0) display number, square and cube of numbers from 1
to n in a tabular format?
4. Given an input positive integer number, display odd numbers from in the range [1,n]?
5. Display first mathematical tables, each table up to 10 rows? Generalise this to display first
n (> 0) mathematical tables up to m (m > 0) rows?
6. Display following patterns of n rows (n > 0), For the below examples n = 5? For each
pattern write a separate algorithm/program?
Display the following patterns of n rows (n > 0), for the below examples n = 5?
8. Given the first term (a), difference/multiplier (d) and number of terms (n > 0), display the
first n terms of the arithmetic/geometric progression?
9. Display the first n (n > 0) terms of the fibonacci sequence?
10. Display the first n (n > 0) terms of the Tribonacci sequence?
11. Given two positive integer numbers n1 and n2 check if the numbers are consecutive
numbers of the fibonacci sequence?
12. Compute approximate value of π considering first n (n > 0) terms of the Taylor series for
π?
13. Compute approximate value of ex considering first n (n > 0) terms of the Taylor series for
ex?
UNIT-III
1. Extract digits of an integer number (left to right and right to left)?
2. Given a sequence of digits form the number composed of the digits. Use sentinel-
controlled repetition to read the digits followed by -1. For example, for the input 2 7 3
2 9 -1 the output number is 27329?
3. Check if a given positive integer number is a palindrome or not?
4. Compute character grade from the marks (0 ≤ marks ≤ 100) of a subject. Grading Scheme:
80-100: A, 60 - 79: B, 50 - 59: C, 40-49: D, 0-39: F? Solve this using both else-if ladder and
switch case?
5. Compute the sum of a sequence of numbers entered using sentinel-controlled repetition?
6. Check if a given positive integer number is a prime number or not?
7. Compute prime factors of a positive integer number?
8. Check if two positive integer numbers are amicable numbers or not?
9. Check if a given positive integer number is a perfect number or not?
10. Check if a given positive integer number Armstrong number or not?
11. Converting a positive integer number (n > 0) from one base (inputBase) to another base
(outputBase) (2 <= input Base, outputBase <= 10). Input number should be validated before
converting to make sure the number uses only digits allowed in the input base?
12. Write a program to display a number in text form. For example, If the number is 5432 the
output should be “FIVE FOUR THREE TWO”?
13. Using the grading scheme described in the question 4 (UNIT III), Compute how many
students awarded each grade and display the frequency as a bar chart (horizontal) using single
“*” for each student. Use sentinel-controlled repetition (-1 as sentinel value) in reading the
students marks. Use else-if ladder/switch case to compute the grade and the corresponding
frequency.
Sample bar chart when the class has 7-A, 10-B, 3-C, 7-D and 1-F grades.
A:
*******
B:
**********
C: ***
D:
*******
F: *
14. Compute maximum, minimum, sum and average of a sequence of numbers which are
read using sentinel-controlled repetition using only few variables?
15. Compute body mass index, BMI = weightinKGs / (HeightinMeters *HeightinMeters),
Both weight and height values are positive real numbers. Your program should display BMI
value followed by whether the person is Underweight, Normal, Overweight or Obese using
the below ranges:
BMI Values
Underweight: less than 18.5
Normal: >=18.5 and <25
Overweight: >=25 and < 30
Obese: >= 30
UNIT IV
1. Design a modularized algorithm/program to check if a given positive integer number is a
circular prime or not?
2. Design a modularized algorithm/program to compute a maximum of 8 numbers?3. Design
a modular algorithm/program which reads an array of n integer elements and outputs mean
(average), range (max-min) and mode (most frequent elements)?
4. Design a modular algorithm/program which reads an array of n integer elements and
outputs median?
5. Implement your own string length and string reversal functions?
6. Design algorithm/program to perform matrix operations addition, subtraction and
transpose?
7. Write a recursive program to count the number of digits of a positive integer number?
8. Recursive solutions for the following problems:
a. Factorial of a number?
b. Display digits of a number from left to right (and right to left)?
c. Compute xy using only multiplication?
d. To print a sequence of numbers entered using sentinel-controlled repetition in
reverse order?