You are on page 1of 8
Programming in C (22226) u m1 Iv Practical No. U1: Array Develop a Program to: 1. Sort list of 10 numbers. 2, Perform addition of 3x3 matrix. Practical Significance Students will be able to write programs using arrays and store multiple variable values under one variable name with subscript and understand contiguous storage locations used in memory for storing these variables. Relevant Program Outcomes + Basic knowledge: Apply knowledge of basic mathematics, sciences and basic engineering to solve the broad-based Computer engineering problem. + Discipline knowledge: Apply Information Technology knowledge to solve broad- based Information Technology related problems. «Experiments and practice: Plan to perform experiments, practices and to use the results to solve Information Technology related problems. + Engineering tools: Apply appropriate Information T tools with an understanding of the limitations. chnology related techniques/ * Ethies:Apply ethical principles for commitment to professional ethics, responsibilities and norms of the practice also in the field of Computer engineering, Individual and team work:Function effectively as a leader and team member in diverse/ multidisciplinary teams. + Communication:Communicate effectively in oral and written form. + Life-long learning:Engage in independent and life-long learning activities in the context of technological changes in the Computer engineering field and allied industry. Competeney and Practical skills This practical is expected to develop the following skills for the industry identified competency‘Develop ‘C’ programs to solve broad-based computer related problem’: 1, Write Algorithm for given program. 2. Draw Flow Chart for given Algorithm, 3. Develop a °C’ program using variables, constants and arithmetic expressions, 4, Debug the program. 5. Execute a simple C program using Turbo C/ gee compiler. Relevant Course Outcome(s) 1. Develop flowchart and algorithm to solve problems logically. 2. Develop ‘C’ programs using arrays and structures. Practical Outcome 1. Write/compile/execute simple ‘C’ program using Turbo ‘C’ and gee compiler. 2. Use single and multi-dimensional arrays in the program. Maharashira State Board of Technical Education 74 Programming in C (22226) VI Relevant Affective domain related Outcome(s) 1. Follow safety practices. 2. Follow ethical practices VII Minimum Theoretical Background Concept of array variables and their declaration.Concept of single and multi- dimensional array. VIII Algorithm Sort Numbers 1. Start 2. DECLARE a[10], 1, j, temp 3. FOR(=0;1<10;i++) ELSE goto 5 4, READ ali] 5. FOR(=0;i=95i++) ELSE goto 11 6. FOR()-i;j<-105}++) ELSE goto 5 7.1 (afi] > afj) 8, temy 9. ail 10. alj] 11, FOR(=0;i<10;1+-+) ELSE goto 13, 12. WRITE afi] 13. Stop ix Addition 1, Start 2, DECLARE a(3][3], b[3]13], e[3]13]. ij ;i<3;i++) ELSE goto 6 5]<3:j++4) ELSE goto 3 iG) 6, FORG-0;i<3;i++) ELSE goto 9 7. FOR(-0;)<3:j++) ELSE goto 6 8. READ Dif] 9, FORG=0;i<3;1++) ELSE goto 13 10. FOR(j=0;j<3;j++) ELSE goto 9 11. cf] = ali] + ONE 12. WRITE cfi]{ij] 13. Stop Maharashira State Board of Technical Education 75 Programming in C (22226) 1X Flow Chart 7) : DECLARE a[10}, i,j, emp WRITE ali) T aljl = temp LS START DECLARE a[3]i3, MPD CIT AS 0 ae a IEG) Se ee ifaw ee ce ae ; io 7 0 TFS) tL aby) 1 WRITE cil) T + Maharashtra State Board of Technical Education 76 Programming in C (22226) X ‘C’ Program Code (Sort lst of 10 numbers*/ ¥include ‘include vvold mating ‘ ‘nt a{101J.temp; elreeri, forii=dite10 164) 4 rintf\nEnter number Sa: “+1; ‘scant a". Sali 1 Forii=o1e9,144) 4 ford=is<103++) 1 aupaup temp = all, alll = all: abi ~ temp; y y d forti=0ici0:ie+) 1 ) print eal); ectch0; 1 /*Pecform addition of 3x3 mautix*/ ‘smemaecstato n> ‘#include void main() f int af3,3], DISII31, E3113]. cearser0; fort=051<3;144) t forG-05<3;)++) 4 printf Enter value apsaypa ©“), Scant" gal), } 1 forG-05<3;i++) 4 ford=0.J<3.}++) 4 printf(‘Enter value bila] =“); scant", £1); 1 d Foml=0.1<3.14+) 4 forg=0)<3;1++) Lil] = af) + DIE: printi(d\e" cD: ) prmerc\n"); getcho; Maharashira State Board of Technical Education 7 Programming in C (22226) XI XII xIV xv XVI 1 Resources required ‘S.No. ime of Resource Major Specification | Qty. Remarks 1 mputer System ‘Any desktop or laptop computer with | system for ‘One computer basic configuration _| each student Sompiler Turbo Cigee ‘One for cach ‘computer system Precautions to be followed 1. Handle computer system with care. 2. Strictly follow the instruction for writing, compiling and executing the program. 3. Start and Shutdown system with proper procedure, 4, Array should be declared and used properly. 5. Array size should be given properly. Resources used Specifications Remarks S.No.| Name of Resource Make Details (if any) T._ | Computer System with broad Intel ® Core ™145-7200U CPU @ 2.50 INTEL 1 specifications CH02.10 GH 2._| Software Compiler Turbo C++ GCC 1 3, [Any other resource used ; Results Conclusion (Actions/decisions to be taken based on the interpretation of results). Program to implement Array has been executed successfully Practical Related Questions Note: Below given are few sample questions for reference. Teachers must design more such questions so as to ensure the achievement of identified CO. Point out the error in the following C program. main() { int size ; scant ("%d", &size) ; intarr[size] Maharashira State Board of Technical Education Programming in C (22226) for (i= 1; i<= sizes i++) { seanf ( "Yd", arr[i] ) ; printf ("%d", arr{i] ) ; t 2. Check if the following array declarations are correct. inta (25) ; int size = 10, bfs int ¢= {0,1,2} ; 3. Givedifference between these two expressions. intnum{5] ; num[5]= 11; 4. Point out the error in the following C program, main() { int three[3][]= { 2.4.3, 6,82, 231 Be printf ( "\n%d", three[1][1] ) ; } Space for Answer Ans 1: ERROR 1: Declaration not allowed here. int arr[size]; ERROR 2: Constant expression required. int arr[size]; ERROR 3: Undefined Symbol ‘I Ams 2: > INCORRECT 10, b[size]; INCORRECT int ¢ = {0,1,2k 2 INCORRECT Ans 3: int num{5]; : Array ‘num’ declared with size 5 num[5] = 11; : 11 is assigned to index 5 of num Ans 4: ERROR: Size of type is unknown Maharashira State Board of Technical Education 7 Programming in C (22226) Maharashira State Board of Technical Education 0 Programming in C (22226) XVII__ References / Suggestions for further Reading https://www.programiz.com/c-programming/c-arrays hitp://spoken-tutorial.org/tutorial- search/?search_fo: XVIII Assessment Scheme hutp://www.w3resource.com/e-programming-exercises/array index.php ‘Crand+Cpp&search_language=English Performance indicators Weightage Process related (7.5 Marks) 30% 1 Debugging ability 20% 2 Following ethical practices 10% Product related (17.5 Marks) 70% 1 Correctness of algorithm 15% 2. Correctness of Flow chart 15% 3 Correctness of Program codes 20% a (Quality of input messaging and output formatting 3% 5 ‘Completion and submission of Practical in time 3% 6 ‘Answer to sample questions 10% ‘Total (25 Marks) 100% Marks obtained Dated Sign of Teacher Process Product Related(7.5) Related(17.5) Total(25) Maharashira State Board of Technical Education aI

You might also like