Detailed Syllabus (2023-24) of Programming for Problem Solving (K23ES11)
Detailed Syllabus (2023-24) of Programming for Problem Solving (K23ES11)
B. Tech.
By BOS of Department of Information Technology
Detailed Syllabus (2023-24) of Programming for Problem Solving (K24ES11)
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO 10 PO 11 PO 12 PSO 1 PSO 2
CO1 3 3 - - 2 - - 1 - - - 2 - 2
CO2 3 3 - 2 2 - - 1 - - - 2 - 2
CO3 3 3 - 2 2 - - 1 - - - 2 - 2
CO4 3 3 2 2 2 - - 1 - - - 2 - 2
CO5 3 3 2 2 2 - - 1 - - - 2 - 2
PO
3 3 2 2 2 - - 1 - - - 2 - 2
Target
Prereq
Computer block diagram,Generation of programming languages, Translators,Flowchart
uisite
Introduction:Algorithm, Structure of C program, Writing the first C program, Compilation and
execution process.Tokens: Keywords, Identifier, Variables, Constants, Strings, Character set.
Operators: Arithmetic, Relational, Equality, logical, Unary, Conditional, Bitwise, Comma,
Unit 1
Operator precedence and associativity, type conversion, and type casting. 8 hours
Best Practices in Code writing: Naming Conventions and Importance of Comments to enhance
the readability of the program.
Decision Statements: Conditional Branching statements: if, if-else, if-else-if, switch case.
Unit 2 8 hours
Iterative statements: while, do-while, for loop and Nested loops, Break and continue statements.
Functions & Recursion:Need for function, function declaration /Function prototype, Function
Definition, Function calling. Passing parameter to the Function: Call by value and call by
Unit 3 8 hours
referenceScope: Blockscope, function scope.Storage Classes: Auto, register, Extern,static,
Recursion.
KIET Group of Institutions
Arrays, Strings, Structures & Unions :Fundamental of Array: One dimension Array, Declaration,
Initialization. Operations on Array: Insertion,deletion, traversing.Passing 1D array to functions, 2-D
array and its operations
Pointers:Pointer: Introduction, Pointer declaration, and Pointer Arithmetic, Pointer and Arrays, 8
Unit 4 Pointer to Pointer, Arrays of Pointers.
Applications of pointer: Dynamic memory allocation.
Structure and Functions: Passing individual members, Passing the entire structure.
The C programming Lab will be conducted on Code Tantra platform. The curriculum is structured to gradually
build Students programming skills from basic to advanced levels. The programming problems are categorized
into three levels: Essential, Desirable, and Advanced. Each category is designed to enhance the understanding
and proficiency of students in C programming step by step.
Categories of Problems
Essential:These problems are designed for beginners and cover fundamental concepts of C programming. They
are essential for building a strong foundation and confidence in programming.
Desirable:These problems are for students who have a basic understanding and are ready to tackle more
complex problems. This level focuses on intermediate concepts and problem-solving skills.
Advanced:These problems are for advanced learners who are ready to challenge themselves with complex
algorithms and in-depth programming concepts. This level aims to refine and master your programming
abilities.
Process Flow
c) Write a program to accept the principal, rate, and number of years and find out the simple interest and
compound interest. (L-1)
d) Write a C program to swap values of two variables with the help of a third variable and without using a
third variable. (L-1)
e) Write a C program allows the user to input a floating-point number. The program thenextracts an integral
part of the number and finds its rightmost digit. By utilizing suitable algorithms and logic, the program
accurately identifies the digit at the furthest right position in an integral part of the given number. (L-2)
f) Write a C program to add two numbers together without utilizing the conventional + operator. The program
employs alternative techniques and logical operations to achieve the addition operation. By leveraging
bitwise operations, such as bitwise XOR (^) and bitwise AND (&), along with bit shifting, the program
cleverly performs the addition operation on each bit of the two numbers. (L-2)
g) Write a C program to determine whether a given year is a leap year or not using the conditional operator.
The program takes advantage of the conditional (ternary) operator ?:, which allows for concise conditional
expressions. The leap year check is performed based on the following criteria: a year is a leap year if it is
divisible by 4, but not divisible by 100 unless it is also divisible by 400. (L-3)
h) Write a C program to multiply two given numbers without using the * operator. The program takes
advantage of the concept of repeated addition to perform multiplication. It prompts the user to input two
numbers and utilizes a loop to iteratively add the first number to a running sum until the second number is
reached. (L-3)
i) Write a C program to determine the largest among three given numbers using the conditional operator (?:).
The program prompts the user to input three numbers and utilizes the conditional operator to compare and
determine the largest number among them. (L-3)
2. a. Write a menu-driven program using the Switch case to calculate the following: (L-2)
•Addition of two numbers
•Difference between two numbers
•Product of two numbers
•Division of two numbers
•HCF of two numbers
•LCM of two numbers
b. Write a program to input an integer number and check whether it is prime or not. (L-1)
d. Write a program to find reverse of a number and check whether it is palindrome or not. (L-1)
KIET Group of Institutions
e. Write a program to find the sum of the series given below: (L-2)
f. Write a C program to check whether all the bits of a given number are unset or low. The program
prompts the user to input a number and uses bitwise operators and logical operations to perform the
check. The program utilizes the bitwise AND (&) operator with a bit mask that has all bits set to 0 except
for the bit in the position being checked. By performing the bitwise AND operation between the number
and the bit mask for each bit position, the program determines if the bit is unset or low. (L-3)
g. Write a C program to read a list of integers using a loop and calculate the number of distinct prime
factors for each integer in the list. The program prompts the user to input the number of integers they
want to enter, followed by the actual integers. It then utilizes loops, conditional statements, and a prime
factorization algorithm to determine the distinct prime factors for each integer. (L-3)
h. Write a C program to address the scenario where a company decides to give bonuses to its employees on
the occasion of the new year. The program allows the user to enter the salary and gender of each
employee and calculate the bonus based on the specified criteria. It also displays the final salary that each
employee will receive, taking into account the applicable bonuses
To calculate the bonus, the program uses conditional statements based on the employee's gender and
salary. If the employee is male, a 5% bonus is applied to the salary. If the employee is female, a 10%
bonus is applied. Additionally, if the salary is less than 10000, an extra 2% bonus is given to the
employee. The program applies these bonuses using appropriate calculations and stores the final salary
in a variable. (L-2)
j. The task at hand is to write a C program that displays a specific pattern. The pattern consists of a series of
numbers arranged in a triangular shape. Each row of the pattern follows the ascending and descending
order of numbers. . (L-3)
1
121
12321
1234321
123454321
KIET Group of Institutions
3. a) The task at hand is to design a simple calculator program that will assist a doctor in examining the performance
of a 13-year-old boy with exceptional mental math skills. The program will allow the doctor to input two numbers
and choose an operation (addition, subtraction, multiplication, or division) to be performed on those numbers.
The program will prompt the doctor to enter the two numbers and provide a menu of available operations. Based on
the doctor's selection, the program will perform the chosen operation on the input numbers and display the result.
b) The task at hand is to design a program in C that converts a decimal number to its binary representation using a
function. The program will prompt the user to enter a decimal number, and then it will call the conversion function
to convert the decimal number to binary.The conversion function will take the decimal number as input and perform
the necessary calculations to generate its binary equivalent. It will employ mathematical operations, such as division
and modulus, to extract the binary digits. The function will store the binary digits in an array or a string,
representing the binary number.
The program should handle various scenarios, such as positive decimal numbers, negative decimal numbers, and
zero, while accurately converting them to binary. It should also handle any potential errors or limitations, such as
exceeding the range of data types used for storing the decimal and binary numbers.
c) The task at hand is to design a program in C that counts the occurrence of each digit in a given number using
recursion. The program will prompt the user to enter a number, and then it will call a recursive function to count the
occurrence of each digit in that number.
d) Write a C program that multiplies two matrices using recursion. The program prompts the user to enter the
dimensions and elements of two matrices. It then recursively computes the product of the two matrices and displays
the resulting matrix.To perform matrix multiplication using recursion, the program defines a recursive function.
This function takesthe two matrices, their dimensions, and the current row and column indices as parameters. At
each recursive call, the function multiplies the corresponding row of the first matrix with the corresponding column
of the second matrix and calculates the sum of the products.
e) The task is to write a C program that calculates the sum of a series using a function. The series is defined as
follows:
x - (x^3 / 3!) + (x^5 / 5!) - (x^7 / 7!) + (x^9 / 9!) + ... (up to n terms)
Here, 'x' is a given input value, and 'n' represents the number of terms in the series.
To solve this task, the program will define a function that takes 'x' and 'n' as parameters and returns the sum of the
series. The function will use a loop to iterate through the terms of the series and calculate the value of each term
based on the given formula. The sum of all the terms will be accumulated and returned as the final result.The
program will also prompt the user to enter the values of 'x' and 'n', and then it will call the function to
compute the sum of the series. Finally, the program will display the result to the user.
f) The program is designed to calculate and print a table of binomial coefficients using the provided formula.
Binomial coefficients, denoted as B(m, x), are calculated using the formula B(m, x) = m! / (x! * (m - x)!), where m
is the total number of elements, and x is the number of elements chosen at a time.
The program prompts the user to enter the values of 'm' and 'x'. It then calculates the binomial coefficient for each
combination of 'm' and 'x' that satisfies the condition m > x. The factorial function is used to calculate the factorials
involved in the formula.
The program generates a table displaying the binomial coefficients for the given range of 'm' and 'x'. The table is
printed in a formatted manner, making it easy to read and understand. Each row of the table corresponds to a
specific 'm' value, and the columns represent the corresponding 'x' values.The table provides a comprehensive view
of the binomial coefficients, showing the number of ways to choose 'x' elements from a set of 'm' elements. This
information can be useful in various mathematical and statistical calculations, such as combinatorics, probability,
and algebraic equations.
4. a) The C program is designed to find the median of two sorted arrays. It takes two input arrays, both of which are
assumed to be sorted in ascending order. The program determines the median value by combining the elements
from both arrays and finding the middle value(s) in the merged array. To achieve this, the program follows a divide-
KIET Group of Institutions
and-conquer approach. It calculates the midpoints of the two arrays and compares the corresponding elements at
those positions. Based on the comparison, it discards the elements that are guaranteed to be less than the median.
The process continues recursively until the median is found. If the total number of elements in the combined array is
odd, the median is the middle element. If the total number of elements is even, the median is the average of the two
middle elements.
b) The program aims to find the largest number in an array using recursion. It takes an array of integers as input and
recursively searches for the largest number within the array.
The program uses a recursive function to compare elements of the array. It starts by assuming the first element of
the array is the largest. Then, it recursively compares this assumed largest number with the remaining elements of
the array. If a larger number is found, it becomes the new assumed largest number. This process continues until all
elements of the array have been compared.
c) The program aims to find the nearest lesser and greater elements in an array based on a given target number. The
user is prompted to enter the size of the array and the array elements. Additionally, the user provides a target
number for comparison. The program then determines the nearest lesser and greater elements in the array in relation
to the target number.The algorithm begins by initializing the nearest lesser and greater variables as the minimum
and maximum possible values, respectively. It iterates through each element of the array, comparing it with the
target number. If the element is smaller than the target number and greater than the current nearest lesser value, it
becomes the new nearest lesser. Similarly, if the element is larger than the target number and smaller than the
current nearest greater value, it becomes the new nearest greater.
d) The task is to write a C program that removes duplicate elements from an array. Given an array containing
integers, the program should identify and eliminate any duplicate elements, leaving only the unique elements in the
array. The program should modify the original array in-place and update its size accordingly.
The program will iterate through the array and compare each element with the remaining elements in the array. If a
duplicate element is found, it will be removed by shifting the subsequent elements to the left, effectively
overwriting the duplicate element. The size of the array will be reduced by one for each duplicate element
encountered.
e) The task is to write a C program that sorts a list of names in alphabetical order. Given an array of strings
representing names, the program should rearrange the names such that they are sorted in ascending order based on
the alphabetical order. The program will use a sorting algorithm to compare pairs of names and swap them if they
are out of order. It will continue this process until the entire list is sorted. The sorting algorithm can be implemented
using various techniques such as bubble sort, insertion sort, selection sort, or more efficient algorithms like
quicksort or merge sort.
f) The task is to write a C program that reads a string from the user and uses a function to reverse the order of words
in the string. The program will prompt the user to enter a string and then call a function to reverse the order of the
words in the string. The program will analyze the input string and identify the words based on spaces or any other
specified delimiters. It will then reverse the order of these words while maintaining the order of the characters
within each word. For example, if the input string is "Hello World, how areyou?", the program will reverse the
words to form the output string "you? are how World, Hello".
The program will implement the logic to reverse the words by using string manipulation techniques such as splitting
the string into words, storing them in an array, and then rearranging the words in reverse order. It will handle cases
where there are multiple spaces between words and ensure that the resulting string maintains the original spacing.
After reversing the order of the words, the program will display the modified string to the user. The reversed string
will reflect the reversed order of the words while preserving the characters withineach word
5. a) Write a C program which efficiently store and manage records of N students. The program allows the user to
input the details of each student, including their name, along with other relevant information. Once all the records
are entered, the program implements a sorting algorithm to arrange the student records in ascending order based on
their names.
KIET Group of Institutions
b) The C program is designed to store records of N students and sort them according to their marks. The program
utilizes data structures and sorting algorithms to efficiently organize the student records based on their performance.
It prompts the user to enter the number of students (N) and then dynamically allocates memory to store the required
number of records. For each student, the program prompts the user to enter their name and marks. After storing all
the records, it proceeds to sort them in ascending order based on the marks achieved by each student.
c) The C program uses a pointer to a structure to initialize the members within the structure. It also utilizes functions
to print the student information. The program allows the user to input data for multiple students and stores the
information in the structure using pointer notation. It then calls the appropriate functions to display the student
details on the screen. By utilizing pointers to structures, the program optimizes memory usage and enables efficient
manipulation of the student data.
6. a) This C program utilizes pointers to check whether a given string is a palindrome or not. It prompts the user to
enter a string and then uses pointer manipulation to compare characters from both ends of the string. By iterating
through the string using pointers, the program checks if the characters at corresponding positions are the same or
not. If all the characters match, the program concludes that the string is a palindrome. Conversely, if any pair of
characters does not match, the program determines that the string is not a palindrome.
b) Write a C program allows the user to store n elements in an array and then utilizes a pointer to print the elements.
The program prompts the user to enter the number of elements (n) they wish to store in the array. It dynamically
allocates memory for the array based on the user's input. Next, the program asks the user to input the n elements one
by one. After storing the elements in the array, it uses a pointer to iterate through the array and print each element.
By leveraging pointer arithmetic, the program efficiently accesses the array elements and displays them to the user.
This program provides a dynamic and pointer-based approach to store and print array elements in C.
c) Write a C program to utilize dynamic memory allocation to find the largest element in an array. It prompts the
user to enter the number of elements they wish to store in the array. Using this input, theprogram dynamically
allocates memory for the array.
d) Write a C program allows the user to replace a specific line with another text in a file. The program prompts the
user to enter the name of the file and the line number they want to replace. It then asks theuser to input the new text
that will replace the specified line.
This program defines a function encrypt File that takes the path to an input file, the path to the output file, and an
encryption key as parameters. It reads the input file line by line and encrypts each character using the provided key.
The encrypted characters are then written to the output file.
e) Write a C program to perform basic operations on linked list: Creation, insertion, deletion, and traverse in linked
list.
Total Laboratory Hours : 56 hours