AYg2020-21 J.gB.gInstitutegofgEngineeringgandgTechnology B.Techg CSE
onwards (UGCgAutonomous) IgYearg–gIIgSem
Course
Code: PROGRAMMINGgFORgPROBLEMgSOL L T P D
gJ125
VING
A (CommongtogECE,gCSE,gITg&gECM)
Credits:g3 3 0 0 0
Pre-Requisites:
1. MathematicalgKnowledge.
2. AnalyticalgSkills.
Coursegobjectives:
ThegStudentgwill:
1. Learngthegfundamentalsgofgcomputers.
2. Understandgthegvariousgstepsgingprogramgdevelopment.
3. UnderstandgthegsyntaxgandgsemanticsgofgCgprogrammingglanguage.
4. Learngthegusagegofgstructuredgprogramminggapproachgingsolvinggproblems.
5. Gaingthegknowledgegongsearchinggandgsortinggmethods.
Moduleg1:
INTRODUCTIONgTOgPROGRAMMING:
Introductiongtogcomponentsgofgagcomputergsystem:gdisks,gprimarygandgsecondarygme
mory,gprocessor,goperatinggsystem,gcompilers,gcreating,gcompilinggandgexecutinggagprogr
amgetc.,gNumbergsystems.
IntroductiongtogAlgorithms:gstepsgtogsolveglogicalgandgnumericalgproblems.gRepresenta
tiongofgAlgorithm,gFlowchart/Pseudogcodegwithgexamples,gProgramgdesigngandgstructure
dgprogramming.
IntroductiongtogCgProgramminggLanguage:gvariablesg(withgdatagtypesgandgspacegrequi
rements),gSyntaxgandgLogicalgErrorsgingcompilation,gobjectgandgexecutablegcode,gOperat
ors,gexpressionsgandgprecedence,gExpressiongevaluation,gStoragegclassesg(auto,gextern,gst
aticgandgregister),gtypegconversion,gThegmaingmethodgandgcommandglinegarguments
Bitwisegoperations:gBitwisegAND,gOR,gXORgandgNOTgoperatorsgConditionalgBranchin
ggandgLoops:gWritinggandgevaluationgofgconditionalsgandgconsequentgbranchinggwithgif,gi
f-gelse,gswitch-case,gternarygoperator,ggoto,gIterationgwithgfor,gwhile,gdo-
gwhilegloops.I/O:gSimpleginputgandgoutputgwithgscanfgandgprintf,gformattedgI/O,gIntroduct
iongtogstdin,gstdoutgandgstderr.
28
,Moduleg2:
ARRAYS,gSTRINGS,gSTRUCTURESgANDgPREPROCESSOR:
Arrays:gonegandgtwogdimensionalgarrays,gcreating,gaccessinggandgmanipulatinggelementsg
ofgarrays.
Strings:gIntroductiongtogstrings,ghandlinggstringsgasgarraygofgcharacters,gbasicgstringg
functionsgavailablegingCg(strlen,gstrcat,gstrcpy,gstrstrgetc.),garraysgofgstringsgStructur
es:gDefininggstructures,ginitializinggstructures,gunions,gArraygofgstructures.gPreproce
ssor:gCommonlygusedgPreprocessorgcommandsglikeginclude,gdefine,gundef,gIf,gifdef,g
ifndef.
Moduleg3:
POINTERSgANDgFILEgHANDLINGgINgC:
Pointers:gIdeagofgpointers,gdefininggpointers,gPointersgtogArraysgandgStructures,gUsegofgP
ointersgingself-referentialgstructures,gusagegofgself-
referentialgstructuresginglinkedglistg(nogimplementation)gEnumerationgdatagtype.
Files:gTextgandgBinarygfiles,gCreatinggandgReadinggandgwritinggtextgandgbinarygfiles,gapp
endinggdatagtogexistinggfiles,gWritinggandgreadinggstructuresgusinggbinarygfiles,gRandomg
accessgusinggfseek,gftellgandgrewindgfunctions.
Moduleg4:
FUNCTIONgANDgDYNAMICgMEMORYgALLOCATION:
Functions:gDesigninggstructuredgprograms,gdeclaringgagfunction,gSignaturegofgagfunction
,gParametersgandgreturngtypegofgagfunction,gpassinggparametersgtogfunctions,gcallgbygvalue
,gpassinggarraysgtogfunctions,gpassinggpointersgtogfunctions,gideagofgcallgbygreference,gSo
megCgstandardgfunctionsgandglibraries.
Recursion:gSimplegprograms,gsuchgasgFindinggFactorial,gFibonaccigseriesgetc.,g Limitatio
nsgofgRecursivegfunctions.
Dynamicgmemorygallocation:gAllocatinggandgfreeinggmemory,gAllocatinggmemorygforg
arraysgofgdifferentgdatagtypes.
Moduleg5:
INTRODUCTIONgTOgALGORITHMS:
Basicgsearchinggalgorithmsg(lineargandgbinarygsearchgtechniques),Basicgsortinggalgorithm
sg(Bubble,gInsertion,gQuick,gMergegandgSelectiongsortgalgorithms)gBasicgconceptgofgorder
gofgcomplexitygthroughgthegexamplegprograms
TextgBooks:
1. ReamgThareja,gProgramminggingC,gOxfordguniversitygpress.
2. B.A.g Forouzang andg R.F.g Gilberg,g Cg Programmingg andg Datag Structures,g Cengageg
Learning,g(3rdEdition).
29
, ReferencegBooks:
1. BriangW.gKernighangandgDennisgM.gRitchie,gThegCgProgramminggLanguage
,gPrenticegHallgofgIndia.
2. R.G.gDromey,gHowgtogsolvegitgbygComputer,gPearsong(16thImpression)
3. StephengG.gKochan,gProgramminggingC,gFourthgEdition,gPearsonEducation.
4. HerbertgSchildt,gC:gThegCompletegReference,gMcGrawgHill,g4thEdition
5. ByrongGottfried,gSchaum’sgOutlinegofgProgramminggwithgC,McGraw-Hill
Eg-gResources:
1. https://fresh2refresh.com/c-programming/
2. https://www.studytonight.com/c/
3. https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/
4. https://www.programiz.com/c-programming
5. http://www.gtucampus.com/uploads/studymaterials/Degree%20EngineeringSandipFug
ndaments_of_C.pdf
6. http://cs.indstate.edu/~cbasavaraj/cs559/the_c_programming_language_2.pdf
Coursegoutcomes:
Thegstudentgwillgbegablegto:
1. Designgthegalgorithms/flowchartsgofgC-programs.
2. WritegthegCodegandgtestgaggivenglogicgingCgprogrammingglanguage.
3. Decomposegagproblemgintogfunctionsgandgtogdevelopgmodulargreusablegcode.
4. MakegUsegofgarrays,gpointers,gstringsgandgstructuresgtogwritegCgPrograms.
5. Applygsearchinggandgsortinggalgorithms.
CO-
PO/PSOgMappinggChartg(3/2/1gindicat
esgstrengthgofgcorrelation)
3g–gStrong;g2g–gMedium;g1g-gWeak
Program
CoursegO ProgramgOutcomesg(POs) Specificg
utcomesg( Outcomes
COs) PO PO PO PO PO PO PO PO PO PO PO PO PSO PSO
1 2 3 4 5 6 7 8 9 10 11 12 1 2
CO1 3 2 - - - - - - - - - 1 2 2
CO2 2 2 3 2 2 - - - - - - - 2 -
CO3 3 2 2 - - - - - - - - 1 - 3
CO4 3 2 2 2 - - - - - - - 1 - 3
CO5 3 2 2 - - - - - - - - 1 2 3
Average 2.8 2.0 2.3 2.0 2.0 - - - - - - 1.0 2.0 2.8
30
, Moduleg1
Pre-Requestsgaregfollowings.
1. Enthusiasm
2. LogicgBuildinggSkills
3. Mathematics(Basicsglikegprimegnumber,gfactorial)
Introductiongtogcomputers:
Definitiongofgterms
Computerg:gisgangelectronicgdevicegthatgoperatesg(works)gundergthegcontrolgofgprogramsgstoredgingits
gowngmemorygunit.
Agcomputergisgangelectronicgmachinegthatgprocessesgrawgdatagtoggiveginformationgasgoutput.
Angelectronicgdevicegthatgacceptsgdatagasginput,gandgtransformsgitgundergtheginfluencegofgagsetgofgspe
cialginstructionsgcalledgPrograms,gtogproducegthegdesiredgoutputg(referredgtogasgInformation).
Explanations;
Agcomputergisgdescribedgasgangelectronicgdevicegbecause;gitgisgmadegupgofgelectronicgcomponentsgan
dgusesgelectricgenergyg(suchgasgelectricity)gtogoperate.
Agcomputerghasganginternalgmemory,gwhichgstoresgdatag&ginstructionsgtemporarilygawaitinggprocess
ing,gandgevengholdsgthegintermediategresultg(information)gbeforegitgisgcommunicatedgtogthegrecipients
gthroughgthegOutputgdevices.
Itgworksgongthegdatagusinggtheginstructionsgissued,gmeansgthat,gthegcomputergcannotgdoganygusefulgjo
bgongitsgown.gItgcangonlygworkgasgpergthegsetgofginstructionsgissued.
Agcomputergwillgacceptgdatagingonegformgandgproducegitginganothergform.gThegdatagisgnormallygheldg
withingthegcomputergasgitgisgbeinggprocessed.
Program:
AgcomputergProgramgisgagsetgofgrelatedginstructionsgwrittengingtheglanguagegofgthegcomputerg&gisguse
dgtogmakegthegcomputergperformgagspecificgtaskg(or,gtogdirectgthegcomputergongwhatgtogdo).
Agsetgofgrelatedginstructionsgwhichgspecifyghowgthegdatagisgtogbegprocessed.
gAgsetgofginstructionsgusedgtogguidegagcomputergthroughgagprocess.
Data:gIsgagcollectiongofgrawgfacts,gfiguresgorginstructionsgthatgdognotghavegmuchgmeaninggtogtheguser.
Datagmaygbegingformgofgnumbers,galphabets/lettersgorgsymbols,gandgcangbegprocessedgtogproduceginforma
tion.
TYPESgOFgDATA.
Theregaregtwogtypes/formsgofgdata:
a). Digitalg(discrete)gdata:
Digitalgdatagisgdiscretegingnature.gItgmustgbegrepresentedgingformgofgnumbers,galphabetsgorgsymbolsgf
orgitgtogbegprocessedgbygagcomputer.gDigitalgdatagisgobtainedgbygcounting.gE.g.g1,g2,g3g…
onwards (UGCgAutonomous) IgYearg–gIIgSem
Course
Code: PROGRAMMINGgFORgPROBLEMgSOL L T P D
gJ125
VING
A (CommongtogECE,gCSE,gITg&gECM)
Credits:g3 3 0 0 0
Pre-Requisites:
1. MathematicalgKnowledge.
2. AnalyticalgSkills.
Coursegobjectives:
ThegStudentgwill:
1. Learngthegfundamentalsgofgcomputers.
2. Understandgthegvariousgstepsgingprogramgdevelopment.
3. UnderstandgthegsyntaxgandgsemanticsgofgCgprogrammingglanguage.
4. Learngthegusagegofgstructuredgprogramminggapproachgingsolvinggproblems.
5. Gaingthegknowledgegongsearchinggandgsortinggmethods.
Moduleg1:
INTRODUCTIONgTOgPROGRAMMING:
Introductiongtogcomponentsgofgagcomputergsystem:gdisks,gprimarygandgsecondarygme
mory,gprocessor,goperatinggsystem,gcompilers,gcreating,gcompilinggandgexecutinggagprogr
amgetc.,gNumbergsystems.
IntroductiongtogAlgorithms:gstepsgtogsolveglogicalgandgnumericalgproblems.gRepresenta
tiongofgAlgorithm,gFlowchart/Pseudogcodegwithgexamples,gProgramgdesigngandgstructure
dgprogramming.
IntroductiongtogCgProgramminggLanguage:gvariablesg(withgdatagtypesgandgspacegrequi
rements),gSyntaxgandgLogicalgErrorsgingcompilation,gobjectgandgexecutablegcode,gOperat
ors,gexpressionsgandgprecedence,gExpressiongevaluation,gStoragegclassesg(auto,gextern,gst
aticgandgregister),gtypegconversion,gThegmaingmethodgandgcommandglinegarguments
Bitwisegoperations:gBitwisegAND,gOR,gXORgandgNOTgoperatorsgConditionalgBranchin
ggandgLoops:gWritinggandgevaluationgofgconditionalsgandgconsequentgbranchinggwithgif,gi
f-gelse,gswitch-case,gternarygoperator,ggoto,gIterationgwithgfor,gwhile,gdo-
gwhilegloops.I/O:gSimpleginputgandgoutputgwithgscanfgandgprintf,gformattedgI/O,gIntroduct
iongtogstdin,gstdoutgandgstderr.
28
,Moduleg2:
ARRAYS,gSTRINGS,gSTRUCTURESgANDgPREPROCESSOR:
Arrays:gonegandgtwogdimensionalgarrays,gcreating,gaccessinggandgmanipulatinggelementsg
ofgarrays.
Strings:gIntroductiongtogstrings,ghandlinggstringsgasgarraygofgcharacters,gbasicgstringg
functionsgavailablegingCg(strlen,gstrcat,gstrcpy,gstrstrgetc.),garraysgofgstringsgStructur
es:gDefininggstructures,ginitializinggstructures,gunions,gArraygofgstructures.gPreproce
ssor:gCommonlygusedgPreprocessorgcommandsglikeginclude,gdefine,gundef,gIf,gifdef,g
ifndef.
Moduleg3:
POINTERSgANDgFILEgHANDLINGgINgC:
Pointers:gIdeagofgpointers,gdefininggpointers,gPointersgtogArraysgandgStructures,gUsegofgP
ointersgingself-referentialgstructures,gusagegofgself-
referentialgstructuresginglinkedglistg(nogimplementation)gEnumerationgdatagtype.
Files:gTextgandgBinarygfiles,gCreatinggandgReadinggandgwritinggtextgandgbinarygfiles,gapp
endinggdatagtogexistinggfiles,gWritinggandgreadinggstructuresgusinggbinarygfiles,gRandomg
accessgusinggfseek,gftellgandgrewindgfunctions.
Moduleg4:
FUNCTIONgANDgDYNAMICgMEMORYgALLOCATION:
Functions:gDesigninggstructuredgprograms,gdeclaringgagfunction,gSignaturegofgagfunction
,gParametersgandgreturngtypegofgagfunction,gpassinggparametersgtogfunctions,gcallgbygvalue
,gpassinggarraysgtogfunctions,gpassinggpointersgtogfunctions,gideagofgcallgbygreference,gSo
megCgstandardgfunctionsgandglibraries.
Recursion:gSimplegprograms,gsuchgasgFindinggFactorial,gFibonaccigseriesgetc.,g Limitatio
nsgofgRecursivegfunctions.
Dynamicgmemorygallocation:gAllocatinggandgfreeinggmemory,gAllocatinggmemorygforg
arraysgofgdifferentgdatagtypes.
Moduleg5:
INTRODUCTIONgTOgALGORITHMS:
Basicgsearchinggalgorithmsg(lineargandgbinarygsearchgtechniques),Basicgsortinggalgorithm
sg(Bubble,gInsertion,gQuick,gMergegandgSelectiongsortgalgorithms)gBasicgconceptgofgorder
gofgcomplexitygthroughgthegexamplegprograms
TextgBooks:
1. ReamgThareja,gProgramminggingC,gOxfordguniversitygpress.
2. B.A.g Forouzang andg R.F.g Gilberg,g Cg Programmingg andg Datag Structures,g Cengageg
Learning,g(3rdEdition).
29
, ReferencegBooks:
1. BriangW.gKernighangandgDennisgM.gRitchie,gThegCgProgramminggLanguage
,gPrenticegHallgofgIndia.
2. R.G.gDromey,gHowgtogsolvegitgbygComputer,gPearsong(16thImpression)
3. StephengG.gKochan,gProgramminggingC,gFourthgEdition,gPearsonEducation.
4. HerbertgSchildt,gC:gThegCompletegReference,gMcGrawgHill,g4thEdition
5. ByrongGottfried,gSchaum’sgOutlinegofgProgramminggwithgC,McGraw-Hill
Eg-gResources:
1. https://fresh2refresh.com/c-programming/
2. https://www.studytonight.com/c/
3. https://beginnersbook.com/2014/01/c-tutorial-for-beginners-with-examples/
4. https://www.programiz.com/c-programming
5. http://www.gtucampus.com/uploads/studymaterials/Degree%20EngineeringSandipFug
ndaments_of_C.pdf
6. http://cs.indstate.edu/~cbasavaraj/cs559/the_c_programming_language_2.pdf
Coursegoutcomes:
Thegstudentgwillgbegablegto:
1. Designgthegalgorithms/flowchartsgofgC-programs.
2. WritegthegCodegandgtestgaggivenglogicgingCgprogrammingglanguage.
3. Decomposegagproblemgintogfunctionsgandgtogdevelopgmodulargreusablegcode.
4. MakegUsegofgarrays,gpointers,gstringsgandgstructuresgtogwritegCgPrograms.
5. Applygsearchinggandgsortinggalgorithms.
CO-
PO/PSOgMappinggChartg(3/2/1gindicat
esgstrengthgofgcorrelation)
3g–gStrong;g2g–gMedium;g1g-gWeak
Program
CoursegO ProgramgOutcomesg(POs) Specificg
utcomesg( Outcomes
COs) PO PO PO PO PO PO PO PO PO PO PO PO PSO PSO
1 2 3 4 5 6 7 8 9 10 11 12 1 2
CO1 3 2 - - - - - - - - - 1 2 2
CO2 2 2 3 2 2 - - - - - - - 2 -
CO3 3 2 2 - - - - - - - - 1 - 3
CO4 3 2 2 2 - - - - - - - 1 - 3
CO5 3 2 2 - - - - - - - - 1 2 3
Average 2.8 2.0 2.3 2.0 2.0 - - - - - - 1.0 2.0 2.8
30
, Moduleg1
Pre-Requestsgaregfollowings.
1. Enthusiasm
2. LogicgBuildinggSkills
3. Mathematics(Basicsglikegprimegnumber,gfactorial)
Introductiongtogcomputers:
Definitiongofgterms
Computerg:gisgangelectronicgdevicegthatgoperatesg(works)gundergthegcontrolgofgprogramsgstoredgingits
gowngmemorygunit.
Agcomputergisgangelectronicgmachinegthatgprocessesgrawgdatagtoggiveginformationgasgoutput.
Angelectronicgdevicegthatgacceptsgdatagasginput,gandgtransformsgitgundergtheginfluencegofgagsetgofgspe
cialginstructionsgcalledgPrograms,gtogproducegthegdesiredgoutputg(referredgtogasgInformation).
Explanations;
Agcomputergisgdescribedgasgangelectronicgdevicegbecause;gitgisgmadegupgofgelectronicgcomponentsgan
dgusesgelectricgenergyg(suchgasgelectricity)gtogoperate.
Agcomputerghasganginternalgmemory,gwhichgstoresgdatag&ginstructionsgtemporarilygawaitinggprocess
ing,gandgevengholdsgthegintermediategresultg(information)gbeforegitgisgcommunicatedgtogthegrecipients
gthroughgthegOutputgdevices.
Itgworksgongthegdatagusinggtheginstructionsgissued,gmeansgthat,gthegcomputergcannotgdoganygusefulgjo
bgongitsgown.gItgcangonlygworkgasgpergthegsetgofginstructionsgissued.
Agcomputergwillgacceptgdatagingonegformgandgproducegitginganothergform.gThegdatagisgnormallygheldg
withingthegcomputergasgitgisgbeinggprocessed.
Program:
AgcomputergProgramgisgagsetgofgrelatedginstructionsgwrittengingtheglanguagegofgthegcomputerg&gisguse
dgtogmakegthegcomputergperformgagspecificgtaskg(or,gtogdirectgthegcomputergongwhatgtogdo).
Agsetgofgrelatedginstructionsgwhichgspecifyghowgthegdatagisgtogbegprocessed.
gAgsetgofginstructionsgusedgtogguidegagcomputergthroughgagprocess.
Data:gIsgagcollectiongofgrawgfacts,gfiguresgorginstructionsgthatgdognotghavegmuchgmeaninggtogtheguser.
Datagmaygbegingformgofgnumbers,galphabets/lettersgorgsymbols,gandgcangbegprocessedgtogproduceginforma
tion.
TYPESgOFgDATA.
Theregaregtwogtypes/formsgofgdata:
a). Digitalg(discrete)gdata:
Digitalgdatagisgdiscretegingnature.gItgmustgbegrepresentedgingformgofgnumbers,galphabetsgorgsymbolsgf
orgitgtogbegprocessedgbygagcomputer.gDigitalgdatagisgobtainedgbygcounting.gE.g.g1,g2,g3g…