MCS-011. June 2014 Solutions Manual IGNOUUSER
|
|
- Harriet West
- 5 years ago
- Views:
Transcription
1 MCS-011 June 2014 Solutions Manual IGNOUUSER
2 1 1. (a) Write an algorithm and draw corresponding flowchart to calculate the factorial of a given number. Factorial of a number n n! = 1*2*3*4*...*n Algorithm to find the factorial of a given number Step1: Start Step2: Input num Step3: Set fact=1, i=1 Step4: Repeat steps 5 to 6 while i less than or equal to number Step5: fact = fact * i Step6: i = i + 1 Step7: Display or print fact Step8: Stop Flow Chart to find the factorial of a given number Start input n fact = 1 i = 1 Is i <= n No fact = 1 i = 1 Yes Print fact Stop
3 2 1. (b) Using recursion, generate n terms of Fibonacci series (n>0) Recursive definition of Fibonacci series f(n) = 1 for n=1 or n=2 f(n) = f(n-1) + f(n-2) for n>=3 Algorithm to generate n terms of fibonacci series Step1: Start Step2: Input n Step3: Set a=1,b=1,c=0 Step4: Print a,b Step5: Set i=2 Step6: Repeat steps 7 to 10 till i<=n Step7: c=a+b Step8: Print c Step9: a=b,b=c Step10: i++ Step11: Stop Program /*Program to Fibonacci series of n terms*/ /*variables declaration*/ int a,b,c,n,i; a=1,b=1,c=0; /*user input*/ printf( Enter the number : ); scanf( %d,&n); /*output first two terms*/ printf( %d %d,a,b); i=2; while (i<=n) c=a+b;
4 3 printf( %d,c); /*swap values*/ a=b; b=c; i++; Output Enter the number : (c) Using file handling, create a file, insert some characters and count them. /*Program to find create a file and insert some characters and count them*/ /*variables declaration*/ FILE *fptr; char c[100],s[100]; int totchars; /*open file myfile.txt in write mode*/ fptr=fopen( myfile.txt, w ); /*Error handling*/ if (fptr == NULL) printf( Error occurred ); return 1; printf( Enter something : ); gets(c); /*write to file*/ fprintf(fptr, %s,c);
5 4 /*close file*/ fclose(fptr); /*To read the file content open file in read mode*/ fptr=fopen( myfile.txt, r ); /*Error handling*/ if (fptr == NULL) printf( Error occurred ); return 1; /*read file content*/ fscanf(fptr, %s,&s); /*close file*/ fclose(fptr); /*count the characters and print*/ totchars = strlen(s); printf( Total characters in file is : %d,totchars); Output A file with name myfile.txt is created and the output will be Enter something : hello Total characters in the file is : 5 2. (a) Write a program to find the string length without using strlen() function. Algorithm Step1: Start Step2: Input string s Step3: Set length = 0 Step4: Repeat step 5 while s*length+!= \0 the string termination character Step5: length++ Step6: Print length Step7: Stop
6 5 Program /*Program to find string length without using strlen()*/ /*variables declaration*/ char s[100]; int length; /*user input*/ printf( Enter the string : ); gets(s); length=0; while (s*length+!= \0 ) length++; /*display output to user*/ printf( \nlength of string %s is %d,s,length); Output Suppose the user enters IGNOU, then the string is stored in memory location as I G N O U \0 Iteration length str[length] 1 1 I 2 2 G 3 3 N 4 4 O 5 5 U 6 5 \0 Loop terminates here 2. (b) Write a program using C to calculate the Net Salary if the basic, TA, DA, allowances and deductions are given using structures concept. Net Salary = Basic + TA + DA + Other allowances - Deductions
7 6 Algorithm Step1: Start Step2: Create structure named salary to hold various salary heads Step3: Create a variable of type salary Step4: Take input of various salary heads into the created variable Step5: Calculate Net Salary Step6: Print the calculated net salary Step7: Stop Program /*Program to find string length without using strlen()*/ /*Structure declaration*/ struct salary char name[50]; int basic, ta,da,other,deductions,net; ; /*variable declarations*/ salary s; /*user inpur*/ printf( Enter name : ); gets(s.name); printf( Enter basic of %s :, s.name); scanf( %d,s.basic); printf( Enter TA of %s, s.name); scanf( %d,s.ta); printf( Enter DA of %s, s.name); scanf( %d,s.da); printf( Enter Other allowances of %s, s.name); scanf( %d,s.other); printf( Enter deductions of %s, s.name); scanf( %d,s.deductions); /*net salary calculations*/ s.net = s.basic + s.ta + s.da + s.other s.deductions; /*output the result*/ printf( \nthe net salary is %d, s.net);
8 7 Output Suppose the user enters Enter name : ignouuser Enter basic of ignouuser: 5600 Enter TA of ignouuser: 1200 Enter DA of ignouuser: 1500 Enter Other allowances of ignouuser : 650 Enter deductions of ignouuser : 1100 The net salary is (a) What is the use of continue statement? Explain with an example. The continue statement works only within loops. It forces the next iteration of the loop to take place skipping the remaining unexecuted statements in the loop In the for loop, continue causes the increment and then the condition test portions of the loop executes. In while loop and do while loop, continue passes the program control to the conditional tests. Example: Suppose we want to write a program to sum all 10 numbers input by user but to ignore the negative numbers input by user. Then the corresponding code portion to do this work is sum = 0; for(i=0;i<n;i++) printf( Enter an integer ); scanf( %d,&x); if (x<0) continue; sum = sum + x; 3. (b) Explain any four string functions with example for each. ***refer ignou block 3. (c) How will you write a function with no arguments and with return value? Give an example In this case the function does not get any data from the calling function but it returns a value to the calling function. Diagrammatically we can represent this by Calling Function No Input Receives Output Defined Function
9 8 Syntax of defining such functions <return type> <function name> Statements;... return <value>; e.g. Program to find sum of two given numbers 30 and 60 /*Program to find sum of 30 and 60 using function*/ /*variable declaration*/ int result; /*function call*/ result = getsum(); /*output the result*/ printf( The answer is %d,result); /*function definition*/ int getsum() /*variable declaration*/ int a=30,b=60,sum; sum=a+b; return sum; 4. (a) Write a program to swap two values using call by value method. In call by value function call, calling function sends the values of the variables to the called function. The value of the actual arguments are copied into the corresponding formal arguments of the called function.
10 9 Program /*Program to swap two values using call by value method*/ /*variable declaration*/ int a,b; a=10, b=20; printf( The values before interchange are %d and %d,a,b); /*function call*/ myswap(a,b); /*function definition*/ void myswap(int x,int y) /*variable declaration*/ int temp; temp=x; x=y; y=temp; /*output result*/ printf( The values after interchange are %d and %d,x,y); Output The values before interchange are 10 and 20 The values after interchange are 20 and 10 Here a and b are actual arguments and x and y are formal arguments When a and b are passed to the function myswap the values of a and b are copied to x and y respectively.
11 10 4. (b) Write a program in C to multiply two matrices A and B Algorithm Step1: Start Step2: Input matrices A of order mxn and B or order pxq Step3: if n!=p then goto step 15 Step4: Create matrix C of order mxq Step5: Set i=0,j=0,k=0 Step6: Repeat steps 7 to 13 till i<m Step7: Repeat steps 8 to 12 till j<q Step8: Set C[i][j] = 0 Step9: Repeat steps 10 to 11 till k<n Step10: Set C[i][j] = C[i][j] + (A[i][k]*B[k][j]) Step11: k++ Step12: j++ Step13: i++ Step14: Print C Step15: Stop Program /*Program to multiply two matrices*/ /*variables declaration*/ int m,n,p,q,i,j,k; int A[10][10], B[10][10], C[10][10]; /*user input*/ printf( Enter the rows and columns of first matrix : ); scanf( %d %d,&m,&n); printf( Enter the rows and columns of second matrix : ); scanf( %d %d,&p,&q); if (n!=p) printf( Cant multiply these matrices ); return 1; printf( Enter the elements of first matrix\n ); for (i=0;i<m;i++) for (j=0;j<n;j++) scanf( %d,&a*i+*j+);
12 11 printf( Enter the elements of second matrix\n ); for(i=0;i<p;i++) for(j=0;j<q;j++) scanf( %d,&b*i+*j+); for(i=0;i<m;i++) for(j=0;j<q;j++) C[i][j]=0; for(k=0;k<n;k++) C[i][j] = C[i][j] + (A[i][k]*B[k][j]); /*output the result*/ printf( \nthe result is \n ); for(i=0;i<m;i++) for(j=0;j<q;j++) printf( %d, C*i+*j+); printf( \n ); Output Enter the rows and columns of first matrix : 2 3 Enter the rows and columns of second matrix : 3 2 Enter the elements of first matrix Enter the elements of second matrix The result is
13 12 5. (a) Write a macro to display the string COBOL in the following pattern C C O C O B C O B O C O B O L Program /*Program to display the string COBOL in given pattern*/ /*Preprocessor Directives*/ #define MYMACRO for(i=0;i<strlen(s);i++) \ \ for(j=0;j<=i;j++) \ \ printf( %c,s*j+); \ \ printf( \n ); \ /*variables declaration*/ int i,j; char s*+= COBOL ; MYMACRO; Output When the program is executed the reference MYMACRO in the main function is replaced by the set of statements contained within the MYMACRO definition and the output will be C CO COB COBO COBOL
14 13 5. (b) Define a macro to find the maximum among of 3 given numbers using # ifdef, #else. Syntax of #ifdef - #else - #endif directives #ifdef MACRONAME statements #else statements #endif Algorithm to find largest among three numbers Step1: Start Step2: Input a,b,c Step3: Set large = a Step4: If b is greator than large then set large=b; Step5: If c is greator than large the set large = c; Step6: print large Step7: Stop Program /*Program to find max of 3 numbers using #ifdef and #else directives*/ /*Preprocessor Directives*/ #define TEMP /*variables declaration*/ int a,b,c,result; #ifdef TEMP /*user input*/ printf( Enter three numbers : ); scanf( %d %d %d,&a,&b,&c); large=a; if (b>large) large=b; if (c>large) large=c;
15 14 #else #endif /*output the result*/ printf( \nthe largest is : %d,large); /*do nothing*/ Output Enter three numbers : The largest is : 15
16 15 For any queries do write to me at
PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities
PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities Continuous Internal Evaluation Test 2 Date: 0-10- 2017 Marks: 0 Subject &
More informationUnit 3 Functions. 1 What is user defined function? Explain with example. Define the syntax of function in C.
1 What is user defined function? Explain with example. Define the syntax of function in C. A function is a block of code that performs a specific task. The functions which are created by programmer are
More informationSubject: Fundamental of Computer Programming 2068
Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find
More informationUnit 3 Decision making, Looping and Arrays
Unit 3 Decision making, Looping and Arrays Decision Making During programming, we have a number of situations where we may have to change the order of execution of statements based on certain conditions.
More informationFunctions. Arash Rafiey. September 26, 2017
September 26, 2017 are the basic building blocks of a C program. are the basic building blocks of a C program. A function can be defined as a set of instructions to perform a specific task. are the basic
More informationQuestions Bank. 14) State any four advantages of using flow-chart
Questions Bank Sub:PIC(22228) Course Code:-EJ-2I ----------------------------------------------------------------------------------------------- Chapter:-1 (Overview of C Programming)(10 Marks) 1) State
More informationFlow Chart. The diagrammatic representation shows a solution to a given problem.
low Charts low Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as various symbols, and their order by connecting them with arrows. he diagrammatic representation
More information'C' Programming Language
F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax
More informationMA 511: Computer Programming Lecture 3: Partha Sarathi Mandal
MA 511: Computer Programming Lecture 3: http://www.iitg.ernet.in/psm/indexing_ma511/y10/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2010-11 Last
More informationDecision Making -Branching. Class Incharge: S. Sasirekha
Decision Making -Branching Class Incharge: S. Sasirekha Branching The C language programs presented until now follows a sequential form of execution of statements. Many times it is required to alter the
More informationLectures 5-6: Introduction to C
Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most
More informationControl Structure: Loop
Control Structure: Loop Knowledge: Understand the various concepts of loop control structure Skill: Be able to develop a program involving loop control structure 1 Loop Structure Condition is tested first
More informationDept. of CSE, IIT KGP
Control Flow: Looping CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of Repeated Execution Loop: Group of
More informationQuestion Bank (SPA SEM II)
Question Bank (SPA SEM II) 1. Storage classes in C (Refer notes Page No 52) 2. Difference between function declaration and function definition (This question is solved in the note book). But solution is
More informationUNIT I : OVERVIEW OF COMPUTERS AND C-PROGRAMMING
SIDDARTHA INSTITUTE OF SCIENCE AND TECHNOLOGY:: PUTTUR Siddharth Nagar, Narayanavanam Road 517583 QUESTION BANK (DESCRIPTIVE) Subject with Code : PROGRAMMING FOR PROBLEM SOLVING (18CS0501) Course & Branch
More informationAryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9
Fundamental of C Programming Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Q2. Write down the C statement to calculate percentage where three subjects English, hindi, maths
More informationECEN 449 Microprocessor System Design. Review of C Programming. Texas A&M University
ECEN 449 Microprocessor System Design Review of C Programming 1 Objectives of this Lecture Unit Review C programming basics Refresh programming skills 2 Basic C program structure # include main()
More informationLoops / Repetition Statements
Loops / Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops C has three kinds of repetition statements: the while loop the for
More informationGovernment Polytechnic Muzaffarpur.
Government Polytechnic Muzaffarpur. Name of the Lab: COMPUTER PROGRAMMING LAB (MECH. ENGG. GROUP) Subject Code: 1625408 Experiment: 1 Aim: Programming exercise on executing a C program. If you are looking
More informationMODULE 2: Branching and Looping
MODULE 2: Branching and Looping I. Statements in C are of following types: 1. Simple statements: Statements that ends with semicolon 2. Compound statements: are also called as block. Statements written
More informationLoops / Repetition Statements
Loops / Repetition Statements Repetition statements allow us to execute a statement multiple times Often they are referred to as loops C has three kinds of repetition statements: the while loop the for
More information& Technology. G) Functions. void. Argument2, Example: (Argument1, Syllabus for 1. 1 What. has a unique. 2) Function name. passed to.
Computer Programming and Utilization (CPU) 110003 G) Functions 1 What is user defined function? Explain with example. Define the syntax of function in C. A function is a block of code that performs a specific
More informationTribhuvan University Institute of Science and Technology 2065
1CSc.102-2065 2065 Candidates are required to give their answers in their own words as for as practicable. 1. Draw the flow chart for finding largest of three numbers and write an algorithm and explain
More informationLectures 5-6: Introduction to C
Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most
More informationM3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE
M3-R4: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be
More informationESC101N: Fundamentals of Computing End-sem st semester
ESC101N: Fundamentals of Computing End-sem 2010-11 1st semester Instructor: Arnab Bhattacharya 8:00-11:00am, 15th November, 2010 Instructions 1. Please write your name, roll number and section below. 2.
More informationPROGRAMMING IN C AND C++:
PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print
More informationECEN 449 Microprocessor System Design. Review of C Programming
ECEN 449 Microprocessor System Design Review of C Programming 1 Objectives of this Lecture Unit Review C programming basics Refresh es programming g skills s 2 1 Basic C program structure # include
More informationQ 1. Attempt any TEN of the following:
Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The
More informationScheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C
Sample Test Paper-I Marks : 25 Time:1 Hrs. Q1. Attempt any THREE 09 Marks a) State four relational operators with meaning. b) State the use of break statement. c) What is constant? Give any two examples.
More informationProgramming in C Lab
Programming in C Lab 1a. Write a program to find biggest number among given 3 numbers. ALGORITHM Step 1 : Start Start 2 : Input a, b, c Start 3 : if a > b goto step 4, otherwise goto step 5 Start 4 : if
More informationAROUND THE WORLD OF C
CHAPTER AROUND THE WORLD OF C 1 1.1 WELCOME TO C LANGUAGE We want to make you reasonably comfortable with C language. Get ready for an exciting tour. The problem we would consider to introduce C language
More informationB.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University
Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are
More informationMODULE 3: Arrays, Functions and Strings
MODULE 3: Arrays, Functions and Strings Contents covered in this module I. Using an Array II. Functions in C III. Argument Passing IV. Functions and Program Structure, locations of functions V. Function
More informationProgramming & Data Structure Laboratory. Day 2, July 24, 2014
Programming & Data Structure Laboratory Day 2, July 24, 2014 Loops Pre and post test loops for while do-while switch-case Pre-test loop and post-test loop Condition checking True Loop Body False Loop Body
More informationSudeshna Sarkar Dept. of Computer Science & Engineering. Indian Institute of Technology Kharagpur
Programming and Data Structure Sudeshna Sarkar Dept. of Computer Science & Engineering. Indian Institute of Technology Kharagpur Shortcuts in Assignment Statements A+=C A=A+C A-=B A=A-B A*=D A=A*D A/=E
More informationProgramming & Data Structure Laboratory. Arrays, pointers and recursion Day 5, August 5, 2014
Programming & Data Structure Laboratory rrays, pointers and recursion Day 5, ugust 5, 2014 Pointers and Multidimensional rray Function and Recursion Counting function calls in Fibonacci #include
More information(i) Describe in detail about the classification of computers with their features and limitations(10)
UNIT I - INTRODUCTION Generation and Classification of Computers- Basic Organization of a Computer Number System Binary Decimal Conversion Problems. Need for logical analysis and thinking Algorithm Pseudo
More informationSubject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100
Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space
More informationPERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur
PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam-613 403 Thanjavur 01. Define program? 02. What is program development cycle? 03. What is a programming language? 04. Define algorithm? 05. What
More informationComputer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];
Arrays An array is a collection of two or more adjacent memory cells, called array elements. Array is derived data type that is used to represent collection of data items. C Array is a collection of data
More informationF.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C
F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1 (a) List any four relational operators.
More informationColumns A[0] A[0][0] = 20 A[0][1] = 30
UNIT Arrays and Strings Part A (mark questions). What is an array? (or) Define array. An array is a collection of same data type elements All elements are stored in continuous locations Array index always
More informationF.E. Sem. II. Structured Programming Approach
F.E. Sem. II Structured Programming Approach Time : 3 Hrs.] Mumbai University Examination Paper Solution - May 13 [Marks : 80 Q.1(a) Explain the purpose of following standard library functions : [3] (i)
More informationMAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER
Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate
More informationC PROGRAMMING. Prof. (Dr.) S. N. Mishra (Prof. & Head, Dept. of CSEA, IGIT, Sarang)
LAB MANUAL C MING Prof. (Dr.) S. N. Mishra (Prof. & Head, Dept. of CSEA, IGIT, Sarang) C MING LAB Experiment No. 1 Write a C program to find the sum of individual digits of a positive integer. Experiment
More informationC 101. Davide Vernizzi. April 29, 2011
C 101 Davide Vernizzi April 9, 011 1 Input/Output Basic I/O. The basic I/O shown here can be used to get input from the user and to send output to the user. Note that usually input must be verified before
More informationCS6202 - PROGRAMMING & DATA STRUCTURES UNIT I Part - A 1. W hat are Keywords? Keywords are certain reserved words that have standard and pre-defined meaning in C. These keywords can be used only for their
More informationSaini Technologies ADVANCED C PROGRAMMING WITH SAINI TECHNOLOGIES. Sushil Kumar Saini Mo.
Saini Technologies ADVANCED C PROGRAMMING WITH SAINI TECHNOLOGIES Sushil Kumar Saini Email: Sushilsaini04@gmail.com Mo. 9896470047 Integer Array int a[]=12,34,54,45,34,34; printf("%d",a[0]); printf(" %d",a[1]);
More informationPractice problems Set 2
Practice problems Set 2 1) Write a program to obtain transpose of a 4 x 4 matrix. The transpose of matrix is obtained by exchanging the elements of each row with the elements of the corresponding column.
More informationModel Viva Questions for Programming in C lab
Model Viva Questions for Programming in C lab Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart is a diagram that shows a continuous
More informationSRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I
SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I Year & Sem: I B.E (CSE) & II Date of Exam: 21/02/2015 Subject Code & Name: CS6202 & Programming & Data
More informationMultiple Choice Questions ( 1 mark)
Multiple Choice Questions ( 1 mark) Unit-1 1. is a step by step approach to solve any problem.. a) Process b) Programming Language c) Algorithm d) Compiler 2. The process of walking through a program s
More informationUNIT 3 FUNCTIONS AND ARRAYS
UNIT 3 FUNCTIONS AND ARRAYS Functions Function definitions and Prototypes Calling Functions Accessing functions Passing arguments to a function - Storage Classes Scope rules Arrays Defining an array processing
More informationn Group of statements that are executed repeatedly while some condition remains true
Looping 1 Loops n Group of statements that are executed repeatedly while some condition remains true n Each execution of the group of statements is called an iteration of the loop 2 Example counter 1,
More informationFloating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions
Announcements Thursday Extras: CS Commons on Thursdays @ 4:00 pm but none next week No office hours next week Monday or Tuesday Reflections: when to use if/switch statements for/while statements Floating-point
More informationAbout Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals
More informationC library = Header files + Reserved words + main method
DAY 1: What are Libraries and Header files in C. Suppose you need to see an Atlas of a country in your college. What do you need to do? You will first go to the Library of your college and then to the
More informationReg. No. : Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, JANUARY First Semester GE 6151 COMPUTER PROGRAMMING
wss Reg. No. : Question Paper Code : 37007 B.E./B.Tech. DEGREE EXAMINATION, JANUARY 2014. First Semester Civil Engineering GE 6151 COMPUTER PROGRAMMING (Common to all branches) (Regulation 2013) Time :
More informationArrays. CS10001: Programming & Data Structures. Pallab Dasgupta Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur
Arrays CS10001: Programming & Data Structures Pallab Dasgupta Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Array Many applications require multiple data items that have common
More informationSolution Set(Reference Book - Programming with c By Byron Gottfried Thrid Edition)
(2½ Hours) [Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written together.
More informationTo declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows
Unti 4: C Arrays Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type An array is used to store a collection of data, but it is often more useful
More informationLecture 6. Statements
Lecture 6 Statements 1 Statements This chapter introduces the various forms of C++ statements for composing programs You will learn about Expressions Composed instructions Decision instructions Loop instructions
More informationM4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE
M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be
More informationDynamic memory allocation
Dynamic memory allocation outline Memory allocation functions Array allocation Matrix allocation Examples Memory allocation functions (#include ) malloc() Allocates a specified number of bytes
More informationFunctions. Autumn Semester 2009 Programming and Data Structure 1. Courtsey: University of Pittsburgh-CSD-Khalifa
Functions Autumn Semester 2009 Programming and Data Structure 1 Courtsey: University of Pittsburgh-CSD-Khalifa Introduction Function A self-contained program segment that carries out some specific, well-defined
More informationPESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication
INTERNAL ASSESSMENT TEST 1 Date : 28.2.2018 Marks: 40 Subject & Code : DataStructures Using C++ (15EC661) Sem : VI A,B,C Name of faculty : Vandana M L Time : 11:30-1:00 PM Note: Answer FIVE full questions,
More information15 FUNCTIONS IN C 15.1 INTRODUCTION
15 FUNCTIONS IN C 15.1 INTRODUCTION In the earlier lessons we have already seen that C supports the use of library functions, which are used to carry out a number of commonly used operations or calculations.
More informationC PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5
C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5 1. Pointers As Kernighan and Ritchie state, a pointer is a variable that contains the address of a variable. They have been
More informationClassification s of Data Structures
Linear Data Structures using Sequential organization Classification s of Data Structures Types of Data Structures Arrays Declaration of arrays type arrayname [ arraysize ]; Ex-double balance[10]; Arrays
More informationThere are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions.
Introduction In the programs that we have dealt with so far, all statements inside the main function were executed in sequence as they appeared, one after the other. This type of sequencing is adequate
More informationPointers and Arrays A QUICK PREVIEW OF FOR CHAPTERS 10 AND 11 CMPE13. Cyrus Bazeghi
Pointers and Arrays A QUICK PREVIEW OF FOR CHAPTERS 10 AND 11 Cyrus Bazeghi POINTERS AND ARRAYS We have briefly seen these before, here are the details Pointer Array Address of a variable in memory Allows
More informationOBJECTIVE QUESTIONS: Choose the correct alternative:
OBJECTIVE QUESTIONS: Choose the correct alternative: 1. Function is data type a) Primary b) user defined c) derived d) none 2. The declaration of function is called a) function prototype b) function call
More informationAssignment: 1. (Unit-1 Flowchart and Algorithm)
Assignment: 1 (Unit-1 Flowchart and Algorithm) 1. Explain: Flowchart with its symbols. 2. Explain: Types of flowchart with example. 3. Explain: Algorithm with example. 4. Draw a flowchart to find the area
More informationIntroduction to C Language (M3-R )
Introduction to C Language (M3-R4-01-18) 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in OMR answer sheet supplied with the question paper, following
More informationMODULE 5: Pointers, Preprocessor Directives and Data Structures
MODULE 5: Pointers, Preprocessor Directives and Data Structures 1. What is pointer? Explain with an example program. Solution: Pointer is a variable which contains the address of another variable. Two
More informationReg. No. : Question Paper Code : 27157
WK 3 Reg. No. : Question Paper Code : 27157 B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2015. Time : Three hours Second Semester Computer Science and Engineering CS 6202 PROGRAMMING AND DATA STRUCTURES
More informationFor Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit
For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/ For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/
More informationCOP 3223 Introduction to Programming with C - Study Union - Fall 2017
COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationUNIT III (PART-II) & UNIT IV(PART-I)
UNIT III (PART-II) & UNIT IV(PART-I) Function: it is defined as self contained block of code to perform a task. Functions can be categorized to system-defined functions and user-defined functions. System
More informationChapter 8 Arrays and Strings. Objectives. Objectives (cont d.) Introduction. Arrays 12/23/2016. In this chapter, you will:
Chapter 8 Arrays and Strings Objectives In this chapter, you will: Learn about arrays Declare and manipulate data into arrays Learn about array index out of bounds Learn about the restrictions on array
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #43 Multidimensional Arrays In this video will look at multi-dimensional arrays. (Refer Slide Time: 00:03) In
More informationSNS COLLEGE OF ENGINEERING,
SNS COLLEGE OF ENGINEERING, COIMBATORE Department of Computer Science and Engineering QUESTION BANK(PART A) GE8151 - PROBLEM SOLVING AND PYTHON PROGRAMMING TWO MARKS UNIT-I 1. What is computer? Computers
More informationFundamentals of Programming Session 14
Fundamentals of Programming Session 14 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 These slides have been created using Deitel s slides Sharif University of Technology Outlines
More informationFunctions. CS10001: Programming & Data Structures. Sudeshna Sarkar Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur
Functions CS10001: Programming & Data Structures Sudeshna Sarkar Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur 1 Recursion A process by which a function calls itself
More informationSUHAIL T A
SUHAIL T A Functions A number of statements grouped into a single logical unit C pgm is a collection of functions Self contained pgm segment that carries out a specific task main is a special recognized
More informationTopic 6: A Quick Intro To C
Topic 6: A Quick Intro To C Assumption: All of you know Java. Much of C syntax is the same. Also: Many of you have used C or C++. Goal for this topic: you can write & run a simple C program basic functions
More informationVALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR
VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR 603 203 FIRST SEMESTER B.E / B.Tech., (Common to all Branches) QUESTION BANK - GE 6151 COMPUTER PROGRAMMING UNIT I - INTRODUCTION Generation and
More informationDecision making with if Statement : - Control Statements. Introduction: -
Control Statements Introduction: - Any C program if you consider, the set of statements are normally executed sequentially in the order in which they are written, and such programs have sequential structure
More informationWhy Pointers. Pointers. Pointer Declaration. Two Pointer Operators. What Are Pointers? Memory address POINTERVariable Contents ...
Why Pointers Pointers They provide the means by which functions can modify arguments in the calling function. They support dynamic memory allocation. They provide support for dynamic data structures, such
More informationARRAYS(II Unit Part II)
ARRAYS(II Unit Part II) Array: An array is a collection of two or more adjacent cells of similar type. Each cell in an array is called as array element. Each array should be identified with a meaningful
More informationC Syntax Out: 15 September, 1995
Burt Rosenberg Math 220/317: Programming II/Data Structures 1 C Syntax Out: 15 September, 1995 Constants. Integer such as 1, 0, 14, 0x0A. Characters such as A, B, \0. Strings such as "Hello World!\n",
More informationTopic 6: A Quick Intro To C. Reading. "goto Considered Harmful" History
Topic 6: A Quick Intro To C Reading Assumption: All of you know basic Java. Much of C syntax is the same. Also: Some of you have used C or C++. Goal for this topic: you can write & run a simple C program
More informationCOMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR. VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS
COMPUTER SCIENCE HIGHER SECONDARY FIRST YEAR VOLUME II - CHAPTER 10 PROBLEM SOLVING TECHNIQUES AND C PROGRAMMING 1,2,3 & 5 MARKS S.LAWRENCE CHRISTOPHER, M.C.A., B.Ed., LECTURER IN COMPUTER SCIENCE PONDICHERRY
More informationF.E. Sem. II. Structured Programming Approach
F.E. Sem. II Structured Programming Approach Time : 3 Hrs.] Mumbai University Examination Paper Solution - May 14 [Marks : 80 Q.1(a) What do you mean by algorithm? Which points you should consider [4]
More informationUNIT - I. Introduction to C Programming. BY A. Vijay Bharath
UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been
More information1.7 Recursion. Department of CSE
1.7 Recursion 1 Department of CSE Objectives To learn the concept and usage of Recursion in C Examples of Recursion in C 2 Department of CSE What is recursion? Sometimes, the best way to solve a problem
More informationGoogle placement paper
Visit prepnode.com for more placement papers and interview tips. Google placement paper No. of questions : 25 Maximum Time allowed : 60 minutes 1. Teacher asked the students to find the cube root of a
More informationPES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo
PES INSTITUTE OF TECHNOLOGY (BSC) I MCA, First IA Test, November 2015 Programming Using C (13MCA11) Solution Set Faculty: Jeny Jijo 1. (a)what is an algorithm? Draw a flowchart to print N terms of Fibonacci
More informationComputer Science & Engineering 150A Problem Solving Using Computers
Computer Science & Engineering 150A Problem Solving Using Computers Lecture 06 - Stephen Scott Adapted from Christopher M. Bourke 1 / 30 Fall 2009 Chapter 8 8.1 Declaring and 8.2 Array Subscripts 8.3 Using
More information