Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment Number : MCA(1)/011/Assign/13 Maximum Marks : 100 Weightage : 25%

Size: px
Start display at page:

Download "Course Code : MCS-011 Course Title : Problem Solving and Programming Assignment Number : MCA(1)/011/Assign/13 Maximum Marks : 100 Weightage : 25%"

Transcription

1 For more IGNOU Solved Assignments visit Get Daily Updates by Facebook: Course Code : MCS011 Course Title : Problem Solving and Programming Assignment Number : MCA(1)/011/Assign/13 Maximum Marks : 100 Weightage : 25% There are six questions in this assignment, which carry 80 marks. Rest 20 marks are for vivavoce. Answer all the questions. You may use illustrations and diagrams to enhance the explanations. Please go through the guidelines regarding assignments given in the Programme Guide for the format of presentation. Insert comments in the coding for better understanding. Question 1: Write a C program to find out perfect numbers from 1 and 50. Solution : #include<stdio.h> #include<conio.h> voidmain() voidperfect(); clrscr(); perfect(); getch(); void perfect() int n,i,s,lim; lim=1; while(lim<=50) i=1;s=0; while(i<lim) if(lim%i==0) s=s+i; i++; if(s==lim) For more IGNOU solved assignments please visit printf("perfect no =%d",lim); lim++;

2 Question 2: Write an algorithm, draw a corresponding flowchart and write an interactive program to convert a binary number to its octal equivalent. Solution : Alogrithm: Binary to octal conversion method: Step1: Arrange the binary number in the group 3 from right side. Step 2: Replace the each group with following values: Binary number Octal values Binary to octal chart Binary to octal conversion examples: For example we want to convert binary number to octal. Step 1: Step 2: So ( )2 = (132515)8

3 For more IGNOU solved assignments please visit c program to convert binary to octal #include<stdio.h> int main() long int binarynumber,octalnumber=0,j=1,remainder; printf("enter any number any binary number: "); scanf("%ld",&binarynumber); while(binarynumber!=0) remainder=binarynumber%10; octalnumber=octalnumber+remainder*j; j=j*2; binarynumber=binarynumber/10; printf("equivalent octal value: %lo",octalnumber); return 0; Sample output: Enter any number any binary number: 1101 Equivalent hexadecimal value: 15 For more IGNOU solved assignments please visit Question 3 : Write the function strreplace(s, chr, repl_chr) which will replace each occurrences of character chr with the character repl_chr in the string s. The function returns the number of replacements. Place the source code of this function in a file named strreplace.c Solution : char *replace_str(const char *str, const char *old, const char *new) char *ret, *r;

4 const char *p, *q; size_t oldlen = strlen(old); size_t count, retlen, newlen = strlen(new); if (oldlen!= newlen) for (count = 0, p = str; (q = strstr(p, old))!= NULL; p = q + oldlen) count++; /* this is undefined if p str > PTRDIFF_MAX */ retlen = p str + strlen(p) + count * (newlen oldlen); else retlen = strlen(str); if ((ret = malloc(retlen + 1)) == NULL) return NULL; for (r = ret, p = str; (q = strstr(p, old))!= NULL; p = q + oldlen) /* this is undefined if q p > PTRDIFF_MAX */ For more IGNOU solved assignments please visit ptrdiff_t l = q p; memcpy(r, p, l); r += l; memcpy(r, new, newlen); r += newlen; strcpy(r, p); return ret; Question 4: Writer an interactive C program to check whether the given string is a palindrome or not, using pointers. Solution : #include<stdio.h> #include<conio.h> int main() char str[30]; char *p,*t; printf("enter any string : "); gets(str); for(p=str ; *p!=null ; p++); for(t=str, p ; p>=t; )

5 if(*p==*t) p; t++; For more IGNOU solved assignments please visit else break; if(t>p) printf("is palindrome"); else printf("is Not palindrome"); getch(); return 0; Question 5: Write an interactive program called WEIGHT CONVERTER that accepts the weight in milligrams / decigrams / centigrams / kilograms /ounces / pounds / tons and displays its equivalent in grams. Solution : #include <stdio.h> void print_converted(int pounds) /* Convert U.S. Weight to Imperial and International Units. Print the results */ int stones = pounds / 14; int uklbs = pounds % 14; float kilos_per_pound = ; For more IGNOU solved assignments please visit float kilos = pounds * kilos_per_pound; printf(" %3d %2d %2d %6.2f", pounds, stones, uklbs, kilos);

6 Main (int argc,char *argv[]) int pounds; if(argc!= 2) printf ("Usage: convert weight_in_pounds"); exit(1); Sscanf (argv[1], "%d", &pounds); /* Convert String to int */ Printf (" US lbs UK st. lbs INT Kg"); print_converted (pounds); For more IGNOU solved assignments please visit Question 6. Write an interactive program to generate pay slips for the staff of size 12 employees (2 members are clerks, one computer operator, 6 salesmen, 3 helpers), working in a small chemist retail shop. Assumptions can be made wherever necessary. The payslip should display the employee no., employee name, no. of days worked during the month, date of generation of the payslip, month for which the salary is being paid, all the details of the payment, deductions, grosspay and netpay. Solution : #include<stdio.h> #include<conio.h> void main() int n,i,k; struct employee char name[50],des[30],mon[10],level; int empid,accno; float hra,da,cca,ca,gpf,grossal,totdeduc,netsal,basic; emp[10]; clrscr(); printf("enter THE NUMBER OF EMPLOYEE: "); scanf("%d",&n); for(i=1;i<=n;i++)

7 printf("enter NAME OF THE EMPLOYEE:"); scanf("%s",emp[i].name); printf("enter DESIGANTION OF THE EMPLOYEE:"); scanf("%s",emp[i].des); printf("enter MONTH:"); scanf("%s",emp[i].mon); printf("enter EMPLOYEE ID:"); scanf("%d",&emp[i].empid); printf("enter ACCNO:"); scanf("%d",&emp[i].accno); printf("basic PAY: "); scanf("%f",&emp[i].basic); printf("enter CITY LEVEL: "); scanf("%s",&emp[i].level); For more IGNOU solved assignments please visit for(i=1;i<=n;i++) emp[i].hra=emp[i].basic*0.30; if(emp[i].basic<=6500) emp[i].ca=100; else if(emp[i].basic>6500&&emp[i].basic<=8000) emp[i].ca=400; else emp[i].ca=800; emp[i].da=emp[i].basic/2; if(emp[i].level=='a' emp[i].level=='a') emp[i].cca=400; else if(emp[i].level=='b' emp[i].level=='b') emp[i].cca=100; else emp[i].cca=50; emp[i].gpf=emp[i].basic * 0.075; emp[i].grossal=emp[i].basic+emp[i].hra+emp[i].da+emp[ i].cca; emp[i].totdeduc=emp[i].gpf; emp[i].netsal=emp[i].grossalemp[i].totdeduc; for(i=1;i<=n;i++) do clrscr(); printf("v R SIDDHARTHA ENGINEERNG COLLEGE"); printf("kanuru::vijayawada7"); printf("pay SLIP"); For more IGNOU solved assignments please visit printf("************************"); printf("salary Slip for %s ",emp[i].mon); printf("***********************"); printf(": %s : %d ",emp[i].name,emp[i].empid); printf(":%s

8 :%d",emp[i].des,emp[i].accno); printf(" "); printf("< EARNINGS > < D E D U C T I O >");

9 printf("basic=%f.f.=%.2f",emp[i].basic,emp[i].gpf); printf("d.a=%.2f TAX=",emp[i].da); printf("h.r.a=%.2f.f. LOAN=",emp[i].hra); printf("c.c.a=%.2f.i.c=",emp[i].cca); printf(" "); printf("gross SALARY=%.2f DEDUCTIONS=%.2f ",emp[i].grossal,emp[i].totdeduc); printf(" "); printf("net SALARY=%.2f",emp[i].netsal); printf(" "); printf("signature"); printf("1 TO NEXT..."); scanf("%d",&k); while(k==2); getch(); N S For more IGNOU Solved Assignments visit Get Daily Updates by Facebook:

10

Problem Solving and 'C' Programming

Problem Solving and 'C' Programming Problem Solving and 'C' Programming Targeted at: Entry Level Trainees Session 10: Functions/Structure and Unions 2007, Cognizant Technology Solutions. All Rights Reserved. The information contained herein

More information

Subject: Fundamental of Computer Programming 2068

Subject: 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 information

P.G.D.C.M. (Semester I) Examination, : ELEMENTS OF INFORMATION TECHNOLOGY AND OFFICE AUTOMATION (2008 Pattern)

P.G.D.C.M. (Semester I) Examination, : ELEMENTS OF INFORMATION TECHNOLOGY AND OFFICE AUTOMATION (2008 Pattern) *4089101* [4089] 101 P.G.D.C.M. (Semester I) Examination, 2011 101 : ELEMENTS OF INFORMATION TECHNOLOGY AND OFFICE AUTOMATION (2008 Pattern) Time : 3 Hours Max. Marks : 70 Note : 1) Q. 1 is compulsory.

More information

'C' Programming Language

'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 information

Q 1. Attempt any TEN of the following:

Q 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 information

SRI 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 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 information

Tribhuvan University Institute of Science and Technology 2065

Tribhuvan 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 information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION 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 information

1. FIBONACCI SERIES. Write a C++ program to generate the Fibonacci for n terms. To write a C++ program to generate the Fibonacci for n terms.

1. FIBONACCI SERIES. Write a C++ program to generate the Fibonacci for n terms. To write a C++ program to generate the Fibonacci for n terms. PROBLEM: 1. FIBONACCI SERIES Write a C++ program to generate the Fibonacci for n terms. AIM: To write a C++ program to generate the Fibonacci for n terms. PROGRAM CODING: #include #include

More information

Chapter 8 Character Arrays and Strings

Chapter 8 Character Arrays and Strings Chapter 8 Character Arrays and Strings INTRODUCTION A string is a sequence of characters that is treated as a single data item. String constant: String constant example. \ String constant example.\ \ includes

More information

Questions Bank. 14) State any four advantages of using flow-chart

Questions 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 information

F.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 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 information

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

More information

M1-R4: Programing and Problem Solving using C (JULY 2018)

M1-R4: Programing and Problem Solving using C (JULY 2018) M1-R4: Programing and Problem Solving using C (JULY 2018) Max Marks: 100 M1-R4-07-18 DURATION: 03 Hrs 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter

More information

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

Scheme 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 information

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR

VALLIAMMAI 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 information

Unit 8. Structures and Unions. School of Science and Technology INTRODUCTION

Unit 8. Structures and Unions. School of Science and Technology INTRODUCTION INTRODUCTION Structures and Unions Unit 8 In the previous unit 7 we have studied about C functions and their declarations, definitions, initializations. Also we have learned importance of local and global

More information

UNIT-V CONSOLE I/O. This section examines in detail the console I/O functions.

UNIT-V CONSOLE I/O. This section examines in detail the console I/O functions. UNIT-V Unit-5 File Streams Formatted I/O Preprocessor Directives Printf Scanf A file represents a sequence of bytes on the disk where a group of related data is stored. File is created for permanent storage

More information

HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP )

HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP ) HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP ) 1.Write the steps to do the Following: a) Enter in to WordPad b) Enter 3 lines with suitable Heading c) Save the

More information

PES 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 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 information

MCA Semester 1. MC0061 Computer Programming C Language 4 Credits Assignment: Set 1 (40 Marks)

MCA Semester 1. MC0061 Computer Programming C Language 4 Credits Assignment: Set 1 (40 Marks) Summer 2012 MCA Semester 1 4 Credits Assignment: Set 1 (40 Marks) Q1. Explain the following operators with an example for each: a. Conditional Operators b. Bitwise Operators c. gets() and puts() function

More information

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.

More information

Single Dimension Arrays

Single Dimension Arrays ARRAYS Single Dimension Arrays Array Notion of an array Homogeneous collection of variables of same type. Group of consecutive memory locations. Linear and indexed data structure. To refer to an element,

More information

Presented By : Gaurav Juneja

Presented By : Gaurav Juneja Presented By : Gaurav Juneja Introduction C is a general purpose language which is very closely associated with UNIX for which it was developed in Bell Laboratories. Most of the programs of UNIX are written

More information

Decision Making and Branching

Decision Making and Branching INTRODUCTION Decision Making and Branching Unit 4 In the previous lessons we have learned about the programming structure, data types, declaration of variables, tokens, constants, keywords and operators

More information

SOFTWARE Ph.D. Qualifying Exam Spring Consider the following C program, which includes three function definitions, including the main function.

SOFTWARE Ph.D. Qualifying Exam Spring Consider the following C program, which includes three function definitions, including the main function. (i) (6 pts.) SOFTWARE Ph.D. Qualifying Exam Spring 2017 Consider the following C program, which includes three function definitions, including the main function. #include #include

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Code: 17212 Model Answer Page No: 1/28 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model

More information

Principles of C and Memory Management

Principles of C and Memory Management COMP281 Lecture 9 Principles of C and Memory Management Dr Lei Shi Last Lecture Today Pointer to Array Pointer Arithmetic Pointer with Functions struct Storage classes typedef union String struct struct

More information

IV Unit Second Part STRUCTURES

IV Unit Second Part STRUCTURES STRUCTURES IV Unit Second Part Structure is a very useful derived data type supported in c that allows grouping one or more variables of different data types with a single name. The general syntax of structure

More information

Software Testing Laboratory Lab Assignments

Software Testing Laboratory Lab Assignments Problem Statement 01 (Week 01) Software Testing Laboratory Lab Assignments Consider an automated banking application. The user can dial the bank from a personal computer, provide a six-digit password,

More information

A. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS

A. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS Syllabus: Pointers and Preprocessors: Pointers and address, pointers and functions (call by reference) arguments, pointers and arrays, address arithmetic, character pointer and functions, pointers to pointer,initialization

More information

Multiple Choice Questions ( 1 mark)

Multiple 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 information

IV Year I SEMESTER. Software Testing Lab

IV Year I SEMESTER. Software Testing Lab IV Year I SEMESTER Software Testing Lab T P C 0 3 2 Lab Assignments Problem Statement 01 Consider an automated banking application. The user can dial the bank from a personal computer, provide a six-digit

More information

LABORATORY MANUAL. (CSE-103F) FCPC Lab

LABORATORY MANUAL. (CSE-103F) FCPC Lab LABORATORY MANUAL (CSE-103F) FCPC Lab Department of Computer Science & Engineering BRCM College of Engineering & Technology Bahal, Haryana Aim: Main aim of this course is to understand and solve logical

More information

Computer Programming Unit v

Computer Programming Unit v READING AND WRITING CHARACTERS We can read and write a character on screen using printf() and scanf() function but this is not applicable in all situations. In C programming language some function are

More information

Solution for Data Structure

Solution for Data Structure Solution for Data Structure May 2016 INDEX Q1 a 2-3 b 4 c. 4-6 d 7 Q2- a 8-12 b 12-14 Q3 a 15-18 b 18-22 Q4- a 22-35 B..N.A Q5 a 36-38 b N.A Q6- a 39-42 b 43 1 www.brainheaters.in Q1) Ans: (a) Define ADT

More information

Dynamic Memory Allocation

Dynamic Memory Allocation Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility, there are four library routines known as memory management

More information

MODULE V: POINTERS & PREPROCESSORS

MODULE V: POINTERS & PREPROCESSORS MODULE V: POINTERS & PREPROCESSORS INTRODUCTION As you know, every variable is a memory-location and every memory-location has its address defined which can be accessed using ampersand(&) operator, which

More information

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters,

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, Strings Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, decimal digits, special characters and escape

More information

International Journal of Mathematics & Computing. Research Article

International Journal of Mathematics & Computing. Research Article www.advancejournals.org Open Access Scientific Publisher Research Article C/C++ PROGRAM: DETERMINATION OF ENERGY BAND GAP FROM UV-VISIBLE SPECTROGRAPH RESULTS ABSTRACT Rajivgandhi S 1, Dinesh Kumar A 2,

More information

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

Vidyalankar. F.E. Sem. II Structured Programming Approach Prelim Question Paper Solution

Vidyalankar. F.E. Sem. II Structured Programming Approach Prelim Question Paper Solution 1. (a) 1. (b) 1. (c) F.E. Sem. II Structured Programming Approach C provides a variety of stroage class specifiers that can be used to declare explicitly the scope and lifetime of variables. The concepts

More information

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields:

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields: Assignment 6 Q1. Create a database of students using structures, where in each entry of the database will have the following fields: 1. a name, which is a string with at most 128 characters 2. their marks

More information

AE52/AC52/AT52 C & Data Structures JUNE 2014

AE52/AC52/AT52 C & Data Structures JUNE 2014 Q.2 a. Write a program to add two numbers using a temporary variable. #include #include int main () int num1, num2; clrscr (); printf( \n Enter the first number : ); scanf ( %d, &num1);

More information

UNIT III ARRAYS AND STRINGS

UNIT III ARRAYS AND STRINGS UNIT III ARRAYS AND STRINGS Arrays Initialization Declaration One dimensional and Two dimensional arrays. String- String operations String Arrays. Simple programs- sorting- searching matrix operations.

More information

1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement

1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement UNIT- II: Control Flow: Statements and Blocks, if, switch statements, Loops: while, do-while, for, break and continue, go to and Labels. Arrays and Strings: Introduction, One- dimensional arrays, Declaring

More information

STACKS 3.1 INTRODUCTION 3.2 DEFINITION

STACKS 3.1 INTRODUCTION 3.2 DEFINITION STACKS 3 3.1 INTRODUCTION A stack is a linear data structure. It is very useful in many applications of computer science. It is a list in which all insertions and deletions are made at one end, called

More information

Unit 6 Files. putchar(ch); ch = getc (fp); //Reads single character from file and advances position to next character

Unit 6 Files. putchar(ch); ch = getc (fp); //Reads single character from file and advances position to next character 1. What is File management? In real life, we want to store data permanently so that later on we can retrieve it and reuse it. A file is a collection of bytes stored on a secondary storage device like hard

More information

Solution Set(Reference Book - Programming with c By Byron Gottfried Thrid Edition)

Solution 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 information

Dynamic memory allocation

Dynamic 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 information

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE COURSE TITLE C LANGUAGE DETAILED SYLLABUS SR.NO NAME OF CHAPTERS & DETAILS HOURS ALLOTTED 1 INTRODUCTION TO C LANGUAGE About C Language Advantages of C Language Disadvantages of C Language A Sample Program

More information

/* Polynomial Expressions Using Linked List*/ #include<stdio.h> #include<conio.h> #include <malloc.h> struct node. int num; int coeff;

/* Polynomial Expressions Using Linked List*/ #include<stdio.h> #include<conio.h> #include <malloc.h> struct node. int num; int coeff; /* Polynomial Expressions Using Linked List*/ #include #include #include struct node int num; int coeff; struct node *next; ; struct node *start1 = NULL; struct node *start2

More information

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 1. Do a page check: you should have 8 pages including this cover sheet. 2. You have 50 minutes

More information

Section 1: C Programming Lab

Section 1: C Programming Lab Course Code : MCSL-017 Course Title : C and Assembly Language Programming (Lab Course) Assignment Number : MCA(1)/015/Assignment/17-18 Maximum Marks : 100 Weightage : 25% Last Dates for Submission : 15th

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

MAHARASHTRA 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 information

Unit 3 Decision making, Looping and Arrays

Unit 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 information

Chapter 3: Arrays and More C Functionality

Chapter 3: Arrays and More C Functionality Chapter 3: Arrays and More C Functionality Objectives: (a) Describe how an array is stored in memory. (b) Define a string, and describe how strings are stored. (c) Describe the implications of reading

More information

7.STRINGS. Data Structure Management (330701) 1

7.STRINGS. Data Structure Management (330701)   1 Strings and their representation String is defined as a sequence of characters. 7.STRINGS In terms of c language string is an array of characters. While storing the string in character array the size of

More information

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array?

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array? 1 What is an array? Explain with Example. What are the advantages of using an array? An array is a fixed-size sequenced collection of elements of the same data type. An array is derived data type. The

More information

Chapter 7. Additional Control Structures

Chapter 7. Additional Control Structures Chapter 7 Additional Control Structures 1 Chapter 7 Topics Switch Statement for Multi-Way Branching Do-While Statement for Looping For Statement for Looping Using break and continue Statements 2 Chapter

More information

C-Refresher: Session 10 Disk IO

C-Refresher: Session 10 Disk IO C-Refresher: Session 10 Disk IO Arif Butt Summer 2017 I am Thankful to my student Muhammad Zubair bcsf14m029@pucit.edu.pk for preparation of these slides in accordance with my video lectures at http://www.arifbutt.me/category/c-behind-the-curtain/

More information

Test Paper 1 Programming Language 1(a) What is a variable and value of a variable? A variable is an identifier and declared in a program which hold a value defined by its type e.g. integer, character etc.

More information

Lecture 3. More About C

Lecture 3. More About C Copyright 1996 David R. Hanson Computer Science 126, Fall 1996 3-1 Lecture 3. More About C Programming languages have their lingo Programming language Types are categories of values int, float, char Constants

More information

(i) Describe in detail about the classification of computers with their features and limitations(10)

(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 information

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];

Computer 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 information

Worksheet 4 Basic Input functions and Mathematical Operators

Worksheet 4 Basic Input functions and Mathematical Operators Name: Student ID: Date: Worksheet 4 Basic Input functions and Mathematical Operators Objectives After completing this worksheet, you should be able to Use an input function in C Declare variables with

More information

Unit 4. Input/Output Functions

Unit 4. Input/Output Functions Unit 4 Input/Output Functions Introduction to Input/Output Input refers to accepting data while output refers to presenting data. Normally the data is accepted from keyboard and is outputted onto the screen.

More information

SOFTWARE TESTING LABORATORY. Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50

SOFTWARE TESTING LABORATORY. Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50 SOFTWARE TESTING LABORATORY Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50 1. Design and develop a program in a language of your choice to solve the Triangle

More information

Downloaded S. from Kiran, PGT (CS) KV, Malleswaram STRUCTURES. Downloaded from

Downloaded S. from Kiran,  PGT (CS) KV, Malleswaram STRUCTURES. Downloaded from Downloaded S. from Kiran, www.studiestoday.com PGT (CS) KV, STRUCTURES WHAT IS A STRUCTURE? Structure is a collection of logically related data. It is also a collection of dissimilar datatype. Downloaded

More information

COPYRIGHT NOTICE. Infosys Limited Page 1. Education and Research Department, Infosys Limited, Electronics City, Hosur Road, Bangalore , India

COPYRIGHT NOTICE. Infosys Limited Page 1. Education and Research Department, Infosys Limited, Electronics City, Hosur Road, Bangalore , India COPYRIGHT NOTICE All ideas and information contained in this document are the intellectual property of Education and Research Department, Infosys Limited. This document is not for general distribution

More information

UNIT VI. STACKS AND QUEUES

UNIT VI. STACKS AND QUEUES UNIT VI. STACKS AND QUEUES Syllabus: /*-------------------------------------------------------------------------*/ Stack: Definition: "Stack is an ordered collection of data elements having similar data

More information

CS561 Manju Muralidharan Priya Structures in C CS200 STRUCTURES. Manju Muralidharan Priya

CS561 Manju Muralidharan Priya Structures in C CS200 STRUCTURES. Manju Muralidharan Priya OBJECTIVES: CS200 STRUCTURES Manju Muralidharan Priya By the end of this class you will have understood: 1. Definition of a structure 2. Nested Structures 3. Arrays of structure 4. User defined data types

More information

Jagannath Institute of Management Sciences Lajpat Nagar. BCA II Sem. C Programming

Jagannath Institute of Management Sciences Lajpat Nagar. BCA II Sem. C Programming Jagannath Institute of Management Sciences Lajpat Nagar BCA II Sem C Programming UNIT I Pointers: Introduction to Pointers, Pointer Notation,Decalaration and Initialization, Accessing variable through

More information

Computers Programming Course 5. Iulian Năstac

Computers Programming Course 5. Iulian Năstac Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction

More information

Bangalore South Campus

Bangalore South Campus USN: 1 P E PESIT Bangalore South Campus Hosur road, 1km before ElectronicCity, Bengaluru -100 Department of Basic Science and Humanities INTERNAL ASSESSMENT TEST 3 Date: 22/11/2017 Time:11:30am- 1.00 pm

More information

Chapter 8: Character & String. In this chapter, you ll learn about;

Chapter 8: Character & String. In this chapter, you ll learn about; Chapter 8: Character & String Principles of Programming In this chapter, you ll learn about; Fundamentals of Strings and Characters The difference between an integer digit and a character digit Character

More information

SUMMER 13 EXAMINATION Model Answer

SUMMER 13 EXAMINATION 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 information

For the partial fulfillment of CBSE Exam Made By: Ashish kumar jha Class : XII Science Roll No :

For the partial fulfillment of CBSE Exam Made By: Ashish kumar jha Class : XII Science Roll No : For the partial fulfillment of CBSE Exam. 201 Made By: Ashish kumar jha Class : XII Science Roll No :9653100 Certificate This is to certify that the project entitled employee management system which deals

More information

PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur

PERIYAR 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 information

CMPS 221 Sample Final

CMPS 221 Sample Final Name: 1 CMPS 221 Sample Final 1. What is the purpose of having the parameter const int a[] as opposed to int a[] in a function declaration and definition? 2. What is the difference between cin.getline(str,

More information

Program. SUBJECT: ACP (C - Programming) Array Program. // Find the minimum number from given N element. Prepared By : Dhaval R.

Program. SUBJECT: ACP (C - Programming) Array Program. // Find the minimum number from given N element. Prepared By : Dhaval R. Program // Find the minimum number from given N element. #include #include void main() int a[50],i,n,min; clrscr(); printf("\n Enter array size : "); scanf("%d",&n); printf("\n Enter

More information

DC54 DATA STRUCTURES DEC 2014

DC54 DATA STRUCTURES DEC 2014 Q.2 a. Write a function that computes x^y using Recursion. The property that x^y is simply a product of x and x^(y-1 ). For example, 5^4= 5 * 5^3. The recursive definition of x^y can be represented as

More information

LAB MANUAL LAB. Regulation : 2013 Branch. : B.E. All Branches Year & Semester : I Year / I Semester GE6161 COMPUTER PRACTICES

LAB MANUAL LAB. Regulation : 2013 Branch. : B.E. All Branches Year & Semester : I Year / I Semester GE6161 COMPUTER PRACTICES LAB MANUAL Regulation : 2013 Branch : B.E. All Branches Year & Semester : I Year / I Semester GE6161 COMPUTER PRACTICES LAB VVIT DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 1 ANNA UNIVERSITY: CHENNAI

More information

Chapter-14 STRUCTURES

Chapter-14 STRUCTURES Chapter-14 STRUCTURES Introduction: We have seen variables of simple data types, such as float, char, and int. Variables of such types represent one item of information: a height, an amount, a count, and

More information

Fundamentals of Programming. Lecture 10 Hamed Rasifard

Fundamentals of Programming. Lecture 10 Hamed Rasifard Fundamentals of Programming Lecture 10 Hamed Rasifard 1 Outline File Input/Output 2 Streams and Files The C I/O system supplies a consistent interface to the programmer independent of the actual device

More information

UNIT - V STRUCTURES AND UNIONS

UNIT - V STRUCTURES AND UNIONS UNIT - V STRUCTURES AND UNIONS STRUCTURE DEFINITION A structure definition creates a format that may be used to declare structure variables. Let us use an example to illustrate the process of structure

More information

Computers Programming Course 7. Iulian Năstac

Computers Programming Course 7. Iulian Năstac Computers Programming Course 7 Iulian Năstac Recap from previous course Operators in C Programming languages typically support a set of operators, which differ in the calling of syntax and/or the argument

More information

ALGORITHM 2-1 Solution for Exercise 4

ALGORITHM 2-1 Solution for Exercise 4 Chapter 2 Recursion Exercises 1. a. 3 * 4 = 12 b. (2 * (2 * fun1(0) + 7) + 7) = (2 * (2 * (3 * 0) + 7) + 7) = 21 c. (2 * (2 * fun1(2) + 7) + 7) = (2 * (2 * (3 * 2) + 7) + 7) = 45 2. a. 3 b. (fun2(2, 6)

More information

DC104 DATA STRUCTURE JUNE Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

DC104 DATA STRUCTURE JUNE Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use? Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use? The heterogeneous linked list contains different data types in its nodes and we need a link

More information

Prepared by: Shraddha Modi

Prepared by: Shraddha Modi Prepared by: Shraddha Modi Introduction In looping, a sequence of statements are executed until some conditions for termination of the loop are satisfied. A program loop consist of two segments Body of

More information

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #04

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #04 Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Topic: Arrays and Strings Practice Sheet #04 Date: 24-01-2017 Instructions: For the questions consisting code segments,

More information

Structure, Union. Ashishprajapati29.wordpress.com. 1 What is structure? How to declare a Structure? Explain with Example

Structure, Union. Ashishprajapati29.wordpress.com. 1 What is structure? How to declare a Structure? Explain with Example Structure, Union 1 What is structure? How to declare a Structure? Explain with Example Structure s a collection of logically related data items of different data types grouped together under a single name.

More information

C Tutorial Pointers, Dynamic Memory allocation, Makefile

C Tutorial Pointers, Dynamic Memory allocation, Makefile C Tutorial Pointers, Dynamic Memory allocation, Makefile -Abhishek Yeluri and Rejina Basnet 8/23/18 CS370 - Fall 2018 Outline What is a pointer? & and * operators Pointers with Arrays and Strings Dynamic

More information

Chapter 6. Section 6.4 Altering the Flow of Control. CS 50 Hathairat Rattanasook

Chapter 6. Section 6.4 Altering the Flow of Control. CS 50 Hathairat Rattanasook Chapter 6 Section 6.4 Altering the Flow of Control CS 50 Hathairat Rattanasook continue; The continue statement will skip the current iteration of a loop and jump to the next iteration. // continue in

More information

C Pointers. Abdelghani Bellaachia, CSCI 1121 Page: 1

C Pointers. Abdelghani Bellaachia, CSCI 1121 Page: 1 C Pointers 1. Objective... 2 2. Introduction... 2 3. Pointer Variable Declarations and Initialization... 3 4. Reference operator (&) and Dereference operator (*) 6 5. Relation between Arrays and Pointers...

More information

Chapter 8 C Characters and Strings

Chapter 8 C Characters and Strings Chapter 8 C Characters and Strings Objectives of This Chapter To use the functions of the character handling library (). To use the string conversion functions of the general utilities library

More information

Test Paper 3 Programming Language Solution Question 1: Briefly describe the structure of a C program. A C program consists of (i) functions and (ii) statements There should be at least one function called

More information

Structured Programming Approach

Structured Programming Approach Software Engineering MU 2. Project Scheduling CGBS 2015-2016 Structured Programming Approach FIRST YEAR HUMANITIES & SCIENCE (FEC205) MRS.ANURADHA BHATIA M.E. Computer Engineering Table of Contents 1.

More information

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M4.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 information

List of Programs: Programs: 1. Polynomial addition

List of Programs: Programs: 1. Polynomial addition List of Programs: 1. Polynomial addition 2. Common operations on vectors in c 3. Matrix operation: multiplication, transpose 4. Basic Unit conversion 5. Number conversion: Decimal to binary 6. Number conversion:

More information