0% found this document useful (0 votes)
74 views25 pages

14 KCS151P 251P Prog For Prob Solving

Here are the answers to the sample quiz questions: 1. B 2. B 3. B 4. C 5. C 6. iv 7. D 8. A

Uploaded by

SARKARI BABU
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views25 pages

14 KCS151P 251P Prog For Prob Solving

Here are the answers to the sample quiz questions: 1. B 2. B 3. B 4. C 5. C 6. iv 7. D 8. A

Uploaded by

SARKARI BABU
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Department of Information Technology

Academic Content File (Lab) # 2021-2022

Subject Name with Code: Programming for Problem Solving


Lab(KCS151/KCS251P)

Name of Faculty: Ms.Bhawna Singh

Designation: Assistant Professor


Vision and Mission of Institute

Vision of Institute
To be a leading educational institution recognized for excellence in engineering education & research producing globally
competent and socially responsible technocrats.

Mission of Institute

IM1: To provide state-of-the-art infrastructural facilities that support achieving academic excellence.
IM2: To provide a work environment that is conducive for professional growth of faculty & staff.
IM3: To collaborate with industry for achieving excellence in research, consultancy and entrepreneurship development.
Program Outcomes (POs)

Program Statement
Outcome
PO1 Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals,
and an engineering specialization to the solution of complex computer engineering problems.

PO2 Problem analysis: Identify, formulate, review research literature, and analyse complex computer
engineering problems reaching substantiated conclusions using first principles of mathematics, natural
sciences, and engineering sciences.
PO3 Design/development of solutions: Design solutions for complex computer engineering problems and
design system components or processes that meet the specific needs with appropriate considerations
for the public health and safety, and the cultural, societal, and environmental considerations.

PO4 Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information
to provide conclusions
PO5 Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modelling to complex engineering activities with an
understanding of the limitations
PO6 The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent relevant to the professional engineering
practices
PO7 Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development
PO8 Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norm of
the engineering practices
PO9 Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings
PO10 Communications: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports
and design documentation, make effective presentations, and give and receive clear instructions

PO11 Project management and finance: Demonstrate knowledge and understanding of the engineering
and management principles and apply these to one’s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
PO12 Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life learning in the broadest context of technological change.
List of Experiments prescribed by Affiliating University
Teaching and Evaluation Scheme
Course Outcomes (CO’s)

Programming for Problem solving Lab (KCS-151P/251P)


CO CO Statements
CO-1 Write program for arithmetic and logical problems

CO-2 Write program using modular concepts, arrays, structures and looping
CO-3 Implement the file handling concepts using C program
Lab Plan|| Programming for Problem solving Lab (KCS-151P/251P)
||2021-22

L.No. Title Of Lab Date Proposed CO Covered


1. Theme-1:General C Programs 1

2. Theme-2:Conditional Branching 1

3. Theme-3:Loop Constructs 2

4. Theme-4:Modular Programming 2

5. Theme-5:Arrays 2

6. Theme-6: Structures 2

7. Theme-7: Application of Pointers 3

8. Revision/Internal Practical/Viva/Quiz
Guidelines regarding lab work

 You should attempt all problems/assignments given in the list session wise.
 You may seek assistance in doing the lab exercises from the concerned lab instructor/Faculty In-charge. Since
the assignments have credits, the lab instructor is obviously not expected to tell you how to solve these, but
you may ask questions concerning the C language or a technical problem.
 For each program you should add comments (i.e. text between /* ... */ delimiters) above each function in the
code, including the main function. This should also include a description of the function written, the purpose
of the function, meaning of the argument used in the function and the meaning of the return value (if any).
 The program should be interactive, general and properly documented with real Input/ Output data.
 If two or more submissions from different students appear to be of the same origin (i.e. are variants of
essentially the same program), none of them will be counted. You are strongly advised not to copy somebody
else's work.
 It is your responsibility to create a separate directory to store all the programs, so that nobody else can read or
copy.
 Lab record is compulsory.
 The list of the programs (list of programs given at the end, session-wise) is available to you in this lab
manual. For each session, you must come prepare with the algorithms and the programs written in the
Observation Book.
 You should utilize the lab hours for executing the programs, testing for various desired outputs and
enhancements of the programs.
 As soon as you have finished a lab exercise, contact one of the lab instructor / in charge in order to get the
exercise evaluated and also get the signature from him/her on the Observation book.
 Completed lab assignments should be submitted in the form of a Lab Record in which you have to write the
algorithm, program code along with comments and output for various inputs given.
 The total no. of lab sessions are 8 and the list of assignments is provided session-wise. It is important to
observe the deadline given for each assignment.
LIST OF EQUIPMENTS / MACHINES ETC. || PROGRAMMING FOR PROBLEM SOLVING
LAB (KCS-151P/251P) || 2021-22

o Borland C/C++ Compiler


o Computer Machine.

List of relevant sources of information

https://www.tutorialspoint.com/cprogramming/

https://www.codechef.com/c-programming

http://www.cprogramming.com/

https://www.codeproject.com

Some open source online compiler to conduct the C lab are as follows:

1. https://www.jdoodle.com/c-online-compiler/
2. https://www.tutorialspoint.com/compile_c_online.php
3. https://www.programiz.com/c-programming/online-compiler/
4. https://www.hackerrank.com/
LAB LAYOUT|| PROGRAMMING FOR PROBLEM SOLVING LAB (KCS-151P/251P) || 2020-21

E-207
Sample Quiz

GALGOTIAS COLLEGE OF ENGINEERING AND TECHNOLOGY


B.Tech: Programming Lab : QUIZ :Session-2021-22
Student Name : Roll No- Branch:
Max. Marks: 10 Time: 15 minutes
Put tick by choosing the correct option
CO1:
1. Who is father of C Language?
A. Bjarne Stroustrup B. Dennis Ritchie
C. James A. Gosling D. Dr. E.F. Codd
2. For 16-bit compiler allowable range for integer constants is ______ ?
A. -3.4e38 to 3.4e38 B. -32767 to 32768
C. -32768 to 32767 D. -32668 to 32667
3. C programs are converted into machine language with the help of
A. An Editor B. A compiler
C. An operating system D. None of the above
4. Which of the following shows the correct hierarchy of arithmetic operations in C
A. / + * - B. * - / +
C. + - / * D. * / + -
5. What is Keywords?
A. Keywords have some predefine meanings and these meanings can be changed.
B. Keywords have some unknown meanings and these meanings cannot be changed.
C. Keywords have some predefine meanings and these meanings cannot be changed.
D. None of the above
CO2:
6. The storage class in c
i) Automatic ii)Static iii)External iv) All the above
7. What is function?
A. Function is a block of statements that perform some specific task.
B. Function is the fundamental modular unit. A function is usually designed to perform a specific task.
C. Function is a block of code that performs a specific task. It has a name and it is reusable D. All the
above
8. In switch statement, each case instance value must be _______?
A. Constant B. Variable
C. Special D. None of the above
Symbol
9. What is the work of break keyword?
A. Halt execution of program B. Restart execution of program
C. Exit from loop or switch statement D. None of the above
CO3:
10.Choose the wrong file mode-
a. Read b.Write
c.Append d.None of these

Date: Signature of Examiner


Viva-questions

CO 1:

1. What is keyword auto for?


2. What is a static variable?
3. Explain the purpose of the function sprintf().
4. What is the purpose of the keyword typedef?
5. Where an automatic variable is stored?
6. What is the difference between variable declaration and variable definition?
7. What is a token?
8. Does a break is required by default case in switch statement?

9. Which key word is used to perform unconditional branching?


10. Explain the use of comma operator (,).
11. What is a variable?
12. Who designed C programming language?
13. C is successor of which programming language?
14. What is the full form of ANSI?
15. Which operator can be used to determine the size of a data type or variable?
16. How does bitwise operator XOR works.

17. What is the default value of local and global variables?


18. What is typecasting?
19. What is the maximum length of an identifier?

20. Can we nest comments in a C code?


21. What is a constant?

CO 2:
1. Explain the syntax for for loop.
2. What is the meaning of base address of the array?
3. What is the difference between actual and formal parameters?
4. Can a program be compiled without main() function?
5. What is a nested structure?
6. Explain modular programming.
7. What are the different ways of passing parameters to the functions? Which to use when?
8. Describe the file opening mode “w+”.

9. Which key word is used to perform unconditional branching?


10. What is a static function?
11. Which built-in library function can be used to re-size the allocated dynamic memory?
12. Define an array.
13. What are enumerations?
14. What is an infinite loop?
15. Define a structure.
16. What is recursion?
17. Can the structure variable be initialized as soon as it is declared?

CO 3:

1. What is a pointer on pointer?


2. Distinguish between malloc() & calloc() memory allocation.

3. What is a dangling pointer?


4. What is lvalue and rvalue?
5. What is the advantage of declaring void pointers?
6. What are command line arguments?
7. What are the different ways of passing parameters to the functions? Which to use when?
8. Describe the file opening mode “w+”.
9. Is FILE a built-in data type?
10. Which built-in library function can be used to re-size the allocated dynamic memory?
11. Which built-in function can be used to move the file pointer internally?
12. Can a pointer access the array?
13. Name a function which can be used to close the file stream.
14. What is the purpose of #undef preprocessor?
Lab Plan|| Programming for Problem solving Lab (KCS-151P/251P)|| 2021-22

L.No. Title Of Lab Date Proposed CO Covered


1. Theme-1:General C Programs 1

2. Theme-2:Conditional Branching 1

3. Theme-3:Loop Constructs 2

4. Theme-4:Modular Programming 2

5. Theme-5:Arrays 2

6. Theme-6: Structures 2

7. Theme-7: Application of Pointers 3

8. Revision/Internal Practical/Viva/Quiz
CO1: Write program for arithmetic and logical problems
Experiment No. 1
Theme General Programs
Students are required to 1. Objective
implement/execute/draw/make document 2. Logic
3. Algorithm
4. Program Code
5. Output Window

List of Programs to be implemented 1. Write a program to calculate the area of triangle using formula
at=√s(sa)(s-b) (s-c)
2. Basic salary of an employee is input through the keyboard. The DA is
25%of the basic salary while the HRA is 15% of the basic salary.
ProvidentFund is deducted at the rate of 10% of the gross salary
(BS+DA+HRA). Program to calculate the Net Salary.

Experiment No. 2
Theme Conditional Branching
Students are required to 1. Objective
implement/execute/draw/make document 2. Logic
3. Algorithm
4. Program Code
5. Output Window

List of Programs to be implemented 1. Write a program to determine the roots of quadratic equation.
2. Write a program to find the largest of three numbers using nested
if else.
3.Write a program to receive marks of physics, chemistry & maths
from user& check its eligibility for course if
a) Marks of physics > 40
b) Marks of chemistry > 50
c) Marks of math’s > 60
d) Total of physics & math’s marks > 150
e) Total of three subjects marks > 200.
4. Write a program to find the value of y for a particular value of n.
The a, x, b, n is input by user
if n=1 y=ax%b
if n=2 y=ax2+b2
if n=3 y=a-bx
if n=4 y=a+x/b
CO2: Write program using modular concepts, arrays, structures and looping
Experiment No. 3
Theme Loop Construct
Students are required to 1. Objective
implement/execute/draw/make document 2. Logic
3. Algorithm
4. Program Code
5. Output Window

List of Programs to be implemented 1. Write a program to construct a Fibonacci series upto n terms.
2. Write a program to find whether the number is Armstrong number.
3. Write a program to generate sum of series 1!+2!+3!+--------------n!
4. Write a program to find the sum of following series 1-X1/1!+X2/2!-
…………Xn/n!.
5. Write a program to print the entire prime no between 1 and 300.
6.Write a program to print out all the Armstrong number between 100 and
500.
7. Write a program to draw the following figure:
321
21
1

*
**
***
8.Write a program to receive a five-digit no and display as like 24689:

2
4
6
8
9

Note: For Source code see the Appendix: 1

Experiment No. 4
Theme Modular Programming
Students are required to 1. Objective
implement/execute/draw/make document 2. Logic
3. Algorithm
4. Program Code
5. Output Window
1. Write a function that return sum of all the odd digits of a given
positive no. entered through keyboard.
2. Write a program to print area of rectangle using function & return
its value to main function.
3. Write a program to calculate the factorial for given number using
function.
List of Programs to be implemented 4. Write a program to find sum of Fibonacci series using function.
5. Write factorial function & use the function to find the sum of
series S=1!+2!+-----n!.
6. Write a program to find the factorial of given number using
recursion.
7. Write a program to find the sum of digits of a 5 digit number
using recursion.
8. Write a program to calculate the GCD of given numbers using
recursion.
9. Write a program to convert decimal number in to binary number.
10. Write a program to convert binary number in to decimal number.

Experiment No. 5
Theme Arrays
Students are required to 1. Objective
implement/execute/draw/make document 2. Logic
3. Algorithm
4. Program Code
5. Output Window

List of Programs to be implemented 1. Write a program to delete duplicate element in a list of 10


elements &display it on screen.
2. Write a program to merge two sorted array & no element is
repeated during merging.
3. Write a program to evaluate the addition of diagonal elements
of two square matrixes.
4. Write a program to find the transpose of a given matrix &
check whether itis symmetric or not.
5. Write a program to print the multiplication of two N*N
(Square) matrix.
6. Write a program in C to check whether the given string is a
palindrome ornot.
7. Write program to sort the array of character (String) in
alphabetical orderlike STRING in GINRST.
8. Write a program to remove all the blank space from the string
& print it, also count the no of characters.
9. Write a program to store the following string “zero”, “one” -----
--“five”. Print the no in words, given in figure as 3205

Experiment No. 6
Theme Structures
Students are required to 1. Objective
implement/execute/draw/make document 2. Logic
3. Algorithm
4. Program Code
5. Output Window

List of Programs to be implemented .


1. Write a program to compare two given dates. To store a date
uses astructure that contains three members namely day, month
and year. If the dates are equal, then display message equal
otherwise unequal.
2. Define a structure that can describe a hotel. It should have the
member that includes the name, address, grade, room charge and
number of rooms.
3. Write a function to print out hotel of given grade in order of
room charges.
4. Define a structure called cricket with player name, team name,
batting average, for 50 players & 5 teams. Print team wise list
contains names of player with their batting average.
CO3: Implement the file handling concepts using C program

Experiment No. 7
Theme Application of Pointers
Students are required to 1. Objective
implement/execute/draw/make document 2. Logic
3. Algorithm
4. Program Code
5. Output Window

1. Write a c program to copy & count the character content of


one file says a.txt to another file b.txt.
2. Write a program to take 10 integers from file and write
square of these integer in other file.
3. Write a program to read number from file and then write
all ‘odd’ number to file ODD.txt & all even to file EVEN.txt.
List of Programs to be implemented 4. Write a program to print all the prime number, between 1
to 100 in file prime.txt.
5. Write the following C program using pointer:
a) To sort the list of numbers through pointer
b) To reverse the string through pointer.
6. Write a program to find the largest no among 20 integers
array usingdynamic memory allocation.
7. Using Dynamic Memory Allocation, Write a program to
find the transposeof given matrix.
8. Write a program to find the factorial of given number using
command lineargument.
9. Write a program to find the sum of digits of a 5 digit
number usingcommand line argument.
PPS LAB-Video Content||2021-22

L.No. Title Of Lab Video Link Type


1. Theme-1:General C Programs https://web.microsoftstream.com/vide Lab Theme
o/4eabfb68-d1bb-4235-b60c- Demonstration
47a76f42efe5
2. Theme-2:Conditional Branching https://web.microsoftstream.com/vide Lab Theme
o/195753b0-4b59-48de-ac66- Demonstration
5a5f99f1ce1b
3. Theme-3:Loop Constructs https://web.microsoftstream.com/video/1 Lab Theme
37eddbe-c152-4af8-9545-072f035fb767 Demonstration

4. Theme-4:Modular Programming https://web.microsoftstream.com/vide Lab Theme


o/c05f4e4e-e519-4a34-b93f- Demonstration
6f8cc5c6d38d
5. Theme-5:Arrays https://web.microsoftstream.com/vide Lab Theme
o/42284a7b-b99c-492e-abd6- Demonstration
be57d92c9a7b
6. Theme-6: Structures https://web.microsoftstream.com/vide Lab Theme
o/e3ab4e89-7634-4adc-9694- Demonstration
e8d88d8d24e1
7. Theme-7: Application of Pointers https://web.microsoftstream.com/ Lab Theme
video/c5253b32-250d-46ad-ae80- Demonstration
e5663ac1ce44

You might also like